Receive 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.
HTTP 200 OK
The JSON in each SSE
Session scheduled:
Agent reply:
Agent tool call:
Tool result:
Session idle (turn complete):
Supported event types:
A typical conversation turn streams events in the following order:
See Errors for the full error envelope.
Path parameters
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID with thesess_prefix |
Request headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer $QODER_PAT |
| Accept | Recommended | text/event-stream |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| after_id | string | No | Only receive events created after this event ID |
Example request
Example response
HTTP 200 OK
Content-Type: text/event-stream
Each event follows the standard SSE format:
SSE format examples
The JSON in each SSE data line is a completely flat structure — all fields (such as name, input, tool_use_id, content, and is_error) sit at the top level with no additional nesting. The content field is always an array in SSE output, for example [{"type": "text", "text": "..."}].
User message:
Event types
Supported event types:
| event(SSE field) | Description |
|---|---|
| user.message | User-sent message |
| session.status_running | Agent started processing |
| span.model_request_start | Model inference request started |
| 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.mcp_tool_use | Agent invoked an MCP tool |
| agent.mcp_tool_result | MCP tool execution result |
| session.status_idle | Processing complete, session back to idle |
| span.model_request_end | Model inference request ended |
| session.error | Error occurred during processing |
| terminated | Turn terminated |
Typical event lifecycle
A typical conversation turn streams events in the following order:
- user.message – user message enqueued.
- session.status_running – agent started.
- span.model_request_start – model call begins.
- agent.thinking – agent internal reasoning.
- agent.message – agent generates the reply.
- session.status_idle – turn complete, back to idle (includes usage stats).
- span.model_request_end – model call ends.
Client implementation guidance
- Use the EventSource API or an HTTP client that supports SSE.
- Listen for the session.status_idle event to detect the end of a conversation turn.
- Use the turn_id field 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 |