Subscribe to live call events (SSE)

View as Markdown
Real-time streaming of user speech (STT) and agent speech (TTS) events for an active call via Server-Sent Events. The connection is real-time — events stream directly from the call runtime as they are produced. The SSE connection auto-closes when the call ends (`sse_close` event). Only active calls can be subscribed to; completed calls return a 400 error. **Transcript event types:** - `user_interim_transcription` — Partial, in-progress transcription as the user speaks. Use for live preview only; will be superseded by `user_transcription`. - `user_transcription` — Final transcription for a completed user speech turn. - `tts_completed` — Fired when the agent finishes speaking a TTS segment. Includes the spoken text and optionally TTS latency. **Lifecycle events:** - `sse_init` — Sent immediately when the SSE connection is established. - `sse_close` — Sent when the call ends, right before the server closes the connection. Other event types (e.g. `tool_call_start`, `pre_call_api`, `agent_log`, metrics) are also sent on this stream. - `call_start` - `call_end` - `turn_latency` - `metrics` - `agent_node_state` - `hopping` - `knowledgebase` - `variable_extraction` - `pre_call_api` - `post_call_api` - `agent_error` - `agent_log` - `tool_call_start` - `tool_call_end` - `tool_call_error` - `call_cancelled` - `call_recording`

Authentication

AuthorizationBearer

API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

Headers

X-Organization-IdstringOptional

Required when using session-cookie auth. API-token auth may infer the organization from the token.

Query parameters

callIdstringRequired
The call ID to subscribe events for. Missing or invalid values return 400.

Response

SSE event stream established successfully
event_typeenum
The type of event
event_idstring
Unique identifier for the event
timestampdatetime
ISO 8601 timestamp of the event
call_idstring
The call ID this event belongs to
event_timedatetime

Timestamp used by sse_init and sse_close

telephony_idstring

Telephony ID for call_start

metadatamap from strings to any

Metadata for call_end, agent_error, or agent_log

turn_latencydouble

Turn latency value for turn_latency

stt_api_msdouble

STT API latency in milliseconds for turn_latency

stt_to_llm_msdouble

STT-to-LLM latency in milliseconds for turn_latency

smart_turn_msdouble

Smart-turn latency in milliseconds for turn_latency

llm_api_msdouble

LLM API latency in milliseconds for turn_latency

llm_to_tts_msdouble

LLM-to-TTS latency in milliseconds for turn_latency

tts_api_msdouble

TTS API latency in milliseconds for turn_latency

tts_to_audio_msdouble

TTS-to-audio latency in milliseconds for turn_latency

total_turn_msdouble

Total turn latency in milliseconds for turn_latency

turn_indexinteger

Turn index for turn_latency

interruptedboolean

Whether the turn was interrupted for turn_latency

smart_turn_enabledboolean

Whether smart turn was enabled for turn_latency

interim_transcription_textstring

Partial transcription text (only for user_interim_transcription)

user_transcription_textstring

Final transcription text (only for user_transcription)

tts_textstring

Text spoken by the agent (only for tts_completed)

tts_latencyinteger

TTS latency in milliseconds (only for tts_completed)

metricslist of objects

Per-turn metrics payload for metrics events. Server emits an array of {processor, model, value} entries (one per pipeline stage), not a single object. The SDK previously dropped every metrics SSE event with a pydantic ValidationError when this was typed as an object (122 events on a 40s call); typing it as an array of objects fixes the decode.

node_idstring

Node ID for agent_node_state

node_namestring

Node name for agent_node_state

node_typestring

Node type for agent_node_state

contextmap from strings to any

Context payload for agent-node and tool-call events

from_node_idstring

Source node ID for hopping

to_node_idstring

Destination node ID for hopping

knowledge_base_idstring

Knowledge base ID for knowledgebase

user_transcriptstring

User transcript for knowledgebase

responseany or null

Response payload for knowledgebase, API, or tool-call events

latencydouble

Latency for knowledgebase or variable_extraction

errorany or null
Error payload for knowledgebase, variable extraction, API, tool, or agent error events
variablesmap from strings to any

Variables extracted by variable_extraction

variable_extraction_promptstring

Prompt used for variable_extraction

methodstring

HTTP method for pre_call_api or post_call_api

headersmap from strings to any

Headers for pre_call_api or post_call_api

bodyany or null

Body for pre_call_api or post_call_api

timeoutdouble

Timeout for pre_call_api or post_call_api

extracted_variablesmap from strings to any

Extracted variables for pre_call_api or post_call_api

next_node_idstring

Next node ID for pre_call_api or post_call_api

successboolean

Success status for API and tool-call events

turn_idstring

Turn ID for tool-call events

tool_call_idstring

Tool call ID for tool-call events

function_namestring

Function name for tool-call events

latency_msdouble

Latency in milliseconds for tool_call_end

recording_urlstring

Recording URL for call_recording

statusstring

Recording status for call_recording

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error