Skip to main content
Real-time speech-to-text over WebSocket. Streams audio to the server and receives transcribed utterances as they are processed, with optional speaker diarization, emotion detection, accent detection, and PII/PHI tagging.

Endpoint

Authentication

Pass your API key as a query parameter when opening the connection.
Unlike the batch endpoints, the streaming API does not use an X-API-Key header. The key must be in the query string at connection time.
See Authentication and rate limits for how to obtain and manage API keys.

Supported audio formats

Self-describing container formats are auto-detected from headers (no audio_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

  1. Connect to the WebSocket endpoint with api_key and any optional feature parameters.
  2. 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.
  3. Stream raw audio as binary WebSocket frames. Frames can be any size.
  4. Receive utterance JSON messages as speech is transcribed. If partial_results=true, also receive partial_utterance previews for the currently active utterance.
  5. Send an empty text frame ("") to signal end of audio.
  6. Receive a done message containing total audio duration.
  7. 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.
An invalid configuration frame (malformed JSON or a value outside the configuration schema) triggers an 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.
See Authentication and rate limits for retry guidance.

Examples

WebSocket APIs cannot be tested with cURL. For command-line testing, use websocat.