API reference · Sandboxes
A run’s output as a server-sent event stream, from its start until it ends
GET
/v1/sandboxes/{sandbox_id}/runs/{run_id}/eventsAPI keysandbox:readProject
- TypeScript
client.sandboxes.streamRun()- Python
client.sandboxes.stream_run()- CLI
hayonix sandboxes runs follow
Events: run (the run record, first and last), started (started_at), output (stream stdout|stderr, text) as it is produced, and finally end. Live output stays replayable for an hour after the run ends; after that the recorded output is sent instead.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the sandbox:read permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS -N "$API_BASE_URL/sandboxes/sbx_01jc5zq4m8k3v6x9t2w7r0b1e4/runs/sbr_01jc5zq4m8k3v6x9t2w7r0b1e4/events" \
-H "Authorization: Bearer $API_KEY"Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Path parameters
sandbox_idstringrequiredID of the sandbox
ID with prefix sbx_
run_idstringrequiredID of the run
ID with prefix sbr_
Response
200 a server-sent event stream (text/event-stream) — An SSE stream
Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |