API reference
Patients
Pushing and reading the patients you manage for a linked user.
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
externalUserIdstringrequiredThe partner's id for the linked user, bound at link time. Must match the user the access token belongs to.
patientExternalIdstringrequiredThe partner's id for the patient, unique per linked user.
Request bodyJSON
namestringThe patient's full name. Required when this upsert creates the patient.
dateOfBirthstring | nullDate of birth, date-only ISO 8601.
emailstring | nullThe patient's email address.
phonestring | nullThe patient's phone number, E.164 format.
pronounsenumThe patient's pronouns — one of Twofold's pronoun options, exactly as shown in the Twofold UI.
She/HerHe/HimThey/Themnull
patientContextstring | nullFree-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.
patientIdstringTwofold's stable id for the patient.
patientExternalIdstringThe partner's id for this patient, unique per linked user.
namestringThe patient's full name.
dateOfBirthstring | nullDate of birth, date-only ISO 8601.
emailstring | nullThe patient's email address.
phonestring | nullThe patient's phone number, E.164 format.
pronounsstring | nullThe patient's pronouns as shown in the Twofold UI. May be a custom value the user created in-app.
createdAtstringWhen the patient was created in Twofold, ISO 8601 UTC.
updatedAtstringWhen the patient last changed, ISO 8601 UTC.
Example request
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
}'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
{
"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"
}{
"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
400The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.
401Authentication 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.
403The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.
429Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.
500Something 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
externalUserIdstringrequiredThe partner's id for the linked user, bound at link time. Must match the user the access token belongs to.
Request bodyJSON
patientsarray of objectrequired1 to 1,000 patients. A patientExternalId may appear only once per batch.
patientExternalIdstringrequiredThe partner's id for the patient, unique per linked user.
namestringThe patient's full name. Required when this upsert creates the patient.
dateOfBirthstring | nullDate of birth, date-only ISO 8601.
emailstring | nullThe patient's email address.
phonestring | nullThe patient's phone number, E.164 format.
pronounsenumThe patient's pronouns — one of Twofold's pronoun options, exactly as shown in the Twofold UI.
She/HerHe/HimThey/Themnull
patientContextstring | nullFree-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 objectOne result per patient in the request, in request order.
Example request
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
}
]
}'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
{
"results": [
null
]
}{
"results": [
null
]
}Errors
400The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters, request_body_too_large.
401Authentication 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.
403The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.
429Rate 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.
500Something 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
externalUserIdstringrequiredThe partner's id for the linked user, bound at link time. Must match the user the access token belongs to.
Query parameters
limitinteger · default 25Page size, 1-100.
cursorstringOpaque cursor from the previous page's nextCursor. Omit for the first page.
Response200
The linked user's partner-managed patients, newest first.
dataarray of objectOne page of partner-managed patients, newest first.
patientIdstringTwofold's stable id for the patient.
patientExternalIdstringThe partner's id for this patient, unique per linked user.
namestringThe patient's full name.
dateOfBirthstring | nullDate of birth, date-only ISO 8601.
emailstring | nullThe patient's email address.
phonestring | nullThe patient's phone number, E.164 format.
pronounsstring | nullThe patient's pronouns as shown in the Twofold UI. May be a custom value the user created in-app.
createdAtstringWhen the patient was created in Twofold, ISO 8601 UTC.
updatedAtstringWhen the patient last changed, ISO 8601 UTC.
nextCursorstring | nullOpaque cursor for the next page; null when this is the last page.
Example request
curl https://partner-api.trytwofold.com/v2/users/provider-1042/patients \
-H "Authorization: Bearer twofold_access_prod_…"curl https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients \
-H "Authorization: Bearer twofold_access_staging_…"Example response
{
"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
}{
"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
400The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.
401Authentication 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.
403The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.
429Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.
500Something 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
externalUserIdstringrequiredThe partner's id for the linked user, bound at link time. Must match the user the access token belongs to.
patientExternalIdstringrequiredThe partner's id for the patient, unique per linked user.
Response200
The patient's context.
patientExternalIdstringThe partner's id for this patient, unique per linked user.
patientContextstring | nullThe patient's context; null when it was never set.
Example request
curl https://partner-api.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
-H "Authorization: Bearer twofold_access_prod_…"curl https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
-H "Authorization: Bearer twofold_access_staging_…"Example response
{
"patientExternalId": "client-2048",
"patientContext": null
}{
"patientExternalId": "client-2048",
"patientContext": null
}Errors
400The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.
401Authentication 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.
403The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.
404The addressed resource does not exist for this credential. Possible error.code values: patient_not_found.
429Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.
500Something 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
externalUserIdstringrequiredThe partner's id for the linked user, bound at link time. Must match the user the access token belongs to.
Request bodyJSON
patientExternalIdsarray of stringrequiredUp to 1,000 of the partner's patient ids to check.
Response200
Which of these patients don't exist in Twofold yet.
missingPatientExternalIdsarray of stringThe ids from the request that have no patient in Twofold yet — upsert these.
Example request
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"
]
}'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
{
"missingPatientExternalIds": [
"client-2049"
]
}{
"missingPatientExternalIds": [
"client-2049"
]
}Errors
400The request is invalid. param names the offending parameter when there is one. Possible error.code values: invalid_parameters.
401Authentication 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.
403The token is valid but may not access this resource. Possible error.code values: link_revoked, partner_not_activated, external_user_id_mismatch.
429Rate limit exceeded: 100 requests/second (burst 200) per linked user. Wait Retry-After seconds and retry. Possible error.code values: rate_limit_exceeded.
500Something 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.