Twofold v2.7

Search pages, sections and endpoints.

    Open the console

    Concepts & identifiers

    The objects the integration moves between your system and Twofold, and every id that addresses them.

    Environment

    Five objects cross the boundary between your system and Twofold. Everything else in the API is an operation on one of them.

    ObjectWhat it is
    PartnerYour organization. One per environment — your staging partner and your production partner are separate records with separate ids.
    LinkOne provider's connection between your system and their Twofold account. Created by the provider through the consent screen; carries their access level.
    PatientA person a provider records sessions about. Patients belong to one provider, not to your organization.
    NoteOne recorded session and the document generated from it.
    TemplateThe structure a note is generated into: an ordered list of sections. You write these yourself in the partner console and assign them to providers.

    Identifiers

    Two families of ids. Yours travel with your data and let you address it without storing ours; ours are stable handles you store to fetch things back.

    IdentifierMinted byWhere it appears
    externalUserIdYouBound to a link when the provider consents. Path segment of every user-scoped endpoint, and in every webhook.
    patientExternalIdYouSet when you upsert a patient. Unique per linked provider — the same person seen by three providers is three patients, all with the same value.
    noteExternalIdYouYour appointment id, passed on the launch URL. Optional, and not unique: repeat recordings for one appointment share it.
    sectionExternalIdYouSet on a template section when you write the template. Travels with the section through every user edit and clone, so you can route section text by it.
    partnerIdTwofoldYour organization's id (prtn_…). Your OAuth client_id, and the value of the Twofold-Client-Id header.
    twofoldUserIdTwofoldThe provider's Twofold user id.
    patientIdTwofoldThe patient's Twofold id.
    noteIdTwofoldThe canonical handle for a note — what note webhooks carry and what you fetch a note by.

    Twofold ids are opaque strings. Do not parse them or assume a length; store them as text.

    A provider links their Twofold account to your system once, from your UI, through the OAuth consent flow. The link is what makes every other call possible:

    • One active link per Twofold user. A provider cannot be linked to two of your organizations' records at once, and a Twofold user already in a Twofold group subscription cannot link at all.
    • externalUserId is bound at link time and is how you address that provider afterwards. Two active links can never share one — but if a link is revoked and the provider links again later, the new link may carry a different externalUserId. Links are the unit of identity, not users.
    • Links start at READ_ONLY. Consent never grants access; you raise a provider to FULL_ACCESS yourself, which is what consumes a seat. Meanwhile the provider still has their standard one-week Twofold trial.
    • A READ_ONLY provider cannot record once their trial has ended. A provider new to Twofold has the standard one-week trial and can work immediately; when it runs out, READ_ONLY is what stops them. Twofold then shows them a prompt pointing at the activation URL you configure in the partner console — that is where you sell or enable the subscription on your side. A provider who already pays Twofold personally is never stopped, because their own subscription still covers them.

    Revocation ends everything. It can come from three places: the provider (from their Twofold settings), you (POST /oauth/revoke), or Twofold support. In every case the link's tokens die, a link.revoked webhook fires with the reason, and you lose API access to that provider — including the notes created while they were linked. Linking again later creates a fresh link, and the data is reachable again.

    Notes

    A note is one recorded session. There is no appointment object in Twofold: noteExternalId is the only linkage back to your appointment, and because a provider may record a session more than once, several notes can share one — always treat "notes for this appointment" as a list.

    A note's body is its sections, returned in template order. Each carries the sectionExternalId from the template it was generated with (or null for a section the provider added themselves), a title, and plain text — no markdown, no HTML. Routing a note into your product means matching on sectionExternalId, never on section title, which the provider is free to rename.

    Notes move through four statuses:

    statusMeaning
    recordingThe session is being recorded.
    processingRecording finished; transcription and generation are running.
    generatedThe note is generated and readable.
    failedProcessing failed terminally.

    A note that is being regenerated goes back to processing, and its sections come back empty — Twofold does not serve the previous version's text while the new one is being written. So a note.edited event can be followed by a fetch that has no content in it yet; wait for the next note.generated_successfully, or re-fetch until status is generated, rather than treating the empty body as the note having lost its content.

    Transcripts are fetched separately from the note, and they are plain text too. A provider can delete a transcript while keeping the note — that is not an error, it is a deleted status on the transcript response. A note the provider typed rather than recorded has no transcript at all and answers no_audio, which is terminal: only not_ready is worth polling. A deleted note is gone: fetching it returns 404 with code note_deleted.

    ⚠️ Note access is not limited to the linked period. Once a provider is linked, the notes and transcripts endpoints expose that provider's entire Twofold note history — including sessions recorded before they ever connected to your system, and sessions for patients that have nothing to do with you. There is no link-window filter. The consent screen tells the provider this before they approve. Treat it as a deliberate part of the model when you decide what to import and what to show inside your product.

    Related, and equally deliberate: every note a linked provider records produces webhooks — not only the ones launched from your UI.

    The calls themselves — the note fetch, the transcript fetch and the list you reconcile from — are on the Notes guide.

    One old shape is out of scope. Twofold generates notes from templates, and every current template — the defaults every account gets, the ones a provider writes themselves, your base templates and the clones providers make of them — is served by the API. Notes made with Twofold's legacy static templates (SOAP, BIRP, DAP and friends), a pre-template-editor shape from roughly two years ago that is being retired, are not: they are absent from the notes list, and fetching one by id answers 404 with code note_not_found. In practice this can only hide a long-old note in the account of a provider who used Twofold years before linking to you.

    Patients

    Patients are pushed from your side; there is no patient sync back to you and there are no patient webhooks. A patient is created or updated by a single idempotent upsert, addressed by your patientExternalId, and uniqueness is per linked provider — you never need to know Twofold's patientId to write.

    Two rules shape everything else:

    ⚠️ 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 to release it. Send only what you intend to own for the lifetime of that patient.

    • Patients you send cannot be deleted — not by the provider in the app, and not through the API. There is no delete or archive endpoint by design.

    Providers keep creating their own patients in Twofold as usual; those are simply not yours and are not returned by the patient list endpoint.

    patientContext — free-text background that Twofold's models use while generating the note — is write-only on the upsert. It is deliberately absent from the patient object and the list, and is read back from its own endpoint, so patient payloads stay small.

    The calls themselves — the upsert, the list, the context read and the reconciliation check — are on the Patients guide.

    Templates and sections

    Templates decide what a generated note contains. You write your own on the Templates page of the partner console: a section for each part of the note, with instructions in your own words and a sectionExternalId on every section you intend to consume. Providers get them either automatically at link time (templates you mark as assigned at link time) or explicitly per provider through the API. There is no template CRUD in the server-to-server API — authoring is a console job, assignment is an API one.

    Editing a template writes a new version, which changes nothing that already exists: notes already generated keep the version they were written from, and a provider's own clone of your template is never rewritten. So the safe order is to get a template right before you assign it widely, and to iterate on staging first — templates are per-environment, and a template you write on staging does not appear in production until you write it there too.

    Writing your base templates

    Base templates are yours to write, on the Templates page of the console — in its editor, or as files (below). Per template you give:

    • a name providers will recognize,
    • the sections in order, each with the sectionExternalId you choose (they are yours: pick ids your code already routes on, e.g. charting_note, client_summary, follow_up_text) — up to 15 sections per template,
    • what each section should contain, in the words you would use to instruct a scribe, plus how long it should be and whether it reads as bullets or prose — both are choices you make, not defaults Twofold picks,
    • and whether the template is assigned at link time, meaning every provider gets it automatically the moment they link.

    Templates are per environment, so write them on staging first and exercise routing there before you write the production copies. Assigning them per provider is the one part that happens over the API, with PUT /v2/partner/users/{externalUserId}/templates. That call replaces the provider's set of your base templates with the ids you send, so it needs the whole set every time — and it will not accept an empty one. A provider with no base template cannot record, and taking their last template away is not how you stop them recording: set them to READ_ONLY, or end their link.

    🛑 Write at least one template, marked as assigned at link time, before you link a single provider. Until you do, your providers cannot record at all.

    This is the one setup step that breaks the product rather than degrading it. Linking restricts a provider's Twofold template library to your base templates and their own clones of them — it hides the templates Twofold would otherwise give them. So a provider whose organization has no base templates opens Twofold, finds an empty template library and an empty template picker, and has nothing to select and nothing to record with. It is not a fallback to some default note shape; there is no template left to fall back to.

    Nothing about it announces itself on your side: the link succeeds, the API answers normally, and the provider is simply stuck. Mark a template as assigned at link time and every provider who links gets it automatically — that is what makes this a non-issue rather than a support ticket per provider.

    While a provider is linked, their Twofold template library is restricted to your base templates and their own clones of them — and cloning is the only way they can create a template at all: building one from scratch is disabled until they unlink. Within a clone they can rename sections, reorder them, adjust instructions and add sections of their own; what they cannot do is remove a section that carries a sectionExternalId. That is the guarantee that lets you route note text by id: if you put a section in a template, it comes back in every note generated from it or from any clone of it.

    Your templates also stay inside the integration: Twofold has a public template-sharing feature that lets providers publish a template for anyone to copy, and it is disabled for your base templates and for every clone of them.

    Templates as files

    Every template on the Templates page can be downloaded as JSON, and Download all gives you the whole set as a zip. Upload takes one or more of those files back. That is how you keep templates in your own repository, review a change in a pull request, or write one with a script instead of by hand.

    Two things about upload are worth knowing before you use it:

    • An upload always creates a new template. It never updates an existing one. The file carries no template id — nothing in it points back at where it came from — so downloading a template, editing it and uploading it again leaves you with two templates of the same name, not one edited template. To change a template that already exists, edit it in the console.
    • Every uploaded template arrives assigned at link time, the same as one created in the editor. That means it goes to every provider who links from that moment on. If that is not what you want, turn it off on the template's row straight after uploading.

    The file format is published as a JSON Schema — the Copy JSON Schema button at the bottom of the Templates page puts it on your clipboard. Point a validator or a coding agent at it and you can author a template file without opening the editor at all. The shape is small:

    json
    {
      "formatVersion": 1,
      "name": "Medspa consultation",
      "sections": [
        {
          "title": "Charting note",
          "contentInstructions": "The clinical record of the visit, in the words you would use to instruct a scribe.",
          "sectionExternalId": "charting_note",
          "verbosity": "DETAILED",
          "styling": "PARAGRAPH",
          "includedInCopyAll": true
        }
      ]
    }
    json
    {
      "formatVersion": 1,
      "name": "Medspa consultation",
      "sections": [
        {
          "title": "Charting note",
          "contentInstructions": "The clinical record of the visit, in the words you would use to instruct a scribe.",
          "sectionExternalId": "charting_note",
          "verbosity": "DETAILED",
          "styling": "PARAGRAPH",
          "includedInCopyAll": true
        }
      ]
    }
    • formatVersion may be omitted; a file without it is read as version 1, so a template written by hand from this page is accepted.
    • sections is positional — the order in the array is the order in the note, and sections carry no order field. At most 15, as in the editor.
    • sectionExternalId is the routing id you set (see above). Use null, an empty string, or leave the key out for a section your product does not consume.
    • verbosity is DETAILED or CONCISE; styling is BULLET_POINTS or PARAGRAPH; includedInCopyAll decides whether the section is included when a clinician copies the whole note.

    One rule is enforced on upload but cannot be expressed in the schema: sectionExternalId must be unique among the sections that set one. A file that breaks it is rejected with the field path of the offending section, so it is fixable in an editor without guessing.