Quick summary
When the clinician taps Stop, button in your UI, send
RU9G, close the WebSocket, call the End ambient session API, and poll status. That closes this recording only, not the patient encounter.POST request that closes this ambient session and starts note generation.
Stop is what the clinician taps. End ambient session is the API to call you need to call to end the ambient session.
The End ambient session API does not return the finished note. After it succeeds, your application must poll session status until Suki reaches a final status, then retrieve content only when status is completed.
After Stop, the microphone should leave Recording or Paused, the screen should show Generating note…, and Dictation Speak should stay disabled until a completed note is ready for review.
Stop, the End API, and the patient encounter
These three concepts must stay separate in your UI and backend:- Calling the End ambient session API closes that recording only. It does not close the patient encounter.
- If the clinician needs more audio during the same visit, create another ambient session for the same encounter.
- Do not treat the End API as a “close visit” action in your EHR. Keep the encounter open and allow another ambient session when needed.
Build the Stop flow
When the clinician taps Stop, connect that action to the full shutdown sequence below, then move the UI into Generating.1
Send the End-of-Audio Marker
After the final PCM audio chunk, send an ambient session For the WebSocket wire format, see End Ambient after streaming.
AUDIO frame with RU9G as the data:RU9G is the ambient session end-of-audio marker. Closing the WebSocket without sending RU9G does not complete the Stop flow.2
Close the WebSocket
After sending the
RU9G marker, close the ambient session WebSocket connection.3
Call the End Ambient Session API
POST End ambient session for the current
ambient_session_id. This is the API call that tells Suki the recording is finished and note generation should start.Your application already has ambient_session_id from Create an ambient clinical note. The clinician should not enter or manage this identifier.4
Show the Generating State
After the End API succeeds, move the UI from the recording state to Generating note….
- The microphone should no longer appear to be recording or paused.
- Keep note review unavailable while the note is being generated.
- Keep Dictation Speak disabled until a completed note is available.
- Poll the Ambient session status API.
Do not open an empty note editor while the session is still generating.
Handle the session status
After the clinician taps Stop and the End ambient session API succeeds, the note is not ready yet. Call Get ambient session status on a loop until Suki returns a final outcome:completed, skipped, failed, or aborted. While status is still running, keep showing Generating note… and do not open the note editor. When a final outcome arrives, update your UI using the table below.
- Only retrieve ambient content when the status is
completed. See Check note status for the status polling flow and UI handling.
Common mistakes
If Closing the WebSocket Feels Enough
If Closing the WebSocket Feels Enough
It is not. Send
RU9G, close the WebSocket, then call the End ambient session API. Closing the socket alone does not complete Stop or start note generation.If You Think the End API Closes the Visit
If You Think the End API Closes the Visit
It does not. The End API finishes the current ambient session recording only. The patient encounter can stay open. Create another ambient session later on the same visit when needed.
If You Want to Open Note Review
If You Want to Open Note Review
Wait until status is
completed. Then load the note with Get the generated clinical note.If Status Is Skipped
If Status Is Skipped
The note was not generated because the transcript was empty or the session was too short. Treat that as “no note this time,” not as a successful empty chart.Plan for about one minute of audio when you can.
Example code to end an ambient session
The following example shows the required order after the final PCM audio chunk: sendRU9G, close the WebSocket, then POST the End ambient session API.
- TypeScript
- Python
The code tabs show the End ambient session API request. Your WebSocket code must send
RU9G and close the socket before that POST request.What happens after the End API call
The End ambient session API starts note generation. It does not return the completed note. After a successful End API response:- Keep the clinician on Generating note….
- Poll the Ambient session status API.
- When the status is
completed, retrieve the generated note. - When the status is
skipped, offer the clinician the option to record again. - Keep Dictation Speak disabled until a
completednote is available.
Next steps
Check note status - Poll session status and handle Generating and terminal states. Get the generated clinical note - Retrieve the generated note after the session reachescompleted.
End ambient session API - End API reference and request details.
End ambient after streaming - WebSocket wire-format sequence for ending an Ambient stream.
Create an ambient clinical note - Create an Ambient session and obtain session identifiers.