Read an agent computer job
Part of Devices, 10 operations. The overview covers keys, scopes and errors.
GET /v1/devices/{device_id}/jobs/{job_id}
The job and, once it is done or failed, its result. wait (seconds, at most 25) parks the read until the job settles. A job lost to a Superbot restart answers 410 job_lost_in_restart (retryable: true, kind): it may have run on the agent computer, so check before repeating anything that changes state, then send it again. An id nobody minted, another account's, or older than the 600 s job lifetime is 404 job_not_found.
A caller key holding devices:read (Authorization: Bearer sbc_… or x-api-key: sbc_…), or a signed-in session.
Path parameters
device_idstring requiredAn agent computer (
agt_…) on your account.job_idstring requiredThe job id the enqueue answered.
Query parameters
waitstring optionalSeconds to wait for the job to settle, 0-25.
Response 200
The job.
job_idstring requireddevice_idstring requiredkindAgentJobKind requiredThe device-shell job kinds a first-party device may run on an agent computer. One of
bash,bash_write,bash_output,bash_kill,bash_resize,read,write,glob,grep.stateAgentJobState requiredqueued_asleep: the agent computer has no open poll; the job waits for its next poll inside the 600 s TTL.expired: the TTL ran out before a result. One ofqueued,queued_asleep,claimed,done,failed,expired.created_atstring requiredexpires_atstring requiredresultAgentJobResultPresent once the state is
doneorfailed.3 fields
okboolean requiredcontentanyerrorobject2 fields
codestring requiredmessagestring required
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. |
| 410 | job_lost_in_restart | Superbot restarted after the job was queued and its outcome was not kept ( |
curl
curl -sS -X GET "https://superbot.gg/v1/devices/$DEVICE_ID/jobs/$JOB_ID" \
-H "Authorization: Bearer $SUPERBOT_API_KEY"JavaScript
const deviceId = 'DEVICE_ID';
const jobId = 'JOB_ID';
const res = await fetch(`https://superbot.gg/v1/devices/${deviceId}/jobs/${jobId}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
},
});
console.log(res.status, await res.json());Python
import os
import requests
device_id = "DEVICE_ID"
job_id = "JOB_ID"
res = requests.request(
"GET",
f"https://superbot.gg/v1/devices/{device_id}/jobs/{job_id}",
headers={
"Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
},
)
print(res.status_code, res.json())200 The job.
{
"job_id": "your-job-id",
"device_id": "your-device-id",
"kind": "bash",
"state": "queued",
"created_at": "your-created-at",
"expires_at": "your-expires-at",
"result": {
"ok": true,
"content": "your-content",
"error": {
"code": "your-code",
"message": "your-message"
}
}
}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"
}410 Superbot restarted after the job was queued and its outcome was not kept (`job_lost_in_restart`, `retryable: true`, `kind`). Send the job again once a repeat is safe.
{
"error": "job_lost_in_restart",
"message": "your-message",
"doc_url": "https://superbot.gg/developers#errors",
"request_id": "req_5f1c0a9e2b7d4c3a1e0f9b8d"
}No operation matches this filter.