Patients
Pushing your patients into Twofold, what a field you send costs you, and how to reconcile.
Patients are the one thing that flows from your system into Twofold. You push them; nothing pushes back. There is no patient sync, there are no patient webhooks, and a provider never has to retype a name you already hold.
Every call on this page is made as the provider, with their access token — see Authentication for how you get one.
One idempotent write
A patient is created and updated by the same call, addressed by your id for them. You never need to know Twofold's patientId to write.
curl -X PUT https://partner-api.trytwofold.com/v2/users/provider-1042/patients/client-2048 \
-H "Authorization: Bearer twofold_access_prod_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"dateOfBirth": "1990-01-15",
"email": "jane@example.com",
"phone": "+15551234567",
"pronouns": "She/Her"
}'curl -X PUT https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/client-2048 \
-H "Authorization: Bearer twofold_access_staging_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"dateOfBirth": "1990-01-15",
"email": "jane@example.com",
"phone": "+15551234567",
"pronouns": "She/Her"
}'{
"patientId": "p_ab12Cd34Ef56",
"patientExternalId": "client-2048",
"name": "Jane Doe",
"dateOfBirth": "1990-01-15",
"email": "jane@example.com",
"phone": "+15551234567",
"pronouns": "She/Her",
"createdAt": "2026-07-19T12:34:56.789Z",
"updatedAt": "2026-07-19T12:34:56.789Z"
}{
"patientId": "p_ab12Cd34Ef56",
"patientExternalId": "client-2048",
"name": "Jane Doe",
"dateOfBirth": "1990-01-15",
"email": "jane@example.com",
"phone": "+15551234567",
"pronouns": "She/Her",
"createdAt": "2026-07-19T12:34:56.789Z",
"updatedAt": "2026-07-19T12:34:56.789Z"
}The first call creates, every call after it updates, and calling it twice with the same body changes nothing — so it is safe to retry, and safe to run over your whole patient list on a schedule.
| Field | Notes |
|---|---|
name | Required the first time — the call that creates the patient is rejected without it. Optional on every later call. |
dateOfBirth | Date-only, 1990-01-15. |
email | A valid address. |
phone | E.164, +15551234567. |
pronouns | One of Twofold's options, spelled exactly as on Field values. Anything else is rejected. |
patientContext | Free-text background the models read while generating the note. Up to 150,000 characters and 10,000 words. Write-only, see below. |
Everything except name accepts null, which clears the field.
One asymmetry to allow for when you read a patient back: pronouns is a closed set on the way in and an open one on the way out. A provider can create their own pronoun set inside Twofold and put a patient on it, so the value you read may be one you could not have sent. Match it if you can and pass it through if you cannot — do not validate a response against the list you write from.
patientExternalId is unique per linked provider, not per organization. The same person seen by three of your providers is three patients in Twofold, each carrying the same value. That is the model, not a limitation: a note belongs to one provider, and so does the patient it was recorded for.
⚠️ A field you send becomes permanently yours. Any field included in an upsert — including one sent as null — is marked partner-managed on that patient: the provider can no longer edit it in Twofold, and it stays locked forever. Omitting the field from later upserts does not unlock it, and there is no API that releases it. Send only what you intend to own for the lifetime of that patient.
That warning is the reason to think about null before you send it. Sending "email": null does not mean "I have no email for them" — it means "I own this field, and it is empty", and the provider can no longer fill it in themselves. If you do not have a value and do not want to own the field, leave it out.
Ownership runs one way in another sense too: a patient you send cannot be deleted, by the provider in the app or by you through the API. There is no delete and no archive, by design.
Upserting many patients in one request
For a provider's first sync, or any time you have more than a handful of patients to write, send them in batches. One request takes up to 1,000 patients. Each one carries its patientExternalId and the same fields as the single upsert, with the same rules, including the one about fields becoming yours.
curl -X POST https://partner-api.trytwofold.com/v2/users/provider-1042/patients/batch \
-H "Authorization: Bearer twofold_access_prod_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"patients": [
{ "patientExternalId": "client-2048", "name": "Jane Doe", "dateOfBirth": "1990-01-15" },
{ "patientExternalId": "client-2049", "email": "sam@example.com" },
{ "patientExternalId": "client-2050", "name": "Alex Kim", "email": "not-an-address" }
]
}'curl -X POST https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/batch \
-H "Authorization: Bearer twofold_access_staging_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"patients": [
{ "patientExternalId": "client-2048", "name": "Jane Doe", "dateOfBirth": "1990-01-15" },
{ "patientExternalId": "client-2049", "email": "sam@example.com" },
{ "patientExternalId": "client-2050", "name": "Alex Kim", "email": "not-an-address" }
]
}'{
"results": [
{
"patientExternalId": "client-2048",
"status": "created",
"patient": { "patientId": "p_ab12Cd34Ef56", "patientExternalId": "client-2048", "name": "Jane Doe", "...": "..." }
},
{
"patientExternalId": "client-2049",
"status": "failed",
"error": { "code": "invalid_parameters", "message": "name is required when creating a patient.", "param": "name" }
},
{
"patientExternalId": "client-2050",
"status": "failed",
"error": { "code": "invalid_parameters", "message": "Invalid email address", "param": "email" }
}
]
}{
"results": [
{
"patientExternalId": "client-2048",
"status": "created",
"patient": { "patientId": "p_ab12Cd34Ef56", "patientExternalId": "client-2048", "name": "Jane Doe", "...": "..." }
},
{
"patientExternalId": "client-2049",
"status": "failed",
"error": { "code": "invalid_parameters", "message": "name is required when creating a patient.", "param": "name" }
},
{
"patientExternalId": "client-2050",
"status": "failed",
"error": { "code": "invalid_parameters", "message": "Invalid email address", "param": "email" }
}
]
}Patients succeed or fail independently. As long as the request itself is well formed, the answer is 200 with one result per patient, in the order you sent them: created, updated (both with the patient object), or failed with an error. Nothing was written for a failed patient. Fix it and send it again, on its own or in your next batch.
A failed patient carries invalid_parameters when one of its fields is invalid or it is new and has no name, with param naming the field. internal_error means writing it failed on our side: send it again as is.
The whole request is rejected with 400 when the request itself is wrong: a body that isn't JSON, a missing or empty patients array, more than 1,000 patients, an entry that isn't an object, a patientExternalId that is missing, empty or not a string, or the same patientExternalId twice in one request. The body can be up to 20 MB. Past that you get 400 with request_body_too_large, which a batch with long patientContext values can hit well before 1,000 patients, so send those in smaller batches.
Batches have their own rate limit, separate from the provider's limit for other calls. See Rate limits.
Patient context is written here and read somewhere else
patientContext is free-text background — history, presentation, anything the provider would otherwise carry in their head — and Twofold's models read it while generating the note. It is set on the upsert like any other field, but it is absent from the patient object and from the list, because it can be long and every other read would carry it.
curl https://partner-api.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
-H "Authorization: Bearer twofold_access_prod_xxxxxxxxxxxx"curl https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients/client-2048/patient-context \
-H "Authorization: Bearer twofold_access_staging_xxxxxxxxxxxx"{ "patientExternalId": "client-2048", "patientContext": "Referred by Dr. Smith. Seen monthly since March." }{ "patientExternalId": "client-2048", "patientContext": "Referred by Dr. Smith. Seen monthly since March." }It can be up to 150,000 characters and 10,000 words. A longer value fails with invalid_parameters and param set to patientContext, and nothing else in that upsert is written.
patientContext is null when it was never set. A patientExternalId with no patient behind it answers 404 with code patient_not_found.
Reading back what you pushed
curl "https://partner-api.trytwofold.com/v2/users/provider-1042/patients?limit=25" \
-H "Authorization: Bearer twofold_access_prod_xxxxxxxxxxxx"curl "https://partner-api.staging.trytwofold.com/v2/users/provider-1042/patients?limit=25" \
-H "Authorization: Bearer twofold_access_staging_xxxxxxxxxxxx"{
"data": [{ "patientId": "p_ab12Cd34Ef56", "patientExternalId": "client-2048", "name": "Jane Doe", "…": "…" }],
"nextCursor": "eyJjcmVhdGVkQXRNcyI6…"
}{
"data": [{ "patientId": "p_ab12Cd34Ef56", "patientExternalId": "client-2048", "name": "Jane Doe", "…": "…" }],
"nextCursor": "eyJjcmVhdGVkQXRNcyI6…"
}Newest first, limit 1–100 (25 by default), and cursor takes the previous page's nextCursor until that comes back null. Cursors are opaque — pass them back, never parse them.
This list is your patients, not the provider's. It contains exactly the patients you upserted for that provider; the ones they created themselves in Twofold are not in it, and carry no patientExternalId to address them by. It is a mirror of what you wrote, not a window into their account.
Reconciling without a full backfill
If you are not sure what a provider already has in Twofold — a first sync, a restored backup, a job that failed halfway — ask, instead of upserting everything again.
curl -X POST https://partner-api.trytwofold.com/v2/users/provider-1042/patients/missing \
-H "Authorization: Bearer twofold_access_prod_xxxxxxxxxxxx" \
-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_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"patientExternalIds": ["client-2048", "client-2049"]}'{ "missingPatientExternalIds": ["client-2049"] }{ "missingPatientExternalIds": ["client-2049"] }Up to 1,000 ids per call, and what comes back is the subset that has no patient in Twofold yet — upsert those. It says nothing about whether the patients that do exist are up to date, so it is a way to skip work, not a way to detect drift.
When to push
Before the provider needs the patient, not when. The launch flow locks a recording to a patientExternalId, and if that patient does not exist yet Twofold waits — polling until it appears — so the provider watches a spinner for exactly as long as your upsert takes. Upsert as part of opening the launch URL, or ahead of the day's appointments, and the wait is never visible.
Push the whole list right after the provider links, in batches. Upsert up to 1,000 patients per request, so a provider with 1,000 patients takes one call instead of 1,000. Keep the single PUT for the patients that change day to day.
Nothing about a patient consumes a seat or requires FULL_ACCESS: you can push a READ_ONLY provider's whole list before you ever activate them.