---
title: "Stream run events (SSE)"
method: GET
path: "/v1/runs/{run_id}/events"
tags: ["runs"]
---

# Stream run events (SSE)

`GET /v1/runs/{run_id}/events`

## Request

- Base URL: `https://coasty.ai`
- URL: `https://coasty.ai/v1/runs/{run_id}/events`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/coasty/apis/coasty-public-api/docs/v1/runs/:run_id/events/get.ts> (a function with typed inputs; its response is checked against the schema)

Scope: `runs:read`. Free. An ordered at-least-once Server-Sent Events stream. Successfully persisted frames have an effectively unbounded replay window and resume with `Last-Event-ID` or `?after=<seq>`. Intermediate appends are best-effort and can be absent after a transient storage failure; terminal status/done are transactionally admitted with Agent Run terminal state. The edge may rotate a connection after 300 seconds, so reconnect with the last sequence and reconcile authoritative state with GET /v1/runs/{run_id}.

A stream can close on any of THREE terminal frames, not just `done`:
- `event: done` — the run reached a terminal state and the sentinel was delivered.
- `event: timeout` with `data: {"reason":"stream_max_duration"}` — the server hit its own stream wall-clock ceiling. The RUN may still be going. Reconnect with the last sequence; do not treat this as a run outcome.
- `event: error` with `data: {"code":..., "message":...}` — the event read failed. Reconnect with `Last-Event-ID` to replay from the cursor.

Each frame's `data:` field carries only the event's inner payload; `seq` is on the `id:` line and the event type is the event name. To read a finished run's whole trajectory as plain JSON, use GET /v1/runs/{run_id}/log instead.

## Query parameters

- `after` integer

## Headers

- `Last-Event-ID` integer

## Response `200`

SSE stream (text/event-stream).

## Other responses

- `400`: Invalid request body or parameters.
- `401`: Missing, invalid, or revoked API key. Pass `X-API-Key: sk-coasty-live-...` (or test).
- `403`: API key lacks the required scope or tier-feature is unavailable on the caller's plan.
- `404`: Resource not found in this key's namespace.
- `409`: The resource state conflicts with this operation.
- `413`: The request body exceeds the endpoint limit.
- `422`: The JSON shape is valid but one or more values violate the endpoint contract.
- `429`: Rate or concurrency limit exceeded.
- `500`: Unexpected server error. Retry with exponential backoff.
- `502`: An upstream dependency returned an invalid response.
- `503`: A required service is temporarily unavailable.
- `504`: An upstream dependency timed out.

---

[API](https://skmtc.dev/coasty/apis/coasty-public-api.md) - [All operations](https://skmtc.dev/coasty/apis/coasty-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/coasty/apis/coasty-public-api/revisions/f50d93b0d8a1?raw)
