Twofold v2.7

Search pages, sections and endpoints.

    Open the console

    Getting started

    What the integration does, how the environments are separated, and your first authenticated call.

    Environment

    Twofold is an AI medical scribe for healthcare providers: a clinician records a session, and Twofold produces a structured note from it. The Partner API lets your product — an EMR, a practice-management system, a booking platform — drive that from your own interface.

    A working integration does five things:

    1. Links a provider. The clinician connects their Twofold account to their user in your system, through a standard OAuth 2.0 consent screen.
    2. Pushes patients. You keep that provider's Twofold patient list in sync with yours, keyed by your own patient ids. The first full list goes over in batches of up to 1,000.
    3. Launches recordings. You open Twofold from your UI with the right provider, patient and appointment already selected.
    4. Receives webhooks. Twofold tells you when a note starts, finishes generating, is edited or is deleted.
    5. Fetches notes and transcripts. You pull the finished note back into your product and route its sections wherever they belong.

    Everything a provider owns is reached with that provider's token. There are no cross-provider queries: if the same client is seen by three providers, that is three Twofold patients and three sets of notes, and your side aggregates them.

    Before you start

    You need three things from Twofold, all set up for you before your engineers begin:

    • A partner organization — your partnerId (prtn_…). It is your OAuth client_id and identifies you on every request.
    • Access to the partner console — granted per Twofold account, and the one thing here that needs a sign-in. Members mint API keys and configure webhooks, redirect URIs, your activation URL and the hosts a launch returnUrl may point to. These docs need no sign-in; the console does.
    • A staging environment — where the whole integration is built and validated.

    One thing you provide yourself: your note templates, written on the Templates page of the console, one set per environment. They decide what a generated note contains and carry the section ids you route on.

    🛑 Do this before you link your first provider. Linking replaces a provider's Twofold template library with yours, so if you have no base templates they have none at all — an empty template picker, and no way to record. Write one, mark it assigned at link time, and every provider who links gets it automatically. See Writing your base templates.

    Environments

    ProductionStaging
    Partner APIhttps://partner-api.trytwofold.comhttps://partner-api.staging.trytwofold.com
    Consent screenhttps://app.trytwofold.com/oauth/authorizehttps://app.staging.trytwofold.com/oauth/authorize
    Launch pagehttps://app.trytwofold.com/launchhttps://app.staging.trytwofold.com/launch

    Staging is a fully separate environment — its own database, its own Twofold accounts, its own credentials. Nothing is shared with production, so you can create as many test providers and patients as you like. API keys and user tokens are environment-tagged (twofold_key_staging_… vs twofold_key_prod_…) and are rejected by the other environment.

    Every sample in these docs is written for the environment picked in the sidebar, so hosts and credential prefixes follow your choice. Sign in as a member of your partner organization and the samples also carry your ids instead of the placeholder ones.

    ⚠️ Production access is closed until you have validated on staging. Until Twofold opens the gate for your organization, production calls fail with permission_error / partner_not_activated. Build against staging first; the switch to production is a change of host and credentials, nothing else.

    Your first request

    Mint an API key for this environment on the API keys page of the partner console — the plaintext is shown exactly once, so store it before closing the dialog. We cannot show it to you again: if it is lost, create a new key and revoke the old one. Every server-to-server call sends it as a bearer token together with your partnerId:

    bash
    curl https://partner-api.trytwofold.com/v2/partner/users \
      -H "Authorization: Bearer twofold_key_prod_xxxxxxxxxxxx" \
      -H "Twofold-Client-Id: prtn_ab12Cd34Ef56"
    bash
    curl https://partner-api.staging.trytwofold.com/v2/partner/users \
      -H "Authorization: Bearer twofold_key_staging_xxxxxxxxxxxx" \
      -H "Twofold-Client-Id: prtn_ab12Cd34Ef56"
    json
    {
      "data": [
        {
          "externalUserId": "provider-1042",
          "twofoldUserId": "user_ab12Cd34Ef56",
          "linkStatus": "active",
          "accessLevel": "READ_ONLY",
          "linkedAt": "2026-08-05T12:34:56.789Z"
        }
      ],
      "nextCursor": null
    }
    json
    {
      "data": [
        {
          "externalUserId": "provider-1042",
          "twofoldUserId": "user_ab12Cd34Ef56",
          "linkStatus": "active",
          "accessLevel": "READ_ONLY",
          "linkedAt": "2026-08-05T12:34:56.789Z"
        }
      ],
      "nextCursor": null
    }

    data is empty until your first provider links their account — that is the next step, and it is described in Authentication.

    Conventions

    These hold across the whole API; the details are on Errors and Rate limits.

    • Base path /v2. This documentation describes v2.7; what each version added is on Changelog.
    • Additive evolution. New fields and endpoints can appear at any time within /v2 and are not treated as breaking changes, so your client must tolerate unknown fields. A breaking change would ship as /v3. There is no per-account version pinning and no version header: the path is the version.
    • Lists are always paginated, as { "data": [...], "nextCursor": "…" | null }. Pass limit (default 25, max 100) and the previous page's nextCursor as cursor. Cursors are opaque — do not parse them.
    • Dates are ISO 8601 UTC with milliseconds (2026-07-19T12:34:56.789Z); dates of birth are date-only (1990-01-15).
    • Errors carry a type, a machine-readable code and a human message. The /oauth/* endpoints are the one exception — they return the standard OAuth error shape so off-the-shelf libraries can read them.
    • Every response carries Twofold-Request-Id. Quote it when you contact us. You can send your own correlation id in Twofold-Partner-Request-Id (1–64 characters of A-Za-z0-9_.:-) and it is echoed back and logged next to ours.
    • Rate limits: 100 requests/second (burst 200) per API key and 100 requests/second (burst 200) per linked provider. Batch patient upserts have their own limit of 1 request/second (burst 2) per linked provider. Over the limit you get 429 with Retry-After. See Rate limits.

    Where to go next

    • Authentication — API keys, the OAuth linking flow, and client libraries we recommend.
    • Concepts & identifiers — what a note is, and every id that crosses the boundary between your system and ours.
    • Webhooks — the events, and how to open a sealed payload.
    • Errors — the full error catalog.
    • Rate limits — the limits per credential, and what to do on a 429.
    • Launch flow — opening Twofold on the right patient from your UI.
    • Changelog — what each version of this documentation added.