Follow a run’s events
Part of Runs, 7 operations. The overview covers keys, scopes and errors.
GET /v1/runs/{run_id}/events
With Accept: text/event-stream, server-sent events (id is the event seq; reconnect with Last-Event-ID to resume); the stream ends once the run is final. Otherwise JSON: the events after after, long-polled up to wait seconds.
A caller key holding runs:read (Authorization: Bearer sbc_… or x-api-key: sbc_…), or a signed-in session.
Path parameters
run_idstring requiredThe run id (a Run
id).
Query parameters
afterstring optionalOnly events with a greater
seq.Last-Event-IDwins when both are sent.waitstring optionalLong-poll: hold the request up to this many seconds (max 25) for a new event. JSON replies only.
Response 200
The events.
objectstring requiredOne of
list.dataarray of RunEvent required18 fields
objectstring requiredOne of
run.event.run_idstring requiredseqinteger requiredPer-run sequence number; the SSE
id, and whatafter/Last-Event-IDresume from.typestring requiredOne of
status,result,pr,note_queued,note_delivered.created_atstring requirednote_idstringOn
note_queued/note_delivered: the note’s id (never its text).lengthintegerOn
note_queued/note_delivered: the note’s length in characters.statusstringOne of
queued,running,done,failed,needs_merge,cancelled.branchstringlanded_commitstringusd_spentnumberserved_modelstringOn
resultonly: the model that served the run, asserved_modelon the run.served_lanestringOn
resultonly: who served the run, asserved_laneon the run. One ofplatform.summarystring | nullOn
resultonly: the runner’s end-of-run diagnostic, assummaryon the run (not a title or an answer). Null under zero data retention.pr_urlstringpr_numberintegerpr_statestringpublish_errorstring
next_afterinteger requiredPass as
afteron the next poll.doneboolean requiredTrue once nothing more will happen to the run.
Errors
| Status | Code | What to change |
|---|---|---|
| 400 | invalid_request | A parameter or body field is invalid; |
| 401 | unauthorized | Send a live caller key or session as |
| 403 | insufficient_scope | The key lacks the scope in |
| 404 | not_found | No such resource on this account; check the id. |
| 429 | rate_limited | Over the per-key request bucket; retry after |
curl
curl -sS -X GET "https://superbot.gg/v1/runs/$RUN_ID/events" \
-H "Authorization: Bearer $SUPERBOT_API_KEY"JavaScript
const runId = 'RUN_ID';
const res = await fetch(`https://superbot.gg/v1/runs/${runId}/events`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os
import requests
run_id = "RUN_ID"
res = requests.request(
"GET",
f"https://superbot.gg/v1/runs/{run_id}/events",
headers={
"Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
},
)
print(res.status_code, res.json())200 The events.
{
"object": "list",
"data": [
{
"object": "run.event",
"run_id": "your-run-id",
"seq": 0,
"type": "status",
"created_at": "your-created-at",
"note_id": "your-note-id",
"length": 0,
"status": "queued",
"branch": "your-branch",
"landed_commit": "your-landed-commit",
"usd_spent": 0,
"served_model": "your-served-model",
"served_lane": "platform",
"summary": "your-summary",
"pr_url": "https://example.com",
"pr_number": 0,
"pr_state": "your-pr-state",
"publish_error": "your-publish-error"
}
],
"next_after": 0,
"done": true
}400 The request is malformed or a parameter is invalid; `param` names the field.
{
"error": "invalid_request",
"message": "A parameter or body field is invalid; param names it and issues lists every problem.",
"doc_url": "https://superbot.gg/developers#errors-invalid_request",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}401 The bearer is missing, malformed or unknown.
{
"error": "unauthorized",
"message": "Send a live caller key or session as Authorization: Bearer … or x-api-key. No key yet: create one at /account/api, or sign a user in at /auth.md.",
"doc_url": "https://superbot.gg/developers#errors-unauthorized",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}403 The key lacks a scope (insufficient_scope), is revoked, or may not call this route.
{
"error": "insufficient_scope",
"message": "The key lacks the scope in required_scopes; mint a key that holds it.",
"doc_url": "https://superbot.gg/developers#errors-insufficient_scope",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}404 No such resource on this account.
{
"error": "not_found",
"message": "No such resource on this account; check the id.",
"doc_url": "https://superbot.gg/developers#errors-not_found",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}429 Over the per-key request bucket; retry after x-ratelimit-reset.
{
"error": "rate_limited",
"message": "Over the per-key request bucket; retry after x-ratelimit-reset.",
"doc_url": "https://superbot.gg/developers#errors-rate_limited",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}No operation matches this filter.