Read a turn
Part of Gateway, 7 operations. The overview covers keys, scopes and errors.
GET /v1/turns/{session}
Where a turn of one of your conversations stands: running with the text so far, done with the reply (and assets, the files it made, for a caller key that draws no cards), error, cancelled. ?request= names one turn (the request_id of an async call’s 202, from either form: x-superbot-callback-url or Prefer: respond-async); without it the conversation’s newest turn. A turn the gateway admitted reads running (empty text) from the moment of its 202, before the agent has produced a frame, so a poll that starts at once never sees a gap; one an earlier process lost after admitting it reads error with reason interrupted. Turns are stored for 24 hours. Needs the turns:read scope; the read bills nothing. A missing or unknown bearer is 401, a key without the scope 403 insufficient_scope, a request id this account never admitted 404 no_turn and a deleted conversation 410 chat_deleted.
A caller key holding turns:read (Authorization: Bearer sbc_… or x-api-key: sbc_…), or a signed-in session.
Path parameters
sessionstring requiredThe conversation id (what
x-superbot-sessionnamed, or thesessionof an async call’s 202).
Query parameters
requeststring optionalA turn’s request id.
Response 200
The turn.
statestring requiredWhere the turn stands. One of
running,done,error,cancelled,parked.request_idstring requiredtextstringThe reply so far (
running) or the whole reply (done).assetsarray of TurnAssetOnly on a
doneturn, only when it made files, and only when the read is by a caller key that draws no cards (an automation step, a script): the files the reply names, one entry per file, in order.textis unchanged beside it.4 fields
namestring requiredA file name with its extension where one is known, ready to hand to a Gmail attachment or a Drive upload.
mimestring requiredThe file’s media type.
sizeinteger requiredThe size in bytes.
urlstring requiredWhere to fetch the bytes. A generated picture, sound or clip is at
/gen/; an artifact is published at an unguessable, immutable public link (/shared/or/gen/) for azapier/orn8n/caller, and answered by its signed artifact link (valid 24 hours) for any other.
Errors
| Status | Code | What to change |
|---|---|---|
| 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. |
curl
curl -sS -X GET "https://superbot.gg/v1/turns/$SESSION" \
-H "Authorization: Bearer $SUPERBOT_API_KEY"JavaScript
const session = 'SESSION';
const res = await fetch(`https://superbot.gg/v1/turns/${session}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os
import requests
session = "SESSION"
res = requests.request(
"GET",
f"https://superbot.gg/v1/turns/{session}",
headers={
"Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
},
)
print(res.status_code, res.json())200 The turn.
{
"state": "running",
"request_id": "your-request-id",
"text": "your-text",
"assets": [
{
"name": "Q3-report.pdf",
"mime": "application/pdf",
"size": 0,
"url": "https://example.com"
}
]
}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"
}No operation matches this filter.