What an ambient scribe is
Building an ambient scribe starts with understanding what it has to do. An ambient scribe listens to the conversation between clinician and patient, keeps the speakers apart, pulls out the clinical facts, and drafts a note in the template the clinician already uses. The clinician then reviews, edits, and signs it, so the software writes a draft and a person owns the record.
Dictation is the useful contrast. In dictation, one speaker talks to a device and gets the text back word for word; in ambient scribing, two or more people talk to each other, and the note reads nothing like the transcript, because nobody wants the small talk about traffic in the Assessment section.
Two terms come up in every ambient build:
- Diarization is splitting audio by speaker, such as Doctor and Patient. It helps most on single-channel audio, and the streams documentation notes it isn't required for effective AI scribing.
- Facts are discrete clinical findings pulled from the conversation, such as a symptom, a medication, or a plan item. Because they come from what was said in the visit, a clinician can check them before any note exists.
That review loop is why the ambient scribe handbook in the docs says an ambient scribe isn’t speech-to-text plus a summary; it’s a clinical workflow system.
Decide these before you write code
Four questions shape every later choice, so settle them with your clinical lead first:
- Where visits happen (in person, virtual, or both) sets your audio channels and whether you need diarization.
- When facts appear decides the audio path, because live facts during the visit need a stream while end-of-visit documents can come from a recording.
- How providers review facts, edit documents, and approve the final note shapes the screen where clinicians decide whether to trust the scribe.
- Which documents you need (predefined SOAP notes, specialty templates, or user-managed templates) picks your template strategy.
The second answer drives the biggest architectural fork: how the audio reaches the API.
The decision rule for live or recorded audio
Stream when the clinician needs to see facts during the visit and the connection is reliable; upload the recording after the visit when the connection is unreliable or another system already captures the audio.
The recorded path keeps the same shape with different plumbing. You create the interaction, upload the recording, create a transcript with diarization on, and extract facts from the transcript text, which means you lose live facts but keep review and templated notes downstream.
A second rule follows from where the visit happens:
- For in-person visits, capture mono audio and turn on diarization. A stereo microphone in one room still counts as one channel, so leave multichannel off.
- For telehealth, put the local microphone on one channel and the call audio (WebRTC, for example) on another. Turn on multichannel and assign a participant role to each channel, so speakers stay separate without guessing.
Step-by-step build
The examples below use the Corti API as one concrete path, with the JavaScript SDK (a library that wraps the API calls) installed through npm install @corti/sdk. You send visit audio over a WebSocket, get transcripts and facts back while the visit runs, then ask for a document built from those facts.
The flow runs in a line: the browser asks your backend to start a visit, your backend creates the interaction and a token, the browser streams audio, the clinician reviews facts, your backend generates the document, and the signed note goes to the EHR.
1. Create the session on your server
Your backend authenticates the user, creates an interaction, and returns its websocketUrl to the browser. The interaction is the container for the visit, holding its transcripts, facts, and documents. Client credentials stay on trusted servers, so the browser gets a limited-scope token that only /streams accepts, as the security best practices for streaming tokens describe.
// Server side. `client` is an authenticated @corti/sdk client.
const { interactionId } = await client.interactions.create({
encounter: {
identifier: crypto.randomUUID(),
status: "planned",
type: "first_consultation",
period: { startedAt: new Date().toISOString() },
},
});
// Token for the browser, scoped to streams only.
const auth = new CortiAuth({ environment: "<eu-or-us>", tenantName: "<tenant>" });
const wsToken = await auth.getToken({ clientId, clientSecret, scopes: ["streams"] });If you can route WebSocket traffic through your own server, prefer a proxy.
2. Open the stream and send config
Send the configuration shown in the streams API reference within 10 seconds of connecting, or the server returns CONFIG_NOT_PROVIDED, per the WebSocket best practices in the docs. The SDK's connect() resolves once the server answers CONFIG_ACCEPTED and throws otherwise, so you can't send audio against a rejected config by accident.
const configuration = {
transcription: {
primaryLanguage: "en",
diarize: true,
isMultichannel: false,
participants: [{ channel: 0, role: "multiple" }],
},
mode: { type: "facts", outputLocale: "en" },
};
const socket = await client.stream.connect({ id: interactionId, configuration });Set mode.type to "facts" for live fact extraction or "transcription" for transcript only. With facts, mode.outputLocale is required.
3. Send audio and handle results
The same reference sets the audio limits: send raw binary with no JSON wrapping, in chunks of 250 to 500 ms and no more than 64,000 bytes each. The first chunk must contain the file headers, and sendAudio() doesn't chunk for you, so your capture code owns chunk size. You don't need to declare a sample rate, since the API transcodes common formats.
socket.sendAudio(chunk);
// Patient asks for a private moment: mute the mic, then flush.
socket.sendFlush({ type: "flush" });Transcripts arrive about every 3 seconds and facts about every 60 seconds. Segments can arrive out of order across speakers, so sort them by time.start before you render. After a flush, the server returns text for the audio sent before it, then a flushed message.
4. End the stream cleanly
Send {"type": "end"} and wait for ENDED, after which the server closes the socket. Closing abruptly can lose the final results, so treat the end message as part of the visit. Wait until processing has finished before you generate a document.
5. Let the clinician discard facts
Extraction pulls every medically relevant fact, and not every fact belongs in every document; a referral letter needs far less than a SOAP note. Discarding a fact keeps the clinician in the loop and in control of what the note draws on, as the fact review in the ambient scribe handbook explains.
await client.facts.update(interactionId, "<your-fact-id>", { isDiscarded: true });
// REST equivalent
// PATCH https://api.{env}.corti.app/v2/interactions/{id}/facts/{factId}
// { "isDiscarded": true }6. Generate the note
Request a document under the interaction with a template key, a name, an output language, and the facts or transcript as context, following the standard document generation docs. The language uses a BCP-47 tag, the standard code format, such as "en". Strip segment times and fact timestamps from the context first, so they don't bloat your input tokens.
POST https://api.{env}.corti.app/v2/interactions/<your-interaction-id>/documents
{
"context": [<context items of type "facts" or "transcript">],
"templateKey": "corti-soap",
"name": "<document-name>",
"outputLanguage": "en"
}GET /templates lists the available templates, and ?lang= filters them by language. The standard templates reference describes each one.
For the browser side, @corti/ambient-web gives you custom elements that handle microphone management, audio streaming, transcripts, and facts in any frontend framework or plain HTML. The <corti-ambient> element bundles a built-in UI, but it doesn't handle OAuth, so you still supply the token and the interactionId from step 1. Install it with npm install @corti/ambient-web and read the ambient web components overview.
Two worked examples
In-person primary care visit
Take an in-person primary care visit with a laptop microphone on the desk. Your backend creates the interaction with status "planned" and type "first_consultation", then hands the browser a streams-only token. The browser connects with mono audio, so isMultichannel is false, diarize is true, and the mode is facts in English.
Facts land in a side panel about once a minute while the visit runs. When the patient mentions a relative's back pain, the scribe picks it up as a fact, and the clinician discards it because it doesn’t belong in this note.
At the end, your app sends the end message and waits for ENDED. Your backend then requests a corti-soap document from the remaining facts, and the clinician reads the Subjective, Objective, Assessment, and Plan sections, edits a line, and signs.
Telehealth follow-up with two channels
Now take a telehealth follow-up. Before the visit starts, your backend pulls the chief complaint and the current medication list from the EHR and holds them for generation, which gives the note context the conversation might skip.
The clinician's local microphone goes on channel 0 and the patient's WebRTC audio on channel 1. You set isMultichannel to true and assign the doctor role to channel 0 and the patient role to channel 1. Diarization matters less here, since channels already keep the speakers apart.
Partway through, the patient asks to share something off the record. Your app mutes the microphone and sends a flush, and the server returns text for everything before it, then confirms with a flushed message. When the patient is ready, the clinician unmutes and the stream carries on in the same interaction.
After ENDED and the clinician's fact review, your backend generates two documents from one interaction:
- A
corti-soapnote for the chart, with the pre-loaded chief complaint and medication list in the context. - A
corti-patient-summary, written in language for readers without medical training, for the patient.
The judgment sits in the seams: what context to pre-load, where the mute control lives, and which document waits for sign-off before it leaves your system.
Template strategy
Your template choice decides how much of the note you own. There are three strategies, in rising order of effort:
- Standard templates are the fastest path and fit MVPs and pilots.
- Section assembly lets you combine standard sections, which supports specialty needs and product differentiation.
- Full customization adds section-level overrides while keeping clinical guardrails, which suits enterprise products that need EHR-aligned formatting.
Start standard, then move up only when clinicians tell you a section is wrong for their specialty.
Connect the EHR on both ends
The EHR holds context the conversation may never mention, and it's also where the signed note has to end up. Before generation, pull the chief complaint, appointment reason, patient demographics, medication lists, and past medical history, then inject them as context.
After sign-off, push structured sections and the final narrative note into the EHR, practice management software, billing systems, and quality tracking tools. Billing is a natural next build, and the guide on adding medical coding to your ambient scribe picks up from here.
Build an ambient scribe on Corti
The job is to draft a note from the visit, ready for the clinician to review and sign. On Corti, the Ambient Scribe capability does that job: it listens to the visit and drafts the note for review. Your team adapts the connectors, templates, and review screen, validates the capability on your own data before production, and the clinician reviews and signs every note.
Under it sit the two primitives this guide used. Speech-to-Text, through /streams, produces the transcript behind an ambient note and extracts facts live with FactsR™, our real-time reasoning system for clinical consultations. Text Generation turns those facts into the documents clinicians sign, such as a SOAP note or a patient summary.
Grounding is the question to ask of any scribe. FactsR reached 94% groundedness, above clinician-written reference notes, and cut missed findings from 23.3% to 11.7% on the Primock57 benchmark (as of November 2026, per corti.ai/benchmarks). Read the text-generation benchmark.
Corti offers HIPAA support (HIPAA is the US health privacy law) and is GDPR compliant (GDPR is the EU data protection regulation), as the Symphony infrastructure overview sets out. You can check the current scope in the Corti Trust Center.
From our docs, one piece of advice we'd put at the top of your plan: design the review screen for action, showing what you want the clinician to act on instead of everything the model produced.
Go deeper with ambient scribe workflow examples for primary care, nursing, and psychiatry, the guide to choosing between /transcribe, /streams, and /transcripts, and the ambient scribe handbook in the docs.
FAQ
What does ambient AI scribing mean?
Ambient AI scribing is software that listens to a clinical conversation, separates the speakers, extracts the clinical facts, and drafts a note in the clinician's template. The clinician reviews, edits, and signs the draft, so they stay responsible for the record.
How much does it cost to build an AI medical scribe?
On Corti, usage is billed in credits: Speech-to-Text costs $0.0065 per minute for real-time and batch, and Text Generation costs $4.00 input and $16.00 output per MTok (million tokens). You get free credits to start, with no credit card required. Your total depends on visit length and note size, so check current rates on the Corti pricing page.
Is an ambient scribe API HIPAA compliant?
That depends on the vendor and how you deploy it, so review each ambient clinical documentation API’s terms. Corti offers HIPAA support and is GDPR compliant, as the Symphony infrastructure overview sets out, and you can verify the current scope in the Corti Trust Center. Confirm business associate agreement (BAA) terms directly with any vendor before you send patient data.
Should I build or buy an ambient scribe?
Build when the scribe is part of your own product, and you need control over audio capture, the review screen, templates, and the EHR connection. Buy when you need documentation working for clinicians without owning that stack. Either way, adapt the scribe and validate it on your own data before clinicians rely on it.






