Twofold v2.7

Search pages, sections and endpoints.

    Open the console

    API reference

    Patients

    Pushing and reading the patients you manage for a linked user.

    Environment

    Create or update a patient

    put/v2/users/{externalUserId}/patients/{patientExternalId}

    Authenticate with a user access token — the externalUserId in the path must be the linked user the token belongs to.

    Path parameters

    externalUserIdstringrequired

    The partner's id for the linked user, bound at link time. Must match the user the access token belongs to.

    patientExternalIdstringrequired

    The partner's id for the patient, unique per linked user.

    Request bodyJSON

    namestring

    The patient's full name. Required when this upsert creates the patient.

    dateOfBirthstring | null

    Date of birth, date-only ISO 8601.

    emailstring | null

    The patient's email address.

    phonestring | null

    The patient's phone number, E.164 format.

    pronounsenum

    The patient's pronouns — one of Twofold's pronoun options, exactly as shown in the Twofold UI.

    She/HerHe/HimThey/Themnull

    patientContextstring | null

    Free-text background about the patient, used during note generation. Write-only here — read it back via the patient-context endpoint.

    Response200

    The upserted patient. Idempotent: creates on first call, updates after.

    patientIdstring

    Twofold's stable id for the patient.

    patientExternalIdstring

    The partner's id for this patient, unique per linked user.

    namestring

    The patient's full name.

    dateOfBirthstring | null

    Date of birth, date-only ISO 8601.

    emailstring | null

    The patient's email address.

    phonestring | null

    The patient's phone number, E.164 format.

    pronounsstring | null

    The patient's pronouns as shown in the Twofold UI. May be a custom value the user created in-app.

    createdAtstring

    When the patient was created in Twofold, ISO 8601 UTC.

    updatedAtstring

    When the patient last changed, ISO 8601 UTC.

    Example request

    bash
    curl -X PUT https://partner-api.trytwofold.com/v2/users/provider-1042/patients/client-2048 \
      -H "Authorization: Bearer twofold_access_prod_…" \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Jane Doe",
      "dateOfBirth": "1990-01-15",
      "email": "jane@example.com",
      "phone": "+15551234567",
      "pronouns": "She/Her",
      "patientContext": null
    }'
    bash
    curl -X PUT https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/client-2048 \
      -H "Authorization: Bearer twofold_access_staging_…" \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Jane Doe",
      "dateOfBirth": "1990-01-15",
      "email": "jane@example.com",
      "phone": "+15551234567",
      "pronouns": "She/Her",
      "patientContext": null
    }'

    Example response

    json
    {
      "patientId": "p_ab12Cd34Ef56",
      "patientExternalId": "client-2048",
      "name": "Jane Doe",
      "dateOfBirth": "1990-01-15",
      "email": null,
      "phone": "+15551234567",
      "pronouns": "She/Her",
      "createdAt": "2026-04-01T17:32:04.000Z",
      "updatedAt": "2026-04-01T17:32:04.000Z"
    }
    json
    {
      "patientId": "p_ab12Cd34Ef56",
      "patientExternalId": "client-2048",
      "name": "Jane Doe",
      "dateOfBirth": "1990-01-15",
      "email": null,
      "phone": "+15551234567",
      "pronouns": "She/Her",
      "createdAt": "2026-04-01T17:32:04.000Z",
      "updatedAt": "2026-04-01T17:32:04.000Z"
    }

    Errors

    400

    The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.

    401

    Authentication failed — the access token is missing, invalid or expired. Refresh and retry. Possible error.code values: missing_access_token, invalid_access_token, access_token_expired, wrong_environment_access_token, partner_key_on_user_endpoint.

    403

    The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.

    429

    Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.

    500

    Something failed on Twofold's side, or the partner API is temporarily paused (temporarily_unavailable). Safe to retry. Possible error.code values: internal_error, temporarily_unavailable.

    Create or update patients in a batch

    post/v2/users/{externalUserId}/patients/batch

    Authenticate with a user access token — the externalUserId in the path must be the linked user the token belongs to.

    Upserts up to 1,000 patients in one request, each with the same rules as the single upsert. Patients succeed or fail independently: the response is 200 with one result per patient even when some failed. The request body may be up to 20 MB.

    Path parameters

    externalUserIdstringrequired

    The partner's id for the linked user, bound at link time. Must match the user the access token belongs to.

    Request bodyJSON

    patientsarray of objectrequired

    1 to 1,000 patients. A patientExternalId may appear only once per batch.

    patientExternalIdstringrequired

    The partner's id for the patient, unique per linked user.

    namestring

    The patient's full name. Required when this upsert creates the patient.

    dateOfBirthstring | null

    Date of birth, date-only ISO 8601.

    emailstring | null

    The patient's email address.

    phonestring | null

    The patient's phone number, E.164 format.

    pronounsenum

    The patient's pronouns — one of Twofold's pronoun options, exactly as shown in the Twofold UI.

    She/HerHe/HimThey/Themnull

    patientContextstring | null

    Free-text background about the patient, used during note generation. Write-only here — read it back via the patient-context endpoint.

    Response200

    One result per patient, in request order.

    resultsarray of object

    One result per patient in the request, in request order.

    Example request

    bash
    curl -X POST https://partner-api.trytwofold.com/v2/users/provider-1042/patients/batch \
      -H "Authorization: Bearer twofold_access_prod_…" \
      -H "Content-Type: application/json" \
      -d '{
      "patients": [
        {
          "patientExternalId": "client-2048",
          "name": "Jane Doe",
          "dateOfBirth": "1990-01-15",
          "email": "jane@example.com",
          "phone": "+15551234567",
          "pronouns": "She/Her",
          "patientContext": null
        }
      ]
    }'
    bash
    curl -X POST https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/batch \
      -H "Authorization: Bearer twofold_access_staging_…" \
      -H "Content-Type: application/json" \
      -d '{
      "patients": [
        {
          "patientExternalId": "client-2048",
          "name": "Jane Doe",
          "dateOfBirth": "1990-01-15",
          "email": "jane@example.com",
          "phone": "+15551234567",
          "pronouns": "She/Her",
          "patientContext": null
        }
      ]
    }'

    Example response

    json
    {
      "results": [
        null
      ]
    }
    json
    {
      "results": [
        null
      ]
    }

    Errors

    400

    The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters, request_body_too_large.

    401

    Authentication failed — the access token is missing, invalid or expired. Refresh and retry. Possible error.code values: missing_access_token, invalid_access_token, access_token_expired, wrong_environment_access_token, partner_key_on_user_endpoint.

    403

    The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.

    429

    Rate limit exceeded: 1 batch request/second (burst 2) per linked user, separate from the per-user limit on other endpoints. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.

    500

    Something failed on Twofold's side, or the partner API is temporarily paused (temporarily_unavailable). Safe to retry. Possible error.code values: internal_error, temporarily_unavailable.

    List patients

    get/v2/users/{externalUserId}/patients

    Authenticate with a user access token — the externalUserId in the path must be the linked user the token belongs to.

    Path parameters

    externalUserIdstringrequired

    The partner's id for the linked user, bound at link time. Must match the user the access token belongs to.

    Query parameters

    limitinteger · default 25

    Page size, 1-100.

    cursorstring

    Opaque cursor from the previous page's nextCursor. Omit for the first page.

    Response200

    The linked user's partner-managed patients, newest first.

    dataarray of object

    One page of partner-managed patients, newest first.

    patientIdstring

    Twofold's stable id for the patient.

    patientExternalIdstring

    The partner's id for this patient, unique per linked user.

    namestring

    The patient's full name.

    dateOfBirthstring | null

    Date of birth, date-only ISO 8601.

    emailstring | null

    The patient's email address.

    phonestring | null

    The patient's phone number, E.164 format.

    pronounsstring | null

    The patient's pronouns as shown in the Twofold UI. May be a custom value the user created in-app.

    createdAtstring

    When the patient was created in Twofold, ISO 8601 UTC.

    updatedAtstring

    When the patient last changed, ISO 8601 UTC.

    nextCursorstring | null

    Opaque cursor for the next page; null when this is the last page.

    Example request

    bash
    curl https://partner-api.trytwofold.com/v2/users/provider-1042/patients \
      -H "Authorization: Bearer twofold_access_prod_…"
    bash
    curl https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients \
      -H "Authorization: Bearer twofold_access_staging_…"

    Example response

    json
    {
      "data": [
        {
          "patientId": "p_ab12Cd34Ef56",
          "patientExternalId": "client-2048",
          "name": "Jane Doe",
          "dateOfBirth": "1990-01-15",
          "email": null,
          "phone": "+15551234567",
          "pronouns": "She/Her",
          "createdAt": "2026-04-01T17:32:04.000Z",
          "updatedAt": "2026-04-01T17:32:04.000Z"
        }
      ],
      "nextCursor": null
    }
    json
    {
      "data": [
        {
          "patientId": "p_ab12Cd34Ef56",
          "patientExternalId": "client-2048",
          "name": "Jane Doe",
          "dateOfBirth": "1990-01-15",
          "email": null,
          "phone": "+15551234567",
          "pronouns": "She/Her",
          "createdAt": "2026-04-01T17:32:04.000Z",
          "updatedAt": "2026-04-01T17:32:04.000Z"
        }
      ],
      "nextCursor": null
    }

    Errors

    400

    The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.

    401

    Authentication failed — the access token is missing, invalid or expired. Refresh and retry. Possible error.code values: missing_access_token, invalid_access_token, access_token_expired, wrong_environment_access_token, partner_key_on_user_endpoint.

    403

    The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.

    429

    Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.

    500

    Something failed on Twofold's side, or the partner API is temporarily paused (temporarily_unavailable). Safe to retry. Possible error.code values: internal_error, temporarily_unavailable.

    Get a patient's context

    get/v2/users/{externalUserId}/patients/{patientExternalId}/patient-context

    Authenticate with a user access token — the externalUserId in the path must be the linked user the token belongs to.

    Path parameters

    externalUserIdstringrequired

    The partner's id for the linked user, bound at link time. Must match the user the access token belongs to.

    patientExternalIdstringrequired

    The partner's id for the patient, unique per linked user.

    Response200

    The patient's context.

    patientExternalIdstring

    The partner's id for this patient, unique per linked user.

    patientContextstring | null

    The patient's context; null when it was never set.

    Example request

    bash
    curl https://partner-api.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
      -H "Authorization: Bearer twofold_access_prod_…"
    bash
    curl https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
      -H "Authorization: Bearer twofold_access_staging_…"

    Example response

    json
    {
      "patientExternalId": "client-2048",
      "patientContext": null
    }
    json
    {
      "patientExternalId": "client-2048",
      "patientContext": null
    }

    Errors

    400

    The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.

    401

    Authentication failed — the access token is missing, invalid or expired. Refresh and retry. Possible error.code values: missing_access_token, invalid_access_token, access_token_expired, wrong_environment_access_token, partner_key_on_user_endpoint.

    403

    The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.

    404

    The addressed resource does not exist for this credential. Possible error.code values: patient_not_found.

    429

    Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.

    500

    Something failed on Twofold's side, or the partner API is temporarily paused (temporarily_unavailable). Safe to retry. Possible error.code values: internal_error, temporarily_unavailable.

    Check which patients are missing

    post/v2/users/{externalUserId}/patients/missing

    Authenticate with a user access token — the externalUserId in the path must be the linked user the token belongs to.

    Path parameters

    externalUserIdstringrequired

    The partner's id for the linked user, bound at link time. Must match the user the access token belongs to.

    Request bodyJSON

    patientExternalIdsarray of stringrequired

    Up to 1,000 of the partner's patient ids to check.

    Response200

    Which of these patients don't exist in Twofold yet.

    missingPatientExternalIdsarray of string

    The ids from the request that have no patient in Twofold yet — upsert these.

    Example request

    bash
    curl -X POST https://partner-api.trytwofold.com/v2/users/provider-1042/patients/missing \
      -H "Authorization: Bearer twofold_access_prod_…" \
      -H "Content-Type: application/json" \
      -d '{
      "patientExternalIds": [
        "client-2048",
        "client-2049"
      ]
    }'
    bash
    curl -X POST https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/missing \
      -H "Authorization: Bearer twofold_access_staging_…" \
      -H "Content-Type: application/json" \
      -d '{
      "patientExternalIds": [
        "client-2048",
        "client-2049"
      ]
    }'

    Example response

    json
    {
      "missingPatientExternalIds": [
        "client-2049"
      ]
    }
    json
    {
      "missingPatientExternalIds": [
        "client-2049"
      ]
    }

    Errors

    400

    The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.

    401

    Authentication failed — the access token is missing, invalid or expired. Refresh and retry. Possible error.code values: missing_access_token, invalid_access_token, access_token_expired, wrong_environment_access_token, partner_key_on_user_endpoint.

    403

    The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.

    429

    Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.

    500

    Something failed on Twofold's side, or the partner API is temporarily paused (temporarily_unavailable). Safe to retry. Possible error.code values: internal_error, temporarily_unavailable.