done event.
Endpoint
Authentication
Pass your API key as a query parameter when opening the connection.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, WebMOGG / Opus: OGG is a container that may carry Opus-encoded audio. Pass
audio_format=ogg, not audio_format=opus.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
defaultto use the built-in default configuration, or - A JSON-encoded
BatchConfigdescribing the conversation types, participant roles, behaviors, STT options, and which aggregate outputs (topics, sentiments, summary) to produce.
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.
Connection flow
- Connect to the WebSocket endpoint with
api_key(andaudio_format,sample_rate,num_channelsfor raw formats). - Send one text frame: either the literal string
defaultor a JSON-encodedBatchConfig. - Stream audio as binary WebSocket frames. Frames can be any size.
- Receive analysis events as JSON text frames as results are produced.
- Send an empty text frame (
"") to signal end of audio. - Receive a final
doneevent with the total audio duration. - The connection closes automatically.
Server events
The server emits JSON text frames as results are produced. Every event carries atype 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.
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.
Examples
The examples below send a JSONBatchConfig as the config frame. To use the built-in defaults instead, send the literal string "default" in place of the JSON.
- Python (aiohttp)
- JavaScript (Node.js)
WebSocket APIs cannot be tested with cURL. For command-line testing, use
websocat.Related
- Velma overview — what Velma analyzes and when to use batch vs streaming
- Velma Batch — the
BatchConfigand event payload schemas in full - List behavior presets — discover behavior preset identifiers
- Authentication and rate limits