GET /v1/sessions/{session_id}/events/stream
Receives all events in a session in real time through Server-Sent Events (SSE). After the connection is established, the server pushes the session’s complete event history and continues to stream new events as they occur.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session ID with the sess_ prefix |
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer $QODER_PAT |
Accept | Recommended | text/event-stream |
Last-Event-ID | No | Resume after this event ID. The ID must belong to the session. |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | No | Filter by event type. Supports comma-separated values and repeated parameters. |
types[] | string | No | Array-style alternative to type. Pass multiple types[]=... parameters to stream several event types. |
Example request
Example response
HTTP 200 OKContent-Type: text/event-stream
Each event follows the standard SSE format:
SSE format examples
Note: The JSON in each SSEUser message:dataline is a completely flat structure — all fields (such asname,input,evaluated_permission,content,is_error, etc.) sit at the top-level object with no additional nesting wrapper. Thecontentfield is always in array format in SSE output:[{"type": "text", "text": "..."}].
Event types
Full event type list:event (SSE field) | Description |
|---|---|
user.message | User-sent message |
session.status_running | Agent started processing |
agent.thinking | Agent thinking (internal reasoning) |
agent.message | Agent-generated reply |
agent.tool_use | Agent invoked a built-in tool |
agent.tool_result | Tool execution result |
agent.custom_tool_use | Agent requested a client-side custom tool |
user.tool_confirmation | User approved or denied a pending tool call |
user.custom_tool_result | User/client returned a custom tool result |
agent.mcp_tool_use | Agent invoked an MCP tool |
agent.mcp_tool_result | MCP tool execution result |
agent.artifact_delivered | Agent delivered a file through DeliverArtifacts |
session.status_idle | Processing complete, session back to idle |
session.error | Error occurred during processing |
session.thread_created | A new child thread was created (Managed Agents) |
session.thread_status_running | Child thread started running (Managed Agents) |
session.thread_status_idle | Child thread returned to idle (Managed Agents) |
session.thread_status_terminated | Child thread was archived or terminated (Managed Agents) |
agent.thread_message_sent | Inter-thread message sent (Managed Agents) |
agent.thread_message_received | Inter-thread message received (Managed Agents) |
agent.raw, agent.system, turn_completed, turn_cancelled, turn_failed, terminated, span.model_request_start, span.model_request_end, and pending_action.*.
Typical event lifecycle
A complete conversation turn typically streams events in this order:user.message– User message enqueuedsession.status_running– Agent startedagent.thinking– Agent internal reasoningagent.message– Agent generates replysession.status_idle– Turn complete, or paused withrequires_action
Client implementation guidance
- Use the
EventSourceAPI or an HTTP client that supports SSE - Use the standard
Last-Event-IDheader to resume after a known event ID - Listen for
session.status_idle;stop_reason.typetells whether the turn completed or paused for action - When
session.status_idle.stop_reason.typeisrequires_action, respond to the listedevent_idswithuser.tool_confirmationoruser.custom_tool_result - Use the
turn_idfield to correlate all events belonging to the same turn - The connection stays open until the client disconnects; the server continues to push new events
Errors
| HTTP | Type | Trigger |
|---|---|---|
| 401 | authentication_error | PAT invalid or expired |
| 404 | not_found_error | Session does not exist |
Related
Session event stream
Stream agent thinking, messages, tool calls, and status over SSE.