How an agent uses Anonify

Follow these steps in order. This is the agent API on https://app.anonify.nl. A person can read this page too.

  1. 1. Ask whether an account already exists

    Ask the person whether they already have a Anonify account.

    If they do, do not call signup. Skip the new-account step and use the existing-account step.

  2. 2. New account

    If they do not have an account, POST https://app.anonify.nl/api/v1/auth/signup with the JSON below. Omit password. Do not add a password field.

    username is letters and numbers only. The server stores it in lowercase. It is permanent.

    firstName and lastName may be omitted or empty strings. isManager is true.

    The response is user, userKey, and handoff. There is no token. userKey is the API key. It starts with ank_. Do not send that handoff as a bearer token, and do not put it in the editor link.

    The account gets a company named My company and a workspace named My workspace.

    user.requiresPasswordSetup stays true, so the first time the person opens the app it asks for a password.

    If the response says the username or email already exists, stop. The server message is "Username or Email already exists!". Do not call signup again.

    The limit is 5 signup attempts per IP per hour. After that, the response is 429.

    Do not call POST /api/v1/auth/handoff. That route is for the app, and the code works once.

    POST https://app.anonify.nl/api/v1/auth/signup
    Content-Type: application/json
    
    {
      "username": "lettersandnumbers",
      "email": "person@example.com",
      "isManager": true,
      "firstName": "",
      "lastName": ""
    }
    
    Response fields: user, userKey, handoff
    No token.
  3. 3. Existing account

    Do not call signup.

    The person logs in at https://app.anonify.nl/login, opens https://app.anonify.nl/profile, creates one key, and pastes it to you.

    The key starts with ank_. One key is active. A new key replaces the old one. Keys expire after 90 days.

    A key with no expiry, or a past expiry, is 401. On 401, ask them to create a new key on https://app.anonify.nl/profile. Do not sign up again.

  4. 4. Send the key

    Send the key on every request below as Authorization: Bearer ank_...

    Use userKey from signup, or the key the person pasted. Do not send a signup token. There is no signup token.

    Authorization: Bearer ank_...
  5. 5. Read workspaces

    GET https://app.anonify.nl/api/v1/agent-actions/workspaces. The response is an object with a workspaces array. Each item has id and name.

    One workspace is the default. When the response contains one workspace, omit workspaceId on the upload.

    When the response contains more than one workspace, the upload must include that workspace id as workspaceId. Ask the person which id to use.

    When the response contains no workspace, the upload returns 400. An id this key cannot access returns 403.

    You cannot create a workspace.

    GET https://app.anonify.nl/api/v1/agent-actions/workspaces
    Authorization: Bearer ank_...
    
    {
      "workspaces": [{ "id": "<id>", "name": "<name>" }]
    }
  6. 6. Upload the file

    POST https://app.anonify.nl/api/v1/agent-actions/uploads as multipart form data.

    Send the file field. PDF, PNG, and JPEG are accepted.

    Send workspaceId only when this key can access more than one workspace.

    The response is taskId and status.

    After this response, the upload exists. Request the editor link in the last step when the person should open it. While the task is still processing, poll its status and do not edit yet.

    POST https://app.anonify.nl/api/v1/agent-actions/uploads
    Authorization: Bearer ank_...
    Content-Type: multipart/form-data
    
    file: <PDF, PNG, or JPEG>
    workspaceId: <only when this key can access more than one workspace>
  7. 7. Poll the task

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}. Replace {taskId} with the taskId from the upload response.

    The response is taskId and status.

    While the task is still processing, poll this route. Do not edit yet.

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}
    Authorization: Bearer ank_...
    
    {
      "taskId": "<taskId>",
      "status": "<status>"
    }
  8. 8. Read the job

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/job. Replace {taskId} with the taskId from the upload response.

    The response includes status, pageCount, and items.

    Each item has id, page, text, redact, and tag.

    Only items with a tag are returned, not every word.

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/job
    Authorization: Bearer ank_...
    
    {
      "status": "<status>",
      "pageCount": 1,
      "items": [
        { "id": "<id>", "page": 0, "text": "<text>", "redact": true, "tag": "<tag>" }
      ]
    }
  9. 9. Accept or reject items

    POST https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/redactions with JSON. accept and reject are optional arrays of item ids.

    Send at least one id. The same id must not be in both arrays.

    That generates the output.

    POST https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/redactions
    Authorization: Bearer ank_...
    Content-Type: application/json
    
    {
      "accept": ["<item id>"],
      "reject": []
    }
  10. 10. Download the PDF

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/file.

    When outputStatus is GENERATED_OUTPUT, the response is the PDF.

    Otherwise the response is JSON. outputStatus is NOT_GENERATED or GENERATING_OUTPUT. It is not an empty file. Do not save that JSON as a PDF.

    GET https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/file
    Authorization: Bearer ank_...
    
    PDF when outputStatus is GENERATED_OUTPUT.
    Otherwise JSON. outputStatus is NOT_GENERATED or GENERATING_OUTPUT.
  11. 11. Read the page limit

    GET https://app.anonify.nl/api/v1/agent-actions/limits. The response includes pagesLeft.

    Do not start a checkout. Do not pay.

    GET https://app.anonify.nl/api/v1/agent-actions/limits
    Authorization: Bearer ank_...
    
    {
      "pagesLeft": 0
    }
  12. 12. Give the person the editor

    After the upload exists, for a new or existing account, POST https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/handoff with the same Bearer key. Replace {taskId} with the taskId from the upload response.

    The response has a one-time code in handoff.

    The link is https://app.anonify.nl/edit/{taskId}#handoff=CODE. Replace {taskId} in the path, and replace CODE with that handoff value.

    The code expires in 15 minutes and works once.

    Do not put #token or #user in the link.

    Do not call the React /media or /tasks routes.

    POST https://app.anonify.nl/api/v1/agent-actions/tasks/{taskId}/handoff
    Authorization: Bearer ank_...
    
    {
      "handoff": "<one-time code>"
    }
    
    https://app.anonify.nl/edit/{taskId}#handoff=<one-time code>

Do not do these

  • Do not list documents. There is no document list.
  • Do not pay, and do not start a checkout.
  • Do not invite anyone.
  • Do not delete anything.
  • Do not rename the company.
  • Do not create a workspace.
  • Do not call the React /media or /tasks routes.
  • Do not call POST /api/v1/auth/handoff. That route is for the app. The code works once.
  • Do not call signup if the person already has an account, if the response says the username or email already exists, or if a request returns 401.
Chat with us on WhatsApp