Endpoint
Authentication
Pass your API key as a query parameter when opening the connection.Supported audio formats
Self-describing container formats are auto-detected from headers (noaudio_format query parameter needed). Raw / headerless formats require audio_format, sample_rate, and num_channels. For the authoritative list of accepted values, see the spec’s audio_format enum or Audio formats and preprocessing.
Opus is recommended when you control the encoder — high quality at low bandwidth.
Query parameters
Every parameter except
api_key can also be set — and overridden — in an optional configuration frame sent as the first WebSocket text frame.
For a full explanation of what each feature does and when to enable it, see STT enrichment features.
Connection flow
- Connect to the WebSocket endpoint with
api_keyand any optional feature parameters. - Optionally send a JSON configuration frame as the first text frame, before any audio. If the first frame is binary, it is treated as the first audio chunk and the query-parameter defaults apply.
- Stream raw audio as binary WebSocket frames. Frames can be any size.
- Receive
utteranceJSON messages as speech is transcribed. Ifpartial_results=true, also receivepartial_utterancepreviews for the currently active utterance. - Send an empty text frame (
"") to signal end of audio. - Receive a
donemessage containing total audio duration. - The connection closes automatically.
Configuration frame
You can optionally send a JSON configuration as the first WebSocket text frame, before any audio. When the first frame is text, it is parsed as this configuration; when the first frame is binary, it is treated as the first audio chunk and the query-parameter defaults apply — existing binary-first clients need no changes. Every field is optional, and a field present in the configuration overrides the matching query parameter.error message and closes the connection with code 1003.
Server messages
utterance
Sent each time a speech segment is transcribed.
Utterance fields
For all valid
emotion and accent values, see STT enrichment features.
partial_utterance
Sent only when partial_results=true. Delivers in-progress text for the currently active utterance as a low-latency preview. Each partial also carries the latest interim emotion, accent, and deepfake_score values for the utterance when those signals are enabled; each is null until a value is available. Each partial_utterance supersedes the previous one for the same utterance; the finalized utterance message supersedes all preceding partials.
Partial utterance fields
done
Sent after all audio has been processed, in response to the end-of-stream signal.
error
Sent if transcription fails. The connection closes after this message.
WebSocket close codes
An
error JSON message is sent before the connection closes (except on 1000).
Rate limits
- Concurrent connection limits apply per organization.
- Monthly usage limits (in audio hours) apply per organization.
- Connections that exceed limits are rejected during the WebSocket handshake with close code
4029.
Examples
- Python (aiohttp)
- JavaScript (Node.js)
WebSocket APIs cannot be tested with cURL. For command-line testing, use
websocat.Related
- Which API should I use? — when streaming is the right choice vs batch
- STT enrichment features — full reference for diarization, emotion, accent, and PII/PHI tagging
- Authentication and rate limits