Skip to main content
Real-time conversation analysis over WebSocket. Stream audio to the server and receive analysis events as they are produced: transcribed clips, the inferred conversation type, participant roles, behavior detections, topics, per-speaker topic sentiment, and a summary — terminating with a final done event.

Endpoint

Authentication

Pass your API key as a query parameter when opening the connection.
Unlike the batch endpoint, 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.

Connection parameters

Connection parameters carry only the API key and audio-format hints. All analysis configuration is sent in the config frame, not the query string.

Supported audio formats

Self-describing formats (auto-detected from file headers — no extra parameters needed): AAC, AIFF, FLAC, MP3, OGG, WAV, WebM
OGG / Opus: OGG is a container that may carry Opus-encoded audio. Pass audio_format=ogg, not audio_format=opus.
Raw / headerless formats (require audio_format, sample_rate, and num_channels): s8, s16le, s16be, s24le, s24be, s32le, s32be, u8, u16le, u16be, u24le, u24be, u32le, u32be, f32le, f32be, f64le, f64be, mulaw, alaw Valid sample rates: 8000, 11025, 16000, 22050, 32000, 44100, 48000, 96000

Configuration

After the connection opens, send exactly one text frame before any audio:
  • The literal string default to use the built-in default configuration, or
  • A JSON-encoded BatchConfig describing the conversation types, participant roles, behaviors, STT options, and which aggregate outputs (topics, sentiments, summary) to produce.
The BatchConfig schema is identical to the batch endpoint — see the Batch reference for the full field list. Behaviors may be referenced from the preset catalog with the preset:<identifier> syntax; list available presets with List behavior presets.
You must send the config frame before any audio. Sending a binary audio frame before the config frame is a protocol error and closes the connection with code 1003.

Connection flow

  1. Connect to the WebSocket endpoint with api_key (and audio_format, sample_rate, num_channels for raw formats).
  2. Send one text frame: either the literal string default or a JSON-encoded BatchConfig.
  3. Stream audio as binary WebSocket frames. Frames can be any size.
  4. Receive analysis events as JSON text frames as results are produced.
  5. Send an empty text frame ("") to signal end of audio.
  6. Receive a final done event with the total audio duration.
  7. The connection closes automatically.

Server events

The server emits JSON text frames as results are produced. Every event carries a type discriminator. The payload objects (clip, conversation-type pick, participant-role pick, behavior detection, topic sentiment) use the same schemas the batch endpoint returns — see the Batch reference for full field definitions. The partial_clip and clip_update payloads are streaming-only and documented below.

clip

A transcribed clip. Emitted progressively as speech is processed.
The emotion, accent, and deepfake_score fields are null unless the corresponding STT options are enabled in the config frame.

partial_clip

An in-progress clip streamed while an utterance is still being spoken, before it finalizes. Multiple partials may be emitted for the same clip_uuid as the utterance grows; the eventual clip event for that utterance reuses the same clip_uuid, so a run of partials can be correlated with its final clip.
end_ms is the current end of the in-progress utterance and grows as the utterance extends; it is null until available. The finalized clip reports duration_ms instead of end_ms. speaker_label is null until diarization resolves the speaker. emotion, accent, and deepfake_score carry the latest in-progress values, or null when no value is available yet.

clip_update

Refined values for a previously finalized clip; clip_update.clip_uuid matches the clip_uuid of an earlier clip event. A finalized clip may receive any number of clip_update events (including none), each emitted after that clip’s clip event — possibly interleaved with events for other clips — and always before the done event on clean completion. For each field present, the latest received value supersedes the value on the clip event and on any earlier clip_update for that clip.

conversation_type

The conversation-type classification for the session.
selection_source is one of inferred, auto_selected_single_option, or default.

participant_role

A role assignment for one speaker. Emitted once per identified speaker.

behavior_detection

A per-behavior detection result. Emitted once per configured behavior.

topics

The aggregated list of conversation topics. May be emitted more than once as the stream progresses; each event fully replaces the previous topics event, so always treat the latest as authoritative and never merge with earlier ones.

topic_sentiment

Per-speaker sentiment for one aggregated topic, keyed by topic and speaker. May be emitted more than once as the stream progresses; a later event supersedes an earlier one for the same topic and speaker.
sentiment_score ranges from -1.0 (most negative) to 1.0 (most positive).

summary

A free-form summary of the conversation. May be emitted more than once as the stream progresses; each event fully replaces the previous summary event, so always treat the latest as authoritative.

done

Sent after all audio has been processed, in response to the end-of-stream signal.

error

Sent if processing fails. The connection closes after this event.

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

The examples below send a JSON BatchConfig as the config frame. To use the built-in defaults instead, send the literal string "default" in place of the JSON.
WebSocket APIs cannot be tested with cURL. For command-line testing, use websocat.