> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream events

> Stream public Session events over Server-Sent Events.

`GET /api/v1/cloud/sessions/{session_id}/events/stream`

Streams public Session events as Server-Sent Events.

If the Session was created with `incremental_streaming_enabled: true`, this stream also emits incremental agent events such as `agent.message_start`, `agent.content_block_delta`, and `agent.message_stop`. There is no request parameter to turn incremental events on or off per stream connection; use the Session creation field.

## Path parameters

| Parameter    | Type   | Description                        |
| ------------ | ------ | ---------------------------------- |
| `session_id` | string | Session ID with the `sess_` prefix |

## Headers

| Header          | Required | Description                                                                                                                                                              |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Authorization` | Yes      | `Bearer $QODER_PAT`                                                                                                                                                      |
| `Accept`        | No       | Use `text/event-stream`                                                                                                                                                  |
| `Last-Event-ID` | No       | If provided, the stream resumes after the specified event ID. Returns `400` if the event ID does not exist, has been archived, or refers to a non-public internal event. |

## Example request

```bash theme={null}
curl -N -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events/stream" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Accept: text/event-stream"
```

## Stream format

Each event is emitted with standard SSE fields:

```text theme={null}
id: evt_019e392c0d787cfaa21bda98e06cd913
event: user.message
data: {"id":"evt_019e392c0d787cfaa21bda98e06cd913","type":"user.message","content":[{"type":"text","text":"Hello"}],"processed_at":"2026-05-18T03:40:48.888851795Z"}

id: evt_a1b2c3d4e5f6a7b8
event: agent.message
data: {"id":"evt_a1b2c3d4e5f6a7b8","type":"agent.message","content":[{"type":"text","text":"Hello! How can I help you today?"}],"processed_at":"2026-05-18T03:40:50.123456789Z"}

id: evt_b2c3d4e5f6a7b8c9
event: session.status_idle
data: {"id":"evt_b2c3d4e5f6a7b8c9","type":"session.status_idle","stop_reason":{"type":"end_turn"},"processed_at":"2026-05-18T03:40:50.987654321Z"}
```

The server sends `: heartbeat` comment lines periodically to keep the connection alive.

## Incremental events

Incremental events are normal SSE messages: the SSE `event:` field and the JSON `data.type` field both contain the public event type.

```text theme={null}
id: evt_019efd3b90007c9b88be2a4e6d8c52a0
event: agent.content_block_delta
data: {"id":"evt_019efd3b90007c9b88be2a4e6d8c52a0","type":"agent.content_block_delta","message_id":"msg_019efd3b8c0d7d48a970f01dd6117d11","index":0,"delta":{"type":"text_delta","text":"Hello"},"processed_at":"2026-06-25T05:23:31.123Z"}
```

Top-level incremental event types are limited to `agent.message_start`, `agent.content_block_start`, `agent.content_block_delta`, `agent.content_block_stop`, `agent.message_delta`, and `agent.message_stop`. Delta names such as `text_delta`, `thinking_delta`, and `input_json_delta` appear inside `agent.content_block_delta.delta.type`; they are not top-level event types. See [Session schemas](/cloud-agents/api/sessions/schemas#incremental-streaming-event-types).

## Errors

| HTTP | Type                    | Trigger                                                                                                                                                 |
| ---- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400  | `invalid_request_error` | `Last-Event-ID` does not identify a valid public event in this session (the event does not exist, has been archived, or is a non-public internal event) |
| 401  | `authentication_error`  | PAT invalid or expired                                                                                                                                  |
| 404  | `not_found_error`       | Session does not exist                                                                                                                                  |

### Example: 404 Session not found

```json theme={null}
{
  "error": {
    "message": "Session 'sess_doesnotexist_xxxxxxxxxxxxxxxxxxxxxxxx' was not found.",
    "type": "not_found_error"
  },
  "request_id": "b5822072-f264-48da-9d61-6d48ffb07551",
  "type": "error"
}
```

See [Errors](/cloud-agents/api/conventions/errors) for the full error envelope.

## Related

<CardGroup cols={2}>
  <Card title="Session event stream" icon="wave-pulse" href="/cloud-agents/events-stream">
    Stream agent thinking, messages, tool calls, and status over SSE.
  </Card>
</CardGroup>
