HTTP API
The cere CLI and the Python SDK are clients of this API. Call it directly from any language that speaks HTTP.
Conventions
Section titled “Conventions”Base URL and token
Section titled “Base URL and token”The API of a cluster is https://agent-gateway.<cluster domain>/v1; on devnet,
https://agent-gateway.compute.dev.ddcdragon.com/v1 (see Clusters and endpoints). The
examples on this page use two shell variables:
export API=https://agent-gateway.compute.dev.ddcdragon.com/v1export CERE_TOKEN=<access token> # Developer Console > Access tokensSend the token on every request in one of these headers:
| Header | Example |
|---|---|
Authorization |
Authorization: Bearer $CERE_TOKEN |
X-Auth-Token |
X-Auth-Token: $CERE_TOKEN |
X-Api-Key |
X-Api-Key: $CERE_TOKEN |
The token names one bucket and must allow COMPUTE on it; the bucket’s owner must have balance. Routes without a
sandbox id (create, list, secrets, the egress log, usage records) act on the token’s bucket. Routes with a sandbox id
act on that sandbox, and a token for any other bucket gets 403. See Signing in for tokens.
Requests and responses
Section titled “Requests and responses”- Bodies are JSON with
snake_casefields, except file contents, which are raw bytes. - Times are RFC 3339 in UTC (
2026-11-25T12:15:32.494874Z). Durations are whole seconds (*_s) or milliseconds (*_ms). - A sandbox id is
sb-and a lowercase ULID (sb-01m89a3w4epkpghhep4s218rap). A usage record id is a UUID. A node is 64 hex characters. A bucket is an integer. - A create or exec body is at most 1 MiB, a secret body at most 64 KiB, and a file at most 16 MiB.
Error responses
Section titled “Error responses”A failure answers a non-2xx status and a JSON body with a message and a stable code:
{"code":"not_found","error":"sandbox not found"}Match on code, not on the message. Every code is in Errors.
Pagination
Section titled “Pagination”Listings take limit (default 100, at most 500; a larger value returns 500) and cursor, and answer:
{"items": [...], "next_cursor": "czoxNzk1NjA4OTI3MjYyMDI0OnNiLTAx..."}Pass next_cursor as cursor for the next page; it is null on the last page. Items are newest first.
Streams
Section titled “Streams”Streamed exec and logs answer text/event-stream. Each event has a name and one data: line of JSON:
event: stdoutdata: {"data":"one\n"}A comment line : ping arrives every 15 seconds while nothing else does. Send the token in a header, never in the
URL.
Sandboxes
Section titled “Sandboxes”Create a sandbox
Section titled “Create a sandbox”POST /v1/sandboxes starts a sandbox and answers 201 with it, status starting. Poll
Get a sandbox until status is running.
| Field | Type | Default | Rule |
|---|---|---|---|
image |
string | required | A public image from docker.io (Docker Hub), ghcr.io, quay.io or public.ecr.aws. |
command |
array of strings | ["sleep","infinity"] |
The main process. At most 256 arguments. The sandbox ends when it exits. |
runtime |
string | "gvisor" |
Only gvisor. |
workdir |
string | "/workspace" |
An absolute path. |
resources.cpu |
number | 1 |
vCPU, more than 0 and at most 4, rounded to thousandths. |
resources.memory_mib |
integer | 1024 |
128 to 8192. Above it the sandbox ends with oom_killed. |
resources.pids |
integer | 2048 |
1 to 32768. |
resources.disk_mib |
integer | 0 |
The most the sandbox writes to its filesystem; 0 means 2048, at most 10240. Past it the sandbox ends with disk_limit (N MiB). |
resources.gpu |
null | null |
Must be null. |
timeout_s |
integer | 600 |
1 to 86400. The sandbox ends with timeout (Ns) this long after it starts. |
idle_timeout_s |
integer | 0 |
0 (off) to timeout_s. The sandbox ends with idle_timeout (Ns) after this long with no exec or file call in flight. |
env |
object | {} |
Environment of the main process and every exec. At most 128 variables, names [A-Za-z_][A-Za-z0-9_]*, 64 KiB in all. Values stay on the node; the API returns only the names. Do not put secrets here: use secrets. |
egress.allow |
array of rules | [] |
The hosts the sandbox may reach, at most 64 rules. Nothing else is reachable. |
labels |
object | {} |
At most 32; keys [a-z0-9._/-]{1,63}, values at most 256 characters. Keys starting cere. are set by the CLI and SDK for agent runs. |
An egress rule:
| Field | Type | Rule |
|---|---|---|
host |
string | Required. A lowercase host name, or *. and a name of at least two labels (*.example.com). |
methods |
array of strings | Required. Uppercase methods, or "*" for any. TRACE, TRACK and CONNECT are never allowed. |
path_prefix |
string | Optional; starts with /. Matched on path segments: /repos/org/app admits /repos/org/app and /repos/org/app/..., not /repos/org/app-private. A prefix ending in / admits whatever starts with it. |
credential |
string | Optional. The name of a secret of the bucket; the egress proxy adds it to the request. The secret must be bound to host. |
curl -X POST "$API/sandboxes" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "image": "python:3.12-slim", "command": ["sh", "-c", "echo ready; exec sleep infinity"], "resources": {"cpu": 0.5, "memory_mib": 512}, "timeout_s": 300, "env": {"GREETING": "hello"}, "egress": {"allow": [{"host": "pypi.org", "methods": ["GET"]}]}, "labels": {"docs": "w5"} }'201, the sandbox object:
{ "id": "sb-01m89qnwf89c829vnpp6hv3p8f", "status": "starting", "bucket": <bucket-id>, "node": "9f97fd7fc247038ffa7944d5fa8fbd23e85c9002360a1bfcda58683faffec8cc", "runtime": "gvisor", "image": "python:3.12-slim", "command": ["sh", "-c", "echo ready; exec sleep infinity"], "workdir": "/workspace", "resources": {"cpu": 0.5, "memory_mib": 512, "pids": 2048, "disk_mib": 0, "gpu": null}, "timeout_s": 300, "idle_timeout_s": 0, "env_keys": ["GREETING"], "egress": {"allow": [{"host": "pypi.org", "methods": ["GET"]}]}, "labels": {"docs": "w5"}, "created_at": "2026-11-25T16:12:34.153581Z", "started_at": null, ...}Keep the id for the calls below:
export SB=sb-01m89qnwf89c829vnpp6hv3p8fThe bucket may have at most 20 sandboxes starting, running or unknown at once.
| Status | Code | When |
|---|---|---|
| 201 | Created, status starting. |
|
| 400 | invalid_request |
A field breaks a rule above, or the body is not JSON. The image’s registry is not allowed (the sandbox is kept with status failed). |
| 400 | unknown_credential |
A rule names a secret the bucket does not have. |
| 400 | credential_not_bound |
A rule names a secret not bound to the rule’s host. The message names the hosts to store it with. |
| 403 | forbidden |
The node refused the token, for example because it expires within 60 seconds. Sign in again. |
| 409 | limit_active_sandboxes |
The bucket already has 20 sandboxes starting, running or unknown. |
| 502 | node_unreachable, egress_failure |
The node or the egress proxy did not answer. Retry. |
| 503 | no_capacity |
No node has the CPU and memory free. Retry later or ask for less. |
A refused create says which rule it broke:
curl -X POST "$API/sandboxes" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"image": "python:3.12-slim", "resources": {"cpu": 5}}'{"code":"invalid_request","error":"resources.cpu must be in (0, 4]"}{"code":"invalid_request","error":"image registry gcr.io is not allowed on this node (allowed: docker.io, ghcr.io, quay.io, public.ecr.aws)"}The sandbox object
Section titled “The sandbox object”A running sandbox, as Get a sandbox answers it:
{ "id": "sb-01m89qnwf89c829vnpp6hv3p8f", "status": "running", "bucket": <bucket-id>, "node": "9f97fd7fc247038ffa7944d5fa8fbd23e85c9002360a1bfcda58683faffec8cc", "runtime": "gvisor", "image": "python:3.12-slim", "command": ["sh", "-c", "echo ready; exec sleep infinity"], "workdir": "/workspace", "resources": {"cpu": 0.5, "memory_mib": 512, "pids": 2048, "disk_mib": 0, "gpu": null}, "timeout_s": 300, "idle_timeout_s": 0, "env_keys": ["GREETING"], "egress": {"allow": [{"host": "pypi.org", "methods": ["GET"]}]}, "labels": {"docs": "w5"}, "created_at": "2026-11-25T16:12:34.153581Z", "started_at": "2026-11-25T16:12:34.354653Z", "ended_at": null, "startup_ms": 175, "exit_reason": null, "exit_code": null, "retained": [], "usage": { "wall_s": 0.509, "cpu_s": 0.093, "memory_peak_mib": 24.6, "memory_mib_s": 5, "ram_gib_s": 0.0049, "gpu_s": 0, "net_egress_bytes": 0, "net_ingress_bytes": 176, "disk_peak_mib": 0, "billing_basis": "reserved", "reserved_cpu_s": 0.254, "reserved_ram_gib_s": 0.2543, "billed_cpu_s": 0.254, "billed_ram_gib_s": 0.2543 }}| Field | Meaning |
|---|---|
id |
The sandbox’s id. |
status |
starting, running, terminated, failed or unknown. unknown: its node has not reported for 5 minutes; it is not final. |
bucket |
The bucket it bills. |
node |
The id of the node it runs on. |
runtime, image, command, workdir, resources, timeout_s, idle_timeout_s, labels |
As created, with the defaults filled in. |
env_keys |
The names of env, never the values. |
egress.allow |
The rules in force: as created, or as last replaced with Change egress. |
created_at, started_at, ended_at |
When it was created, started running and ended; null until then. |
startup_ms |
Milliseconds from the node accepting it to running, image pull included. |
exit_reason, exit_code |
Why it ended, and the main process’s exit code (137 when it was stopped). null while it runs. |
retained |
The files kept after it ended (see Terminate). |
usage |
What it used and what is billed. See Usage. |
exit_reason is one of:
exit_reason |
Status | Meaning |
|---|---|---|
terminated by API, terminated by API: <reason> |
terminated |
Terminated, with the reason given. |
timeout (Ns) |
terminated |
It reached timeout_s. |
idle_timeout (Ns) |
terminated |
No exec or file call for idle_timeout_s. |
exited with code N |
terminated |
The main process exited. |
oom_killed |
terminated |
It used more than memory_mib. |
disk_limit (N MiB) |
terminated |
It wrote more than its disk_mib. |
disk_limit (node disk is low) |
terminated |
The node ran short of disk and this sandbox used the most. |
token_expiry |
terminated |
The token it was created with expires in 60 seconds. A sandbox never outlives its token. |
lost: runtime restarted, lost: host restarted |
terminated |
Its node restarted. |
failed: image pull <reason> |
failed |
The image could not be pulled: image not found or access denied, image has no build for this node's platform, image is larger than 4096 MiB, image pull timed out, and others. |
failed: create <detail> |
failed |
No node started it, for example an image registry that is not allowed. |
List sandboxes
Section titled “List sandboxes”GET /v1/sandboxes lists the bucket’s sandboxes, newest first.
| Query | Meaning |
|---|---|
status |
Only this status: starting, running, terminated, failed or unknown. |
label |
key:value. Repeat it to require several labels. |
limit, cursor |
See Pagination. |
curl "$API/sandboxes?label=docs:w5&limit=1" -H "Authorization: Bearer $CERE_TOKEN"{"items":[{"id":"sb-01m89qnwf89c829vnpp6hv3p8f","status":"terminated","bucket":<bucket-id>,...}],"next_cursor":"czoxNzk1NjIzMTU0MTUzNTgxOnNiLTAxbTg5cW53Zjg5YzgyOXZucHA2aHYzcDhm"}| Status | Code | When |
|---|---|---|
| 200 | The page. | |
| 400 | invalid_request |
A bad status, a label without :, or a limit that is not a positive integer. |
Get a sandbox
Section titled “Get a sandbox”GET /v1/sandboxes/{id} answers the sandbox object. While it runs, usage is read live from
its node.
curl "$API/sandboxes/$SB" -H "Authorization: Bearer $CERE_TOKEN"{"id":"sb-01m89qnwf89c829vnpp6hv3p8f","status":"running",...,"started_at":"2026-11-25T16:12:34.354653Z",...,"usage":{"wall_s":0.509,"cpu_s":0.093,...}}The full answer is under The sandbox object.
| Status | Code | When |
|---|---|---|
| 200 | The sandbox. | |
| 403 | FORBIDDEN |
The sandbox belongs to another bucket. |
| 404 | not_found |
No such sandbox. |
Run a command
Section titled “Run a command”POST /v1/sandboxes/{id}/exec runs a command in a running sandbox, waits for it to end and answers its output.
| Field | Type | Default | Rule |
|---|---|---|---|
command |
array of strings | required | The program and its arguments; no shell unless you run one (["sh","-c","..."]). |
stdin |
string or null | null |
Written to the command’s standard input, which is then closed. |
timeout_s |
integer | 3600 |
1 to 3600. The command is stopped when it runs longer, and never outlives the sandbox. |
workdir |
string | the sandbox’s workdir |
An absolute path. |
env |
object | {} |
Added to the sandbox’s env for this command. |
curl -X POST "$API/sandboxes/$SB/exec" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["python", "-c", "import os; print(os.environ[\"GREETING\"], 6*7)"]}'{"exit_code":0,"stdout":"hello 42\n","stderr":"","duration_ms":44,"timed_out":false}With stdin, workdir and env:
curl -X POST "$API/sandboxes/$SB/exec" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["python", "-c", "import sys; print(sys.stdin.read().upper())"], "stdin": "hello from stdin"}'curl -X POST "$API/sandboxes/$SB/exec" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["sh", "-c", "pwd; echo $X"], "workdir": "/tmp", "env": {"X": "from-exec"}}'{"exit_code":0,"stdout":"HELLO FROM STDIN\n","stderr":"","duration_ms":33,"timed_out":false}{"exit_code":0,"stdout":"/tmp\nfrom-exec\n","stderr":"","duration_ms":17,"timed_out":false}A command that outlives timeout_s answers exit code 124 and "timed_out": true:
curl -X POST "$API/sandboxes/$SB/exec" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["sleep", "5"], "timeout_s": 1}'{"exit_code":124,"stdout":"","stderr":"","duration_ms":1000,"timed_out":true}Each of stdout and stderr is kept up to 16 MiB. A command that writes more ends the call with what was read so
far and exit_code -1, and keeps running in the sandbox; stream the exec for more output.
| Field | Meaning |
|---|---|
exit_code |
The command’s exit code; 124 when it timed out. |
stdout, stderr |
Its output, as text. |
duration_ms |
How long it ran. |
timed_out |
Whether it reached timeout_s. |
| Status | Code | When |
|---|---|---|
| 200 | The command ran, whatever its exit code. | |
| 400 | invalid_request |
No command, a timeout_s out of range, or a body that is not JSON. |
| 400 | invalid_argument |
A workdir that is not absolute, or an env name that is not a variable name. |
| 409 | not_running |
The sandbox is starting or has ended. |
| 429 | too_many_requests |
The sandbox already has 8 exec, file and log calls in flight, or the node its limit. Retry when one ends, or stream the exec. |
| 502 | node_unreachable, runtime_failure |
The node could not be reached or could not run it. |
{"code":"invalid_request","error":"timeout_s must be in [1, 3600]"}{"code":"too_many_requests","error":"sandbox sb-01m89qnwf89c829vnpp6hv3p8f already has 8 exec, file and log calls in flight, its maximum: retry when one ends"}Stream a command
Section titled “Stream a command”POST /v1/sandboxes/{id}/exec?stream=1 takes the same body and answers a stream of the command’s output
as it comes, then its exit:
| Event | data |
|---|---|
stdout, stderr |
{"data": "<text>"}: a chunk of output, whole lines where possible. |
exit |
{"exit_code": 0, "duration_ms": 1026, "timed_out": false}, the last event. When the command failed to run after it started, exit_code is -1 and error says why. |
curl -N -X POST "$API/sandboxes/$SB/exec?stream=1" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["sh", "-c", "echo one; echo oops >&2; sleep 1; echo two"]}'event: stdoutdata: {"data":"one\n"}
event: stderrdata: {"data":"oops\n"}
event: stdoutdata: {"data":"two\n"}
event: exitdata: {"exit_code":0,"duration_ms":1026,"timed_out":false}A streamed command that times out ends with event: exit and
data: {"exit_code":124,"duration_ms":1000,"timed_out":true}.
The statuses and codes before the stream starts are those of Run a command.
Write a file
Section titled “Write a file”PUT /v1/sandboxes/{id}/files?path=<absolute path> writes the raw request body to the path in a running sandbox,
creating its parent directories, and answers 204.
curl -X PUT "$API/sandboxes/$SB/files?path=/workspace/out/hello.txt" \ -H "Authorization: Bearer $CERE_TOKEN" \ --data-binary 'hello from a file'The answer is 204 with no body. Send a local file with --data-binary @file.
| Status | Code | When |
|---|---|---|
| 204 | Written. | |
| 400 | invalid_request |
path is not absolute. |
| 409 | not_running |
The sandbox is starting or has ended. |
| 413 | too_large, file_too_large |
The body is over 16 MiB. |
| 429 | too_many_requests |
See Run a command. |
Read a file
Section titled “Read a file”GET /v1/sandboxes/{id}/files?path=<absolute path> answers the file’s bytes as application/octet-stream. After the
sandbox ends, only the files kept with retain when it was terminated can be read.
curl "$API/sandboxes/$SB/files?path=/workspace/out/hello.txt" -H "Authorization: Bearer $CERE_TOKEN"hello from a file| Status | Code | When |
|---|---|---|
| 200 | The file. | |
| 400 | invalid_request |
path is not absolute. |
| 400 | invalid_argument |
path is a directory. |
| 404 | file_not_found |
No such file in the running sandbox. |
| 404 | not_found |
The sandbox ended more than 10 minutes ago and retained no files. |
| 410 | file_gone |
The sandbox has ended and the file was not retained, or its retention ran out. |
| 413 | file_too_large |
The file is over 16 MiB. |
{"code":"file_not_found","error":"no file /workspace/nope.txt in sandbox sb-01m89qnwf89c829vnpp6hv3p8f"}Read the logs
Section titled “Read the logs”GET /v1/sandboxes/{id}/logs answers a stream of the main process’s output: what it has written so far,
then, while the sandbox runs, more as it comes. It ends with end.
| Event | data |
|---|---|
stdout, stderr |
{"data": "<text>"} |
error |
{"message": "..."} when the logs could not be read to the end. |
end |
{}, the last event. |
curl -N "$API/sandboxes/$SB/logs" -H "Authorization: Bearer $CERE_TOKEN"While the sandbox runs, the stream stays open after the output so far:
event: stdoutdata: {"data":"ready\n"}After it ends, the stream closes with end:
event: stdoutdata: {"data":"ready\n"}
event: enddata: {}The logs are kept for 10 minutes after the sandbox ends.
| Status | Code | When |
|---|---|---|
| 200 | The stream. | |
| 404 | not_found |
The sandbox ended more than 10 minutes ago and retained no files. |
| 409 | not_running |
The sandbox is still starting. |
| 410 | logs_gone |
The sandbox ended more than 10 minutes ago and retained files. |
GET /v1/sandboxes/{id}/usage answers what the sandbox has used so far, read live from its node while it runs, and
its final usage after it ends. The same object is the sandbox’s usage.
curl "$API/sandboxes/$SB/usage" -H "Authorization: Bearer $CERE_TOKEN"{"wall_s":12.741,"cpu_s":0.278,"memory_peak_mib":24.6,"memory_mib_s":162.3,"ram_gib_s":0.1585,"gpu_s":0,"net_egress_bytes":0,"net_ingress_bytes":586,"disk_peak_mib":0,"billing_basis":"reserved","reserved_cpu_s":6.37,"reserved_ram_gib_s":6.3703,"billed_cpu_s":6.37,"billed_ram_gib_s":6.3703}| Field | Meaning |
|---|---|
wall_s |
Seconds it has been running. |
cpu_s |
Measured CPU-seconds. |
memory_peak_mib |
Highest measured memory. |
memory_mib_s, ram_gib_s |
Measured memory over time, in MiB-seconds and GiB-seconds. |
gpu_s |
Always 0. |
net_egress_bytes, net_ingress_bytes |
Bytes sent and received. |
disk_peak_mib |
Highest measured disk use. |
billing_basis |
reserved: the sandbox pays for what it reserved for as long as it runs. Empty until the node has reported. |
reserved_cpu_s, reserved_ram_gib_s |
The reservation over wall_s: resources.cpu × wall_s, and resources.memory_mib / 1024 × wall_s. |
billed_cpu_s, billed_ram_gib_s |
What is billed: the larger of reserved and measured, summed over the usage records. |
Change egress
Section titled “Change egress”PUT /v1/sandboxes/{id}/egress replaces the sandbox’s whole allow-list with the body’s allow (rules as at
create) and answers the sandbox as Get does. The change applies from the
sandbox’s next request, including requests on connections already open. {"allow": []} removes all access; a body
without allow is refused. A sandbox that is still starting can be changed too.
curl -X PUT "$API/sandboxes/$SB/egress" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"allow": [{"host": "pypi.org", "methods": ["GET"]}, {"host": "example.com", "methods": ["GET", "HEAD"]}]}'{"id":"sb-01m89qnwf89c829vnpp6hv3p8f","status":"running",...,"egress":{"allow":[{"host":"pypi.org","methods":["GET"]},{"host":"example.com","methods":["GET","HEAD"]}]},...}The next request from the sandbox to example.com goes through; a host not in the list is refused at CONNECT:
curl -X POST "$API/sandboxes/$SB/exec" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"command": ["python", "-c", "import urllib.request as u; print(u.urlopen(\"https://example.com\").status)"]}'{"exit_code":0,"stdout":"200\n","stderr":"","duration_ms":935,"timed_out":false}Each rule added or removed is logged in the egress log with decision: "policy".
| Status | Code | When |
|---|---|---|
| 200 | The sandbox with the new rules. | |
| 400 | invalid_request |
No allow, a rule that create would refuse, or a body that is not JSON. |
| 400 | unknown_credential, credential_not_bound |
As at create. |
| 404 | not_found |
No such sandbox. |
| 409 | not_running |
The sandbox has ended. |
| 502 | egress_failure |
The egress proxy did not answer. Retry. |
{"code":"invalid_request","error":"allow is required (an empty list removes all access)"}{"code":"credential_not_bound","error":"secret \"docs-api-8c2fb0\" is not bound to host \"other.example.com\"; store it again with hosts [\"api.example.com\", \"other.example.com\"]"}Terminate a sandbox
Section titled “Terminate a sandbox”DELETE /v1/sandboxes/{id} stops the sandbox and answers 200 with it, status terminated and its final usage.
Billing stops when it stops. Terminating a sandbox that has already ended answers it unchanged.
| Query | Meaning |
|---|---|
retain |
Comma-separated absolute paths to keep after it ends, readable with Read a file for 24 hours. Each file at most 16 MiB; the files are kept together or not at all, within 64 MiB per bucket on the node. retained lists what was kept. |
reason |
At most 120 characters, recorded as exit_reason terminated by API: <reason>. |
curl -X DELETE "$API/sandboxes/$SB?retain=/workspace/out/hello.txt&reason=docs%20example" \ -H "Authorization: Bearer $CERE_TOKEN"{ "id": "sb-01m89qnwf89c829vnpp6hv3p8f", "status": "terminated", ... "ended_at": "2026-11-25T16:13:52.241885Z", "startup_ms": 175, "exit_reason": "terminated by API: docs example", "exit_code": 137, "retained": ["/workspace/out/hello.txt"], "usage": { "wall_s": 77.887, "cpu_s": 1.04, "memory_peak_mib": 55.3, "memory_mib_s": 1283.1, "ram_gib_s": 1.2531, "gpu_s": 0, "net_egress_bytes": 2919, "net_ingress_bytes": 5725, "disk_peak_mib": 1.6, "billing_basis": "reserved", "reserved_cpu_s": 38.944, "reserved_ram_gib_s": 38.9436, "billed_cpu_s": 38.944, "billed_ram_gib_s": 38.9436 }}The retained file can still be read; any other path answers 410:
curl "$API/sandboxes/$SB/files?path=/workspace/out/hello.txt" -H "Authorization: Bearer $CERE_TOKEN"curl "$API/sandboxes/$SB/files?path=/etc/hostname" -H "Authorization: Bearer $CERE_TOKEN"hello from a file{"code":"file_gone","error":"sandbox sb-01m89qnwf89c829vnpp6hv3p8f has ended and /etc/hostname was not retained"}Exec, file writes and egress changes on an ended sandbox answer 409:
{"code":"not_running","error":"the sandbox is terminated"}| Status | Code | When |
|---|---|---|
| 200 | Terminated, or already ended. | |
| 400 | invalid_request |
A retain path that is not absolute, or a reason over 120 characters. |
| 404 | not_found |
No such sandbox. |
| 502 | node_unreachable |
The node did not confirm. Retry. |
Secrets
Section titled “Secrets”A secret is a header value the egress proxy adds to a sandbox’s requests to the hosts it is bound to, when a rule
names it as credential. It never enters the sandbox, and no route returns its value. See
Egress and secrets.
Store a secret
Section titled “Store a secret”PUT /v1/secrets/{name} stores the secret, or replaces its value and hosts together, and answers 204.
| Field | Type | Default | Rule |
|---|---|---|---|
name (path) |
string | required | ^[a-z0-9][a-z0-9-]{0,62}$ |
type |
string | "header" |
Only header. |
header |
string | required | The header the proxy sets, for example Authorization. Not Host, Content-Length, Transfer-Encoding, Connection, Upgrade, TE, Trailer, Keep-Alive or the Proxy-* headers. |
value |
string | required | The header’s value, one line, at most 8 KiB. |
hosts |
array of strings | [] |
The only hosts the value is sent to, at most 32: exact names, or *. and a name of at least two labels, standing for exactly one more label (*.example.com covers a.example.com, not a.b.example.com or example.com). A secret with no hosts is sent nowhere. |
curl -X PUT "$API/secrets/docs-api-8c2fb0" \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"type\": \"header\", \"header\": \"Authorization\", \"value\": \"Bearer $EXAMPLE_API_KEY\", \"hosts\": [\"api.example.com\"]}"The answer is 204 with no body. A rule may now name it for api.example.com:
{"host": "api.example.com", "methods": ["GET"], "path_prefix": "/v1/", "credential": "docs-api-8c2fb0"}| Status | Code | When |
|---|---|---|
| 204 | Stored. | |
| 400 | invalid_request |
A field breaks a rule above. |
| 413 | invalid_request |
value is over 8 KiB. |
{"code":"invalid_request","error":"header Host cannot carry a secret"}{"code":"invalid_request","error":"secret host \"*.com\": a wildcard needs at least two labels after it"}There is no route that changes a secret’s hosts without its value: store it again with both.
List secrets
Section titled “List secrets”GET /v1/secrets lists the bucket’s secrets without their values. The answer has no next_cursor.
curl "$API/secrets" -H "Authorization: Bearer $CERE_TOKEN"{"items":[ {"name":"ddc-inference","type":"header","header":"Authorization","hosts":["inference-gateway.compute.dev.ddcdragon.com"],"created_at":"2026-11-24T21:57:44.890939Z","updated_at":"2026-11-25T07:14:09.290258Z"}, {"name":"docs-api-8c2fb0","type":"header","header":"Authorization","hosts":["api.example.com"],"created_at":"2026-11-25T16:13:49.290996Z","updated_at":"2026-11-25T16:13:49.290996Z"}, {"name":"github-readonly","type":"header","header":"Authorization","hosts":["api.github.com"],"created_at":"2026-11-24T21:57:45.521431Z","updated_at":"2026-11-25T06:51:16.74463Z"}]}Delete a secret
Section titled “Delete a secret”DELETE /v1/secrets/{name} answers 204, or 404 not_found when there is no such secret. A running sandbox whose
rule names it then gets 502 from the egress proxy on that host, logged as credential missing.
curl -X DELETE "$API/secrets/docs-api-8c2fb0" -H "Authorization: Bearer $CERE_TOKEN"The answer is 204; deleting it again answers:
{"code":"not_found","error":"secret not found"}Egress log
Section titled “Egress log”Read the egress log
Section titled “Read the egress log”GET /v1/egress/log lists the egress proxy’s decisions for the bucket’s sandboxes, newest first: every request a
sandbox made outside, and every change to a sandbox’s rules.
| Query | Meaning |
|---|---|
sandbox_id |
Only this sandbox. |
since, until |
RFC 3339 times. |
decision |
allowed, denied, error or policy. |
limit, cursor |
See Pagination. |
curl "$API/egress/log?sandbox_id=$SB" -H "Authorization: Bearer $CERE_TOKEN"{"items":[ {"id":848,"ts":"2026-11-25T16:13:50.244559Z","bucket":<bucket-id>,"sandbox_id":"sb-01m89qnwf89c829vnpp6hv3p8f","node":"9f97fd7f...","host":"api.example.com","method":"GET","path":"/v1/","status":null,"decision":"policy","reason":"rule added","credential":"docs-api-8c2fb0","bytes_up":0,"bytes_down":0,"duration_ms":null}, {"id":847,...,"host":"example.com","method":"GET,HEAD","path":null,"status":null,"decision":"policy","reason":"rule removed",...}, {"id":797,...,"host":"www.python.org","method":"CONNECT","path":null,"status":403,"decision":"denied","reason":"host not in the sandbox's allow-list","credential":null,"bytes_up":0,"bytes_down":0,"duration_ms":null}, {"id":795,...,"host":"example.com","method":"GET","path":"/","status":200,"decision":"allowed","reason":null,"credential":null,"bytes_up":0,"bytes_down":577,"duration_ms":65}, {"id":790,...,"host":"example.com","method":"GET,HEAD","path":null,"status":null,"decision":"policy","reason":"rule added",...}],"next_cursor":null}| Field | Meaning |
|---|---|
id, ts |
The entry and when it was made. |
bucket, sandbox_id, node |
Whose request. |
host, method, path |
The request. path never has the query string. A refused host is logged as CONNECT with path null. |
status |
The HTTP status the sandbox got. |
decision |
allowed; denied by the rules; error (the upstream failed or a credential is missing); policy, a rule added or removed, not a request. |
reason |
Why it was denied or failed, or rule added / rule removed. |
credential |
The secret the proxy added, if any. |
bytes_up, bytes_down, duration_ms |
The request’s size and duration. |
| Status | Code | When |
|---|---|---|
| 200 | The page. | |
| 400 | invalid_request |
A bad since, until, decision, limit or cursor. |
Usage records
Section titled “Usage records”List usage records
Section titled “List usage records”GET /v1/usage/records lists the bucket’s usage records, newest first. A sandbox has one record per minute it runs,
closed at each minute boundary, and a final one when it ends; its node signs each one. See
Usage.
| Query | Meaning |
|---|---|
sandbox_id |
Only this sandbox. |
since |
RFC 3339; records whose period ended at or after it. |
dac_status |
pending, pushed or failed. |
limit, cursor |
See Pagination. |
curl "$API/usage/records?sandbox_id=$SB" -H "Authorization: Bearer $CERE_TOKEN"The sandbox above ran from 16:12:34 to 16:13:52, so it has a record for the minute up to 16:13:00 and a final one:
{"items":[ { "record_id": "05ab96ef-2123-43da-9bac-b9cc98ba300f", "sandbox_id": "sb-01m89qnwf89c829vnpp6hv3p8f", "node": "9f97fd7fc247038ffa7944d5fa8fbd23e85c9002360a1bfcda58683faffec8cc", "bucket": <bucket-id>, "period_start": "2026-11-25T16:13:00Z", "period_end": "2026-11-25T16:13:52.241885Z", "final": true, "exit_reason": "terminated by API: docs example", "cpu_s": 0.103548, "ram_gib_s": 0.863209, "memory_peak_mib": 19.6, "net_egress_bytes": 0, "net_ingress_bytes": 140, "disk_peak_mib": 1.6, "cpu_units": "2612094300000", "ram_units": "2612094250000", "billing_basis": "reserved", "wall_s": 52.241885, "reserved_cpu": 0.5, "reserved_memory_mib": 512, "reserved_cpu_s": 26.120943, "reserved_ram_gib_s": 26.120943, "billed_cpu_s": 26.120943, "billed_ram_gib_s": 26.120943, "tca_id": 29927053, "dac_status": "pushed", "dac_updated_at": "2026-11-25T16:13:52.334326Z" }, {"record_id":"...","period_start":"2026-11-25T16:12:34.354653Z","period_end":"2026-11-25T16:13:00Z","final":false,"exit_reason":null,...,"billed_cpu_s":12.822673,...}],"next_cursor":null}| Field | Meaning |
|---|---|
record_id |
The record’s UUID. |
sandbox_id, node, bucket |
Whose record, and the node that signed it. |
period_start, period_end |
The period it covers. |
final, exit_reason |
Whether it is the sandbox’s last record, and then why the sandbox ended. |
cpu_s, ram_gib_s, memory_peak_mib, net_egress_bytes, net_ingress_bytes, disk_peak_mib |
Measured in the period. |
billing_basis, wall_s, reserved_cpu, reserved_memory_mib, reserved_cpu_s, reserved_ram_gib_s |
How the billed amounts were reached: the period’s wall time, the sandbox’s reservation, and the reservation over the period. |
billed_cpu_s, billed_ram_gib_s |
Billed in the period: the larger of reserved and measured. |
cpu_units, ram_units |
The billed amounts × 1011, as decimal strings (they exceed JavaScript’s safe integers). |
tca_id |
The id of the minute the record belongs to. |
dac_status, dac_updated_at |
Whether the node has delivered the signed record for billing (pending, pushed, failed), and when that last changed. |
| Status | Code | When |
|---|---|---|
| 200 | The page. | |
| 400 | invalid_request |
A bad since, dac_status, limit or cursor. |
Errors
Section titled “Errors”| Code | Status | Meaning |
|---|---|---|
UNAUTHORIZED |
401 | No token, or a malformed, expired or badly signed one. |
FORBIDDEN |
403 | The token does not allow COMPUTE on the bucket, is for another bucket than the sandbox’s, or the bucket’s owner has insufficient balance. |
AUTH_UNAVAILABLE |
503 | The token could not be checked right now. Retry. |
invalid_request |
400, 413 | The request breaks a rule of its endpoint; the message says which. |
invalid_argument |
400 | The node refused an exec or file argument: a relative workdir, a bad env name, a directory as a file. |
unknown_credential |
400 | An egress rule names a secret the bucket does not have. |
credential_not_bound |
400 | An egress rule names a secret that is not bound to the rule’s host. |
not_found |
404 | No such sandbox or secret; or, for logs and files, a sandbox that ended more than 10 minutes ago and retained no files. |
forbidden |
403 | The node refused the token at create, for example because it expires within 60 seconds. |
not_running |
409 | The sandbox is starting or has ended, and the call needs it running. |
limit_active_sandboxes |
409 | The bucket has 20 sandboxes starting, running or unknown. |
file_not_found |
404 | No such file in the sandbox. |
file_gone |
410 | The sandbox has ended and the file was not retained, or no longer is. |
logs_gone |
410 | The sandbox ended more than 10 minutes ago (and retained files). |
too_large, file_too_large |
413 | A file over 16 MiB. |
too_many_requests |
429 | Too many exec, file and log calls in flight on the sandbox or its node. Retry. |
node_unreachable |
502, 504 | The sandbox’s node did not answer. Retry. |
runtime_failure |
502 | The node could not run the command or read or write the file. |
egress_failure |
502 | The egress proxy did not answer. Retry. |
upstream_error |
502 | A service behind the API did not answer. Retry. |
no_capacity |
503 | No node has room for the sandbox. Retry later or ask for less. |
internal |
500 | An unexpected failure. Retry. |
The upper-case codes (UNAUTHORIZED, FORBIDDEN, AUTH_UNAVAILABLE) come from the API’s check of your token,
which every route runs first. The lower-case forbidden comes from the node a new sandbox was sent to, when that
node refuses the token at create.
A request to a route or method that does not exist answers 404 or 405, and a create, exec or secret body over its
size limit answers 413, each with {"message": "..."} and no code:
{"message":"Request Entity Too Large"}