# Stream run events

GET /v1/sessions/{session_id}/runs/{run_id}/events: Stream or replay the run's events as server-sent events.

GET<code>/v1/sessions/&#123;session_id&#125;/runs/&#123;run_id&#125;/events</code>

Stream or replay the run's events as server-sent events. Each frame carries an SSE `id`, an `event` name, and the complete event object as JSON in `data`. Terminal event types are `run_completed`, `run_cancelled`, and `error`. To reconnect after a disconnect, send `Last-Event-ID` with the last id you processed. Replay starts strictly after `Last-Event-ID` when live or persisted history is available. Event ids order events only within one run: treat them as opaque strings, store them with the session and run ids, and deduplicate by run id plus event id. A stream can close cleanly without a terminal frame when no events are available; read the run resource for its authoritative status and reconnect only while it remains non-terminal. Ignore unknown event names and fields.

Generated from the Platform API specification on 2026-09-04.

## Path parameters

| Parameter | Type | Description |
|---|---|---|
| `session_id` | string | The session, as returned by Create a session. |
| `run_id` | string | The run, as returned by Start a run. |

## Headers

| Header | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer` plus a short-lived OAuth access token issued for the Tanomis API audience. Backends obtain tokens with an [organization automation client](/guides/run/authenticate-your-backend); the CLI's human login is not an application credential. |
| `X-Organization-ID` | yes | The `organization_id` from the workspace projection you selected in `GET /v1/me/workspaces`. |
| `X-Workspace-Tenant-ID` | yes | The nested `tenant_id` from the same projection. A header cannot widen what the token grants. Some single-workspace or self-hosted environments take `X-Tenant-ID` instead, as supplied by their administrator. |
| `Accept` | yes | Send `text/event-stream`. |
| `Last-Event-ID` | no | Send `14`. |

## Responses

| Status | Meaning |
|---|---|
| `200` | Server-sent events. |
| `404` | No such run in this session. |

## Request

```bash
curl -X GET "https://api.tanomis.com/v1/sessions/ses_7d4f9c/runs/run_a12bc3/events" \
  -H "Authorization: Bearer $TANOMIS_TOKEN" \
  -H "X-Organization-ID: $TANOMIS_ORG" \
  -H "X-Workspace-Tenant-ID: $TANOMIS_WORKSPACE" \
  -H "Accept: text/event-stream" \
  -H "Last-Event-ID: 14"
```

```python
import httpx

response = httpx.get(
    f"https://api.tanomis.com/v1/sessions/{session_id}/runs/{run_id}/events",
    headers={
        "Authorization": f"Bearer {token}",
        "X-Organization-ID": organization_id,
        "X-Workspace-Tenant-ID": tenant_id,
        "Accept": "text/event-stream",
        "Last-Event-ID": "14",
    },
)
for line in response.iter_lines():
    print(line)
```

```typescript
const response = await fetch(`https://api.tanomis.com/v1/sessions/${sessionId}/runs/${runId}/events`, {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${token}`,
    "X-Organization-ID": organizationId,
    "X-Workspace-Tenant-ID": tenantId,
    "Accept": "text/event-stream",
    "Last-Event-ID": "14",
  },
});
const reader = response.body.getReader();
// Decode server-sent events from the stream; see Stream and replay events.
```

## Response

```text title="200 OK · text/event-stream"
id: 14
event: message_delta
data: {"id":"14","type":"message_delta","session_id":"ses_7d4f9c","run_id":"run_a12bc3","created_at":"2026-09-03T09:00:00.014Z","data":{"text":"I found"}}
```
