Skip to main content
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.
When the clinician taps Stop in your UI, your backend finishes the recording and tells Suki to generate the note. That backend work includes calling the End ambient session API: a 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 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.
For the WebSocket wire format, see End Ambient after streaming.
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.
Finish any pending Add information during a visit PATCH requests before you send RU9G and call the End ambient session API. Context updates sent after that API call do not shape note generation for that session.

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.
If the status is skipped, the note was not generated because the transcript was empty or the session was too short. Treat this as “no note this time,” not as a successfully generated empty chart. Plan for about one minute of audio when you can.

Common mistakes

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.
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.
Wait until status is completed. Then load the note with Get the generated clinical note.
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: send RU9G, close the WebSocket, then POST the End ambient session API.
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:
  1. Keep the clinician on Generating note….
  2. Poll the Ambient session status API.
  3. When the status is completed, retrieve the generated note.
  4. When the status is skipped, offer the clinician the option to record again.
  5. Keep Dictation Speak disabled until a completed note is available.
See Check note status and Get the generated clinical note.

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 reaches completed. 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.
Last modified on August 20, 2026