How it works
POST /v1/scribe-sessions/livereturns a WebSocket URL.- Connect to that URL and stream the audio as it is captured.
- Send
stop_recordingwhen the consultation ends. - The
scribe_session.completedwebhook tells you the record is ready. - Fetch the record from Medical Record Documents.
What the API key must carry
The key you use here needs all three of the following, or the call fails with403:
- The
scribe:writepermission, granted explicitly. A legacy key with no permissions claim works on some other endpoints but is refused here; regenerate the key to obtain one. - The
doctorrole. - A binding to an institution.
Creating a session
The request body carries the consultation context: which consultation this is, which template to fill, which patient it belongs to, and any written context you already hold.live.url as opaque and handle it as a secret. Connect to it exactly as returned, and do not build it yourself: the host, the path and the credential all change without notice.
The credential is checked only when the socket opens. A connection established before expiresAt keeps streaming past it, and a connection attempted after it is refused, so request a new session rather than reusing an expired URL.
Request fields
Choosing the template
template accepts either an id or the template JSON itself. Send exactly one of them.
Sending both, or neither, returns
400 with param set to template.
The inline form:
Identifying the patient
patient also accepts either an id or the identity inline. Send exactly one.
Retrying the same consultation
Calling the endpoint again with the sameconsultation.id while the session is still recording returns the same session with a new URL. That is the supported way to recover from a dropped connection. Do not compare the two URLs for equality, and do not cache the first one. Once the recording has stopped, the same id returns 409.
Sending audio
Connect tolive.url. The server sends a ready message when it is prepared to receive audio.
Send audio as binary WebSocket frames. Two formats are accepted:
Send roughly 100 ms of audio per frame, at the pace it is captured. A PCM payload under 1024 bytes (about 32 ms) is kept in the recording, but it is not forwarded to the live recognizer, so very small frames delay the text you see rather than losing audio.
Keeping the connection alive
Send{"type": "ping", "data": {}} whenever you want to confirm the socket is healthy; the server replies with {"type": "pong", "data": {}}. Any inbound frame, audio included, counts as activity. A session that receives nothing for 15 minutes is closed by the server, so send audio continuously, or ping during long pauses.
Messages you receive
Every message is JSON with atype and a data field.
A
correction supersedes what a transcript reported for the same segment. When you display text to a clinician, apply corrections as they arrive.
reconnect carries two reasons. server_draining means the server is restarting: reconnect and continue streaming. resume_upload means the stop arrived before all the audio did: reconnect and send the audio that is missing.
Ending the session
Send this message when the consultation ends:scribe_completed with data.status set to processing, and closes the connection.
Receiving the record
Thescribe_session.completed webhook carries consultationInternalId, the same consultation.id you sent. Fetch the record with it:
stop_recording. Generation runs partly while the audio streams, so a longer consultation does not take proportionally longer to finish.
Connection loss
Reconnecting is expected and safe.- The socket drops while recording. Call
POST /v1/scribe-sessions/liveagain with the sameconsultation.id, then connect to the URL it returns. Audio already received is kept. live.urlreachesexpiresAt. Request a new session with the sameconsultation.id. A socket already open is unaffected.- Close 1013. Retryable: the server is busy or restarting. Wait a moment and reconnect.
- Close 1003. The audio could not be decoded. The session moves to an error state, so reconnecting does not save it. Fix the encoder and start a new consultation.
- Close 1008. Terminal: the credential or the session is not valid. Do not reconnect; retrying returns the same result.
Errors
See Errors for the full response envelope.