# Live WebSocket

The `url` of `POST /v2/live`. Send the audio as binary frames, or as `audio_chunk` messages; send `stop_recording` when done. The server sends the messages below, then closes the connection.

## Server messages

- `start_recording`: The session is ready: audio may be sent (`messages_config.receive_lifecycle_events`). (/api-reference/v2/live/message/start-recording.md)
- `transcript`: A partial (`receive_partial_transcripts`) or final (`receive_final_transcripts`)
transcript. (/api-reference/v2/live/message/transcript.md)
- `speech_start`: Speech started on a channel (`receive_speech_events`). (/api-reference/v2/live/message/speech-start.md)
- `speech_end`: Speech ended on a channel (`receive_speech_events`). (/api-reference/v2/live/message/speech-end.md)
- `named_entity_recognition`: The entities of a final, right after it (`receive_realtime_processing_events`). (/api-reference/v2/live/message/named-entity-recognition.md)
- `pii`: The personal data redacted in a final, right after it (with `pii`; on the WebSocket
only). (/api-reference/v2/live/message/pii.md)
- `sentiment_analysis`: The sentiment of a final, right after it (`receive_realtime_processing_events`). (/api-reference/v2/live/message/sentiment-analysis.md)
- `translation`: One final translated into one target language (`receive_realtime_processing_events`). (/api-reference/v2/live/message/translation.md)
- `end_of_turn`: The speaker finished their turn (`end_of_turn`): a voice agent may answer. (/api-reference/v2/live/message/end-of-turn.md)
- `audio_chunk`: Audio transcribed: a client may drop it from its resend buffer
(`receive_acknowledgments`). (/api-reference/v2/live/message/audio-chunk.md)
- `stop_recording`: The answer to `stop_recording` (`receive_acknowledgments`). (/api-reference/v2/live/message/stop-recording.md)
- `end_recording`: No more audio is accepted (`receive_lifecycle_events`). (/api-reference/v2/live/message/end-recording.md)
- `post_transcript`: The whole session's transcript, after `end_recording`
(`receive_post_processing_events`). (/api-reference/v2/live/message/post-transcript.md)
- `post_final_transcript`: The session's result, the same as `GET /v2/live/{id}`'s
(`receive_post_processing_events`). (/api-reference/v2/live/message/post-final-transcript.md)
- `end_session`: The last message: the server closes the WebSocket after it (`receive_lifecycle_events`). (/api-reference/v2/live/message/end-session.md)
- `error`: Something failed during the session (`receive_errors`). (/api-reference/v2/live/message/error.md)

## Close codes

- `1000`: The session ended normally.
- `1011`: The session failed; its reason says why. `rejected: …`: an option the model refused (a translation target it does not serve, translation with PII redaction…): fix the init body and create a new session.
- `1012`: The service is restarting: reconnect to the same URL to resume.
- `4401`: Invalid or expired token.