Sandbox API
Every sandbox route: create, list, pause, resume, fork, delete, and SSH access on the control plane; run commands, read a background command's output as it grows, and move files on the edge; with the fields, states, and error codes.
On this page22
What a sandbox is, and how its lifecycle works, is on Sandboxes. The routes for boxes and the workspace are on API reference.
Two hosts, one key
| What | Control plane | Edge |
|---|---|---|
| Base URL | https:/ | The sandbox's toolboxBase |
| Routes | /sandboxes, /sandbox-templates | /process/execute, /process/start, /process, /process/{processId}, /, /, /files/upload, /files/download |
| Errors | {"error": "code"}, sometimes with reason, field, or message | {"error": "code"}, sometimes with detail or message |
Read toolboxBase from the sandbox object rather than building it; it is the same for the sandbox's whole life.
export PRIZED_API_KEY=dcp_…
API=https://api.prized.dev/api/v1
AUTH="Authorization: Bearer $PRIZED_API_KEY"Each call below passes the header as -H @<(echo "$AUTH"), through a pipe, so the key stays off curl's command line (API reference).
Authentication
Send Authorization: Bearer dcp_… on every request, with an API key from https://prized.dev/dashboard/workspace/api-keys (API keys), or the one an agent gets at agent sign-in. Expiry, revocation, and rotation work as on the rest of the API (Authentication).
| Key | Reaches |
|---|---|
| Full access | Every route below |
| Read only, or Custom with Sandboxes: Read | GET routes: templates, the list, one sandbox |
| Custom, Sandboxes: Write, or an agent sign-in key | Every route below, the edge included |
| Limited to some boxes | None: 403 key_access_denied |
A key acts as the member who made it: an owner's or member's key sees every sandbox in the workspace, and a contractor's gets 404 not_found on every sandbox route. On the free credit alone, a workspace works within the free tier's limits.
Conventions
| Topic | Rule |
|---|---|
| JSON | Send Content-Type: application/json on the control plane. A field the route does not know is 422 unknown_field with field, never ignored. |
| Ids | Sandboxes are sbx_…, forks frk_…. An unknown, malformed, deleted, or foreign id is 404 not_found. |
| 202 means in progress | Pause, resume, fork, and delete answer 202 with the sandbox as written; its state then moves on its own. Poll GET /sandboxes/{id}, or have the API wait for you (Waiting). |
| Idempotency | POST /sandboxes and POST /sandboxes/{id}/fork take an Idempotency-Key header (1 to 128 printable characters): a retry with the same key and body answers 200 with the first result, and makes nothing. It does so even where a new create or fork would now be refused (creating or forking paused, a quota, the balance, a hold, no capacity), so a create whose answer was lost can still be found and deleted. The same key with another body is 409 idempotency_conflict. |
| Units | memoryMb is MiB, diskGb is GiB, timers are whole minutes, timestamps are RFC 3339 UTC. |
| Stability | Fields are added without notice; ignore the ones you do not know. |
Templates
| Route | Answer |
|---|---|
GET / | 200 {templates: [...]}, each {id, build, resources: {defaults, min, max}, durability, defaultMaxRuntimeMin} |
{
"templates": [
{
"id": "prized-base-v1",
"build": "prized-base-v1-r2",
"resources": {
"defaults": {"vcpu": 4, "memoryMb": 8192, "diskGb": 10},
"min": {"vcpu": 1, "memoryMb": 1024, "diskGb": 10},
"max": {"vcpu": 32, "memoryMb": 131072, "diskGb": 128}
},
"durability": "ephemeral",
"defaultMaxRuntimeMin": 1440
}
]
}id is the name a create passes, and defaultMaxRuntimeMin the run time a create in your workspace gets when it names none. build is the image a new sandbox of that name starts from today; it changes when the name is republished with a fix (Sandboxes: Templates), and resources are that build's. What each template holds is on the same page.
Create
POST /api/v1/sandboxes answers 201 {sandbox} with state: "starting", or already running; read it until running. With ?wait=running the answer comes once it is running instead (Waiting). A running sandbox takes commands at once. A create that waits for room may stay starting longer than the hold: its held create answers 201 still starting, and you read it until running.
curl -s -X POST "$API/sandboxes?wait=running" -H @<(echo "$AUTH") -H "Content-Type: application/json" -H "Idempotency-Key: pr-1874-1" -d @<(jq -n '{template: "prized-agent-v1", resources: {vcpu: 2, memoryMb: 4096}, envVars: {ANTHROPIC_API_KEY: env.ANTHROPIC_API_KEY}, labels: {run: "pr-1874"}, autoPauseMin: 10, autoDeleteMin: 60, maxRuntimeMin: 60}')jq reads ANTHROPIC_API_KEY from your environment (export it first; unset, it is null and the create answers 400), so that key stays off the command line too. The Idempotency-Key is yours to choose, one per sandbox: resend the create with the same key and body, and you get the first sandbox back instead of a second (Conventions).
| Field | Default | Rule |
|---|---|---|
template | Required | A template id from GET /sandbox-templates |
resources | The template's defaults (capped at 2 vCPU and 4 GB on the free tier) | {vcpu, memoryMb, diskGb}, any of them, each within the template's min and max (and the free tier's caps); never more than 32 vCPU, 131,072 MiB, and 128 GiB |
envVars | None | Up to 32 names (shell identifiers of up to 64 characters), each value up to 16 KiB; set for every command, stored encrypted, never returned (Environment variables) |
labels | None | Up to 32 string pairs (keys up to 64 characters, values up to 256), yours to filter on |
autoPauseMin | Off | Pause after this many idle minutes; 0 is off, up to 40,320 |
autoDeleteMin | Off | Delete after this many minutes paused; 0 is off, up to 40,320 |
maxRuntimeMin | 1,440 (24 hours); 60 on the free tier | Its run time: delete it after this many minutes of running, with the clock restarting on every resume; up to 10,080 (7 days), no maximum on a custom plan. On the free tier, at most 60 minutes of running in all (Run time) |
The sandbox object
{
"sandbox": {
"id": "sbx_3f9c0a1b2d4e5f60",
"state": "running",
"template": "prized-agent-v1",
"templateBuild": "prized-agent-v1-r2",
"resources": {"vcpu": 2, "memoryMb": 4096, "diskGb": 10},
"durability": "ephemeral",
"labels": {"run": "pr-1874"},
"autoPauseMin": 10,
"autoDeleteMin": 60,
"expiresAt": "2026-10-14T19:02:11Z",
"maxRuntimeMin": 1440,
"errorReason": null,
"toolboxBase": "https://…/v1/sandbox/sbx_3f9c0a1b2d4e5f60",
"previewUrlTemplate": "https://{port}-sbx-3f9c0a1b2d4e5f60.p.prized.dev/",
"createdAt": "2026-10-14T17:02:11Z",
"lastActiveAt": "2026-10-14T17:05:40Z"
}
}| Field | Meaning |
|---|---|
state | starting, running, pausing, paused, resizing, deleting, deleted, or error (States) |
template | The template name it was created from |
templateBuild | The build of that template it runs, which it keeps for life: a later republish of the name changes new sandboxes only |
durability | Always ephemeral |
expiresAt | When its run time ends and it is deleted; null while the clock is stopped, from a few seconds after it reaches paused until it resumes |
maxRuntimeMin | The run time it was created with: on a paid plan each resume restarts the clock with it, up to the workspace's maximum then; on the free tier a resume carries on the time left instead. null on a sandbox created before 2026-10-23 until its next resume |
errorReason | A short failure explanation, with recovery guidance when known; otherwise null. It remains while a failed sandbox or fork copy is being deleted. |
autoPauseMin, autoDeleteMin | null when off |
toolboxBase | The edge address for this sandbox's commands and files |
previewUrlTemplate | The URL a port of the sandbox answers at, with {port} for the port (Ports at a URL) |
lastActiveAt | The last activity autoPauseMin counts from |
memoryDiscardedAt | Present only on a sandbox moved to a new machine without its paused memory: when that happened. Its files were kept and its processes were not, so the next resume starts it fresh, as a create does, and until that resume a fork answers 409 parent_not_forkable |
Read
| Route | Answer |
|---|---|
GET /api/v1/sandboxes | 200 {sandboxes: [...]}: every sandbox not deleted, newest first. ?label=key=value lists only those carrying that label (Labels). ?ended=1 adds ended while the workspace is on the free tier: up to 10 sandboxes it deleted at its 60-minute run limit in the last 7 days, newest first, each {id, endedAt, reason: "free_tier_run_limit", limitMin, message}, where message says what lifts the limit and links Billing, and endedTotal, how many there were in all; both keys are left out when there are none |
GET /api/v1/sandboxes/{id} | 200 {sandbox}, or 404 not_found once it is deleted |
Lifecycle
| Route | Body | Answer |
|---|---|---|
POST / | 202 {sandbox}, state: "pausing"; with ?wait=paused, 200 once it is paused. A deleting sandbox answers 410 sandbox_deleted | |
POST / | 202 {sandbox}, state: "starting"; with ?wait=running, 200 once it is running. Checks the balance and the quota like a create. A deleting sandbox answers 410 sandbox_deleted | |
POST / | 204: counts as activity for autoPauseMin | |
POST / | {count, labels?, maxRuntimeMin?} | 202 {fork, sandboxes, warning?}, below |
POST / | {resources} | 409 resize_rejected: resizing is not available yet (Sandboxes: Resize) |
POST / | {byMin} | 200 {sandbox, capped}, below |
POST / | {inMin} or {expiresAt} | 200 {sandbox, capped}, below |
DELETE /api/v1/sandboxes/{id} | 202 {sandbox}, state: "deleting"; again on a deleting sandbox is a no-op. A command still running on it answers 410 sandbox_deleted (The edge) | |
DELETE / | 202 {count, ids, more}: deletes the sandboxes carrying the label (Labels) |
Labels
Label sandboxes at create (or fork) and you can list and delete them together: label=key=value selects the sandboxes carrying that label, and repeating it selects those carrying all of them. The key ends at the first =, so a value may hold more, and a key that holds one cannot be selected. Let curl encode the selector, as a raw +, &, or # in a URL changes it:
curl -s -G "$API/sandboxes" --data-urlencode "label=run=pr-1874" -H @<(echo "$AUTH")curl -s -G -X DELETE "$API/sandboxes" --data-urlencode "label=run=pr-1874" -H @<(echo "$AUTH")- A delete by label needs at least one label (
400 label_requiredotherwise) and takes no other parameter (400 bad_requestnaming it), so it never deletes more than you asked for. - Each sandbox is deleted as
DELETE /sandboxes/{id}deletes it, and still counts toward your quota until it is gone: list with the same label until the answer is empty. - Up to 250 a request.
idslists the sandboxes it leftdeleting, ones that already were included, andcounthow many;more: truemeans matches are left, so send it again. Nothing matching answers{count: 0, ids: [], more: false}. - Each request selects the current matches. After a lost answer or a
500, some sandboxes may already be deleting. List the matches before deleting again: another delete can include sandboxes created since the first request.
Waiting
Create, resume and fork take ?wait=running, and pause ?wait=paused: the API holds the answer until the sandbox gets there (for a fork, every child), so there is nothing to poll.
curl -s -X POST "$API/sandboxes/sbx_3f9c0a1b2d4e5f60/resume?wait=running" -H @<(echo "$AUTH")| Query | Rule |
|---|---|
wait | running on create, resume and fork, paused on pause; anything else is 400 bad_request with field: "wait" |
waitTimeoutMs | How long to hold, a whole number of milliseconds from 0 to 8000; default 8000. The answer can come up to half a second after it, while the API takes its last look at the sandbox. Anything else, or waitTimeoutMs without wait, is 400 bad_request with field: "waitTimeoutMs" |
- It got there. Resume and pause answer
200, create201, with the sandbox in its new state. A fork answers as it does withoutwait, with every childrunning. - It did not get there in time. The answer is the one without
wait(202, or201for a create), with the sandbox as it is by then, stillstartingorpausing: read it until it settles, as withoutwait. A create that boots from scratch can outlast the hold. - It failed. The hold ends at once, with the sandbox in
erroror on its way there; the status is the one withoutwait. - It went another way. The hold also ends at once when the sandbox stops heading for that state: deleted (
deleting, or gone, which answers as the request was accepted), or asked the other way by a later pause or resume (pausingorstarting, or stillrunningorpausedif it had not moved yet). The status is the one withoutwait. - A pause sent while the sandbox is still starting, even the moment its create or fork answers, lets the boot finish and then pauses it: it shows
pausingfrom the moment it is sent, and answers200once it ispaused(or as withoutwaitat the bound). - A change that reverses one in flight waits for the box, not the request: resume a sandbox that is still pausing and it shows
startinguntil the pause has landed and it runs again; pause one still resuming and it showspausinguntil it is paused.200comes only once it is really there.
Fork
count is 1 to 256; labels replaces the parent's on every child; maxRuntimeMin sets each child's lifetime in minutes (on a paid workspace, default the parent's, up to your workspace's maximum; on the free tier it can only shorten the parent's deletion time). The answer lists the children, each starting with its own expiresAt; poll each until running, or send the fork with ?wait=running to have the answer come once they run (Waiting). A fork is all or nothing: if a child cannot start, Prized deletes every child, running ones too. Each shows deleting, with an errorReason saying why, until it is gone (404).
{
"fork": {
"id": "frk_9a1c44e0b7d2f318",
"parentId": "sbx_3f9c0a1b2d4e5f60",
"count": 2,
"status": "active",
"sandboxIds": ["sbx_51d0c2aa9e8b7f64", "sbx_c8e4f1b20a3d9e75"],
"createdAt": "2026-10-14T17:06:02Z"
},
"sandboxes": [{"id": "sbx_51d0c2aa9e8b7f64", "state": "starting", "…": "…"}]
}On the free tier, children keep the parent's deletion time. When that is under 10 minutes away, the answer adds a warning:
{
"warning": {
"code": "short_lifetime",
"expiresAt": "2026-10-14T17:13:00Z",
"minutesLeft": 6,
"message": "These copies are deleted in 6 minutes: on the free tier a fork keeps its parent's expiry. Top up to give each fork its own lifetime."
}
}What a child inherits, its lifetime, and the limits are on Sandboxes: Fork.
Resize
Resizing a sandbox is not available yet: the route answers 409 resize_rejected and changes nothing (Sandboxes: Resize).
Run time
A running sandbox's expiresAt can move at any time; a resume restarts the clock on its own (Sandboxes: Run time).
curl -s -X POST "$API/sandboxes/sbx_3f9c0a1b2d4e5f60/extend" -H @<(echo "$AUTH") -H "Content-Type: application/json" -H "Idempotency-Key: extend-pr-1874-1" -d '{"byMin":120}' | jq '{expiresAt: .sandbox.expiresAt, capped}'| Route | Rule |
|---|---|
extend | byMin, a whole number of minutes, is added to expiresAt (or to now, if that has just passed). It never shortens; past 7 days from now it stops there and answers "capped": true. Send an Idempotency-Key and a retry adds the time once |
timeout | Exactly one of inMin (minutes from now) or expiresAt (an ISO 8601 time in the future) sets expiresAt, earlier or later. Past 7 days from now it answers 429 sandbox_quota_exceeded, reason max_runtime, with limit in minutes and maxExpiresAt, the latest it allows |
- Running or starting sandboxes. A paused one answers
409 sandbox_not_running: its clock is stopped, and a resume gives it a fresh run time. - The free tier never moves the end later: an extend answers
"capped": trueunchanged, and a timeout may only bring it earlier ("tier": "free"on a refusal). A custom plan has no maximum.
SSH access
A password for any SSH client to one sandbox: shells and commands as prized, and local forwards (ssh -L) to the sandbox's own ports (Sandboxes: SSH access). A key needs Full access or Sandboxes: Write.
curl -s -X POST "$API/sandboxes/sbx_3f9c0a1b2d4e5f60/ssh-access" -H @<(echo "$AUTH") -H "Content-Type: application/json" -d '{"expiresInMinutes":30}'
# {"sandboxId":"sbx_3f9c0a1b2d4e5f60","host":"ssh.prized.dev","port":22,"user":"sbx_3f9c0a1b2d4e5f60","password":"…","expiresAt":"2026-11-02T22:30:00.000Z","command":"ssh sbx_3f9c0a1b2d4e5f60@ssh.prized.dev"}| Route | Body | Answer |
|---|---|---|
POST / | {expiresInMinutes?}, or no body | 201 {sandboxId, host, port, user, password, expiresAt, command}. expiresInMinutes is 1 to 1,440, 60 if left out; the password is shown once, and works for any number of connections until expiresAt, when they end too. A paused sandbox gets one as well, but is not resumed by a connection: resume it first |
DELETE / | 200 {revoked}: how many passwords of this sandbox stopped working; connections made with them close shortly after |
Connect with user and password at host and port, from OpenSSH (ssh -p PORT USER@HOST, typing the password, or giving it through SSH_ASKPASS) or a library such as ssh2 or Paramiko. Forward to localhost, 127.0.0.1 or ::1; any other destination, a remote forward, and agent or X11 forwarding are refused.
The edge
Routes below are relative to the sandbox's toolboxBase, with the same bearer. They run on a running sandbox, and wake one that is not:
- Paused or pausing: the request resumes it, as
POST /resumewould, then waits forrunningand runs. The resume is billed and counted as activity like any other, and a refused one answers with the resume's own error (409 insufficient_balance,409 paid_balance_required,402 template_needs_payment,429 sandbox_quota_exceeded, …), with nothing run. - Starting or resuming: the request waits for
running, then runs. - The wait is up to 10 seconds, counted from when the edge, having checked the key and looked the sandbox up, finds it not running. Requests with the same key that arrive during a wait share it, deadline included, so a later one waits only what is left of it. Past the deadline the answer is
503 sandbox_not_readywithRetry-After: 1; nothing ran, so retry. - A waiting request counts toward the sandbox's edge limits as a running one does: past 8 at once, up to 16 more wait their turn and the rest answer
429 rate_limited. - Resizing: a request answers
409 sandbox_not_runningat once and wakes nothing. Read the sandbox until it leavesresizing, then retry. Prized-Auto-Resume: falseon a request turns waking off for it: a sandbox that is notrunninganswers409 sandbox_not_running, and nothing wakes. On arunningsandbox the header changes nothing: the request runs and counts as activity, so it still holds off automatic pause. To watch a sandbox without keeping it up, readGET /api/v1/sandboxes/{id}, which is not activity.
Once it runs:
- It takes commands at once. When a create or resume answers
running, or a read shows it, send the real command; no warm-up command is needed. - Deleting ends what runs. A request still in flight when its sandbox is deleted (by
DELETE, its run time, or automatic delete) ends within about 2 seconds: one waiting for its answer, such as a running command, answers410 sandbox_deleted, and a download already under way stops short. A command that was running is stopped with the sandbox. A request sent to a sandbox that isdeletinganswers410 sandbox_deletedat once, and nothing runs. - Pausing does not. A command running when its sandbox pauses is paused with it, and its answer comes once the sandbox resumes. Delete the sandbox instead to end it.
Run a command
| Route | Body | Answer |
|---|---|---|
POST /process/execute | {command, cwd?, env?, timeout?} | 200 {stdout, stderr, exitCode, durationMs, timedOut?} |
curl -s -X POST "$TOOLBOX/process/execute" -H @<(echo "$AUTH") -H "Content-Type: application/json" -d '{"command":"npm test","cwd":"/home/prized/work/app","env":{"CI":"1"},"timeout":600}'
# {"stdout":"…","stderr":"","exitCode":0,"durationMs":8124}- How it runs.
bash -cas the userprized, incwd(absolute;/home/prized/workby default), with the create'senvVarsand then this request'senvon top. - The answer is the verdict. A command that fails still answers
200; readexitCode. timeoutis in seconds, 300 by default and 3,600 at most. At the limit the command and everything it started in its process group are killed:exitCode: -1, timedOut: true. A process that left the group (setsid) runs on until it exits or the sandbox is deleted.- From Node, keep it under 300. Node's
fetchstops waiting for an answer after 300 seconds, the defaulttimeoutitself, so a command that runs to the default limit fails just as its answer comes. Pass atimeoutwell under that, such as 240, or start a longer job as a background process and read its output as it runs. - Output. Each stream keeps its first 4 MiB; the rest is dropped. For more, write to a file and download it.
- One run per request. An exec whose answer was lost is never retried for you, since it may already have run; retry it yourself only if the command is safe to run twice.
- To stop a command, use a background process. Closing an exec's connection (an abort, or a client timeout) does not always stop the command; it can run on until its
timeout. Start a command you may need to stop as a background process and kill it, and keeptimeoutshort on an exec. - Keep
/home/prized/work. If a command removes it, every exec that names nocwdanswers400 spawn_failed. Recreate it by runningmkdir -p /home/prized/workwithcwdset to/home/prized.
Background processes
Start a command that outlives the request, then read its output as it grows. An exec holds the request until the command ends (3,600 seconds and 4 MiB of each stream at most); a start answers at once, the process runs until it exits or its timeout (up to 7 days) or the sandbox ends, and its whole output stays readable. A read answers with what has been printed so far and does not wait for more, so you poll it from the offsets each answer returns.
| Route | Body or query | Answer |
|---|---|---|
POST /process/start | {command, cwd?, env?, timeout?} | 201 {process} |
GET / | stdoutOffset?, stderrOffset?, limit?, encoding? | 200 the output from those offsets, and the offsets to read from next |
GET /process/{processId} | tail? | 200 {process}, with the end of each log |
GET /process | 200 {processes}, newest first | |
POST / | 200 {processId, wasRunning, signal} |
Start it. The answer is 201 at once with the process id; the exit code comes later.
curl -s -X POST "$TOOLBOX/process/start" -H @<(echo "$AUTH") -H "Content-Type: application/json" -d '{"command":"for i in 1 2 3 4 5; do echo tick $i; sleep 1; done","timeout":600}'
# {"process":{"processId":"p_f4d800ca16e6","pid":840,"running":true,"lost":false,"exitCode":null,"timedOut":false,"timeout":600,"startedAt":"2026-10-30T21:42:34Z","cwd":"/home/prized/work"}}Follow it. Read from offset 0, then from the nextStdoutOffset and nextStderrOffset of each answer, until done is true. The loop stops on any answer that is not a read, and waits a second only when a read came back empty.
P=p_f4d800ca16e6 SO=0 SE=0
while true; do
R=$(curl -s "$TOOLBOX/process/$P/logs?stdoutOffset=$SO&stderrOffset=$SE" -H @<(echo "$AUTH"))
jq -e 'has("done")' >/dev/null <<<"$R" || { echo "$R" >&2; break; }
jq -j .stdout <<<"$R"
jq -j .stderr <<<"$R" >&2
SO=$(jq .nextStdoutOffset <<<"$R") SE=$(jq .nextStderrOffset <<<"$R")
[ "$(jq .done <<<"$R")" = true ] && break
[ "$(jq '(.stdout + .stderr) | length' <<<"$R")" = 0 ] && sleep 1
done
jq '{exitCode, signal, timedOut}' <<<"$R"Stop it early. The answer comes once the process has ended.
curl -s -X POST "$TOOLBOX/process/p_f4d800ca16e6/kill" -H @<(echo "$AUTH")
# {"processId":"p_f4d800ca16e6","signal":"TERM","wasRunning":true}A read 1.5 seconds after that start, while the command is still running:
{
"processId": "p_f4d800ca16e6",
"running": true,
"lost": false,
"exitCode": null,
"timedOut": false,
"encoding": "utf-8",
"stdout": "tick 1\ntick 2\n",
"stderr": "",
"stdoutOffset": 0,
"stderrOffset": 0,
"nextStdoutOffset": 14,
"nextStderrOffset": 0,
"stdoutSize": 14,
"stderrSize": 0,
"done": false
}| Parameter | On | Rule |
|---|---|---|
command, cwd, env | start | As an exec: bash -c as the user prized, in cwd (absolute; /home/prized/work by default), with the create's envVars and then env on top. A field the route does not know is 400 bad_json, with the field in message |
timeout | start | Seconds, 1 to 604,800 (7 days); none by default. At the limit the process group gets TERM, and KILL 5 seconds later if it is still there: timedOut: true, and exitCode 143 (137 after KILL) |
stdoutOffset, stderrOffset | logs | Byte offsets into each stream, from 0 (the default). A read past the end answers 200 with empty output |
limit | logs | Most bytes returned per stream per read: 262,144 by default, 1 to 1,048,576 (at least 4 with utf-8). Larger output takes several reads |
encoding | logs | utf-8 (the default) or base64. utf-8 does not end a chunk inside a character while more may follow, so a chunk can be a little short, or empty mid-character, and the next offset is that character's first byte; bytes that are not valid UTF-8 come back as U+FFFD. Use base64 for exact bytes; offsets count bytes either way |
tail | status | Bytes of each log to return as text: 16,384 by default, up to 1,048,576 |
doneistrueonce the process has ended and both next offsets are at the end of their logs. If the process has ended anddoneisfalse, there is more to read: read again at once.stdoutSizeandstderrSizeare how much each log holds so far.- Re-attach. The whole log stays on the sandbox's disk until the sandbox is deleted, so a chatty process counts against
diskGb. After a dropped connection, or from another machine, read again from the last offsets you handled: no gap, no repeat. - A lost start answer. Every answer to a start that got as far as the sandbox, a
502or504included, carries aPrized-Process-Idheader; an answer without it means nothing ran. Read that id withGET /process/{processId}before you start again:404 process_not_foundmeans it never started, anything else means do not start a second copy. - The process (
GET /process/{processId}) hasprocessId(p_and 12 hex characters),pid(its process group),running,exitCode(nullwhile it runs),signal(named from a128+nexit code,TERMfor 143),timedOut,lost,timeout,startedAt,finishedAt,cwd,stdoutandstderr(the tails), andstdoutTruncatedandstderrTruncatedsaying a log is longer than its tail.lostistruewhen it is not running and left no exit code, as after a resize. - The list holds every process started in this sandbox, ended ones included, each with
processId,pid,running,lost,exitCode,signal,startedAt, andcommand(its first 200 bytes). - Kill sends
TERMto the process group, waits up to 5 seconds, then sendsKILL;signalis the last one sent, andexitCodeis 143 or 137 unless the command handled it. On a process that has ended it answers200withwasRunning: falseand an emptysignal. A child that started its own session (setsid), or is still running after the command exits, is neither tracked bydonenor stopped by a kill. - Pause. A running process does not keep the sandbox from automatic pause: with
autoPauseMinset, the sandbox pauses after that many idle minutes, the process is frozen with it, and it carries on at the next resume. Requests here count as activity, so a client that keeps reading keeps the sandbox up; for a job nobody is watching, create the sandbox withautoPauseMinoff. - Same edge rules. A well-formed request here wakes a paused sandbox, counts as activity and toward the edge limits, and ends with
410 sandbox_deletedif the sandbox is deleted meanwhile, as an exec does. An id that is not a process of this sandbox is404 process_not_found.
Files
| Route | Body or query | Answer |
|---|---|---|
POST /files/upload | query path; the raw file as the body | 200 {path, size} |
GET /files/download | query path | The file as application/octet-stream with Content-Length |
curl -s -X POST "$TOOLBOX/files/upload?path=/home/prized/work/app.py" -H @<(echo "$AUTH") --data-binary @app.py
curl -s "$TOOLBOX/files/download?path=/home/prized/work/out.json" -H @<(echo "$AUTH") -o out.jsonPaths are absolute and inside /home/prized; symlinks are followed only while they stay inside that directory. An upload creates missing directories and replaces the file whole, never half-written. Downloads are regular files only; list or archive a directory with a command (tar czf /home/prized/out.tgz work) and download that. Each transfer is up to 100 MiB and 10 minutes.
Edge limits
48 concurrent requests and 60 a second (bursts of 120) per key, and 8 concurrent and 20 a second (bursts of 40) per sandbox; a request waiting for its sandbox to wake is one of them. Past 8 at once at a sandbox, up to 16 more requests wait their turn, for 10 seconds at most; past that, or any other limit, the answer is 429 rate_limited with Retry-After. An address that keeps sending keys that do not work (unknown, revoked or expired) gets the same answer until its Retry-After; requests with a working key never count toward that. The request document of an exec or a process start is at most 1 MiB.
Send an exec or process-start document within 60 seconds. An upload that stops sending data for 60 seconds ends with 408 request_timeout; a response closes if the client stops reading it for 60 seconds. These limits apply while sending the request or receiving its answer; a command can still run for its requested timeout.
Ports at a URL
Every port of a sandbox but 22 and 81 answers at https://<port>-<sandbox id>.p.prized.dev/, the sandbox's previewUrlTemplate with {port} filled in, and at the same host under prized.link (browserUrl), the address to open in a browser (Preview a port). Nothing needs creating first. A request gets in with one of three:
- The API key, with Sandboxes: Write, in
Prized-Key(or asAuthorization: Bearer). A request to a paused sandbox resumes it and waits up to 10 seconds, as on the edge;Prized-Auto-Resume: falseturns that off. - A token in the URL's
prized_tokenquery parameter, fromPOST …/ports/{port}/token. - Nothing, on a port made public with
PUT …/ports/{port}.
The key and the token never reach your app. A redirect your app sends to another host comes back as Prized-Location, not Location, so no client follows it with the key. A token or a public port never wakes a paused sandbox. On p.prized.dev they answer programs, fetch and WebSockets but no page in a browser tab; on prized.link they open in a browser too, the token moving from the URL into a cookie for that host, and a tab's first visit shows a notice that the page is hosted by a Prized user.
| Route | Body | Answer |
|---|---|---|
GET / | 200 {preview: {sandboxId, port, url, browserUrl, public, publicExpiresAt}}. url is for programs with the key, browserUrl for a browser | |
POST / | {expiresIn?}: seconds, 60 to 86,400, 3,600 by default; or no body | 201 {sandboxId, port, url, browserUrl, token, expiresAt}. url and browserUrl carry the token; open browserUrl in a browser. Made with an API key only, and never outlives it |
PUT / | {public: true, expiresIn?}: seconds, 300 to 2,592,000, 7 days by default; or {public: false} | 200 {preview}. A port already public keeps its expiry: make it private, then public again, to change it |
TOKEN_URL=$(curl -s -X POST "$API/sandboxes/$ID/ports/3000/token" -H @<(echo "$AUTH") -H 'Content-Type: application/json' -d '{"expiresIn": 600}' | jq -r .url)
curl -s "$TOKEN_URL"A token ends at its expiresAt, when the key that made it is revoked or expires, when the port is made public or private again, or when the sandbox is deleted. A token, and making a port public, need a workspace that has paid in; a token needs an owner's or member's key, and public the owner's (Preview a port). Refusals of those two routes:
| HTTP | error | Meaning |
|---|---|---|
| 400 | bad_request, port_reserved | A port that is not 1 to 65,535, port 22 or 81, or an expiresIn out of range |
| 422 | unknown_field | A field the route does not take, as on every route |
| 402 | share_links_need_payment | The workspace has only free credit |
| 403 | api_key_required | A token asked for with a dashboard session instead of an API key |
| 403 | not_allowed | Making a port public with a key or session that is not the owner's |
| 403 | policy_denied | A token under the anyoneLinksOwnerOnly policy, asked for by a member |
| 403 | share_links_blocked, workspace_held | Ports that open without the key are turned off for this workspace, or it is on hold; message says why |
| 409 | share_link_limit | The workspace already has 10 public ports |
| 429 | rate_limited | Too many tokens, or public changes, in a minute; retry after Retry-After |
| 503 | preview_unavailable | Port URLs are not available right now |
Answers the URL itself writes:
| HTTP | error | Meaning |
|---|---|---|
| 401 | unauthorized, token_expired | No key or token, or one that is not accepted (expired, revoked, or another port's) |
| 403 | key_access_denied | The key lacks Sandboxes: Write, or is limited to some boxes |
| 403 | workspace_held | The workspace is on hold; message says why |
| 403 | ingress_browser_page | A page opened in a browser tab, a frame or an embed on p.prized.dev without the API key; browserUrl is the prized.link URL to open instead |
| 404 | not_found | No such sandbox for this key |
| 404 | ingress_port_reserved | Port 22 or 81 |
| 409, 429 | The resume's codes (insufficient_balance, sandbox_quota_exceeded, …) | A request with the key needed to resume the sandbox, and the resume was refused |
| 429 | rate_limited | Past the limits; retry after Retry-After |
| 429 | ingress_tunnel_limit | The workspace already has 24 ports with a request in flight; retry after Retry-After |
| 502 | ingress_nothing_listening | Nothing in the sandbox listens on that port |
| 503 | sandbox_not_ready | The sandbox did not reach running within 10 seconds of a request with the key; retry after Retry-After |
| 503 | sandbox_not_running | The sandbox is paused or starting, and the request came with a token, on a public port, or with Prized-Auto-Resume: false; with state and Retry-After |
| 502, 503 | sandbox_unreachable, control_plane_unavailable, edge_busy | Nothing reached the sandbox this time; retry |
Errors
The control plane:
| HTTP | error | Meaning |
|---|---|---|
| 400 | bad_request | The body is not a JSON object, or a field has the wrong type or is out of range; for envVars, with field and a message stating the rules; for a wait or waitTimeoutMs the route cannot take, with field naming it (Waiting); for a label that is not key=value within the label limits, with field: "label" (Labels) |
| 400 | invalid_idempotency_key | Not 1 to 128 printable characters |
| 400 | label_required | A delete by label with no label (Labels) |
| 401 | unauthorized | No key, or a revoked one; also carries signUp, how a coding agent can sign its person up (Agent sign-in) |
| 401 | token_expired | The key has expired, with expiresAt |
| 402 | template_needs_payment | The template runs on paid workspaces only, and this workspace has only free credit, on a create or fork, or a resume of one made while it paid: add a plan or a top-up; message, billing and billingUrl link the Billing page |
| 403 | key_access_denied | The key lacks Sandboxes: Read or Write, or is limited to some boxes; message names what it needs |
| 403 | workspace_held | The key's workspace is on hold (Not allowed), on every route; message says why. The key works again once the hold is lifted |
| 404 | not_found | No such sandbox in this workspace, a contractor's key, or a create, fork, or resize while sandboxes are switched off for this workspace (email ) |
| 404 | template_not_found | template is missing or names no template |
| 409 | paid_balance_required | Free-tier access is switched off for your workspace, and it has only free credit, on a create, resume, or fork: add a plan or a top-up; message and billing link the Billing page |
| 409 | insufficient_balance | The balance is empty; message and billing say a top-up or a plan adds credit, and link the Billing page |
| 409 | workspace_held | The workspace is on hold (Not allowed), on a create, resume, fork, or a run-time increase; message says why. The hold paused its running sandboxes; pausing and deleting still work from the dashboard. Email for a review |
| 409 | workspace_closing | The workspace is being closed, on a create, resume, fork, or a run-time increase; the owner can reopen it (Close or erase the workspace) |
| 409 | template_inactive | The template is retired; pick another |
| 409 | idempotency_conflict | The key was used for another request |
| 409 | durability_incompatible | durability: "persistent"; every sandbox is ephemeral |
| 409 | parent_not_running | Fork of a sandbox that is neither running nor paused (for example starting or pausing), with its state |
| 409 | parent_not_forkable | This sandbox cannot be forked. With reason resized_while_paused, it was resized while paused and has no memory to copy: resume it, then fork it. With reason memory_discarded, it moved to a new machine without its paused memory (see memoryDiscardedAt): resume it, then fork it. With reason parent_too_big, its machine cannot hold even one copy beside it: field names what does not fit (vcpu, memoryMb, or diskGb) and message says so; fork a smaller sandbox |
| 409 | fork_capacity | The parent's machine has room for only fits more copies, with a message saying what to do: fork that many or fewer (when fits is above 0), try again later, or start a new sandbox and fork that, keeping the parent until it runs. The new sandbox and each copy count toward your quota: at the limit, delete sandboxes you no longer need and wait until each answers 404 (a deleting sandbox still counts), or top up on the free tier; never delete a parent while a copy forked from it is still starting |
| 409 | fork_unsupported_host | This sandbox's machine cannot fork; create a fresh sandbox and fork that. With reason host_retiring, the machine is being replaced and starts no new sandboxes, and message says so: a smaller count does not help, but a paused sandbox is usually moved to a current machine on its own and forks again from there, so retry later (pause it first if it runs) |
| 409 | sandbox_not_running | An extend or timeout on a paused sandbox; resume it first |
| 409 | sandbox_ssh_unavailable | SSH access for a sandbox created before shells became available, or whose template has no user to log in as; create a new sandbox |
| 409 | resize_rejected | With reason resize_unavailable and a message: resizing a sandbox is not available yet; create a new sandbox with the shape you need (Sandboxes: Resize) |
| 410 | sandbox_deleted | A pause or resume of a sandbox that is deleting, or in error after losing the machine it ran on: a delete cannot be undone, so create a new sandbox. Once it is gone, it is 404 |
| 422 | unknown_field | A field the route does not take, named in field, with the route's fields in accepted, the one it most likely meant in hint when there is one (on a create, timeout is maxRuntimeMin and memoryMB is resources.memoryMb), and a message saying both |
| 422 | invalid_resources | A key resources does not take (it takes vcpu, memoryMb and diskGb), with hint, accepted and message as for unknown_field; a shape outside the template's bounds, or over the free tier's 2 vCPU and 4 GB (then with "tier": "free", limit in vCPU or MB, a message naming what lifts it, and billing), named in field; field host_capacity means that shape cannot run right now |
| 422 | invalid_max_runtime | maxRuntimeMin (on a create or fork) is not a positive whole number |
| 422 | invalid_timeout | An extend's byMin, or a timeout's inMin or expiresAt, is not a positive whole number or a future time, named in field; a timeout with neither or both of them names fields: ["expiresAt", "inMin"] |
| 422 | invalid_count | A fork count outside 1 to max (256) |
| 422 | invalid_labels | Fork labels that are not up to 32 string pairs |
| 429 | sandbox_quota_exceeded | A quota, or a free-tier limit (then with "tier": "free", limit in the reason's unit, a message naming what lifts it with the Billing link, and billing: Billing hints), would be passed, named in reason: sandbox_limit, paused_limit, running_vcpu, running_memory, retained_disk, or max_runtime (a timeout's adds maxExpiresAt); on a resume, extend, or later timeout, customer_disabled means sandboxes are switched off for this workspace (email ). A fork adds admitted, how many children would have fit |
| 429 | too_many_ssh_access | The sandbox already has 100 unexpired SSH access passwords; revoke them or wait for some to expire |
| 503 | sandbox_capacity | No sandbox capacity is free right now. Nothing was created or billed; retry after Retry-After (also retryAfterSec in the body) |
| 503 | sandboxes_disabled, sandbox_create_disabled, sandbox_fork_disabled | Sandboxes, or creating or forking them, are paused for maintenance; retry later |
The edge:
| HTTP | error | Meaning |
|---|---|---|
| 400 | bad_json, missing_command, cwd_not_absolute, bad_timeout, bad_env | The exec or process-start document is not the documented shape (a start's bad_timeout states its 1 to 604,800 second range); detail or message says more where it can |
| 400 | bad_cwd, bad_command, bad_offset, bad_limit, bad_encoding, bad_tail | A process cwd or command the sandbox cannot carry (a newline or NUL byte in cwd; a command over 256 KiB or with a NUL byte), or an offset, limit, encoding, or tail outside its range; message states the range (Background processes) |
| 400 | spawn_failed | The command could not start (a cwd that does not exist); detail has the system's words |
| 400 | missing_path, path_not_absolute, symlink_not_allowed, not_regular_file | The path is missing, relative, through a symlink that leaves /home/prized or loops, or not a regular file |
| 401 | unauthorized, token_expired | As on the control plane |
| 403 | key_access_denied | The key lacks Sandboxes: Write |
| 403 | workspace_held | As on the control plane |
| 403 | path_outside_root, permission_denied | The path is outside /home/prized, or prized cannot touch it |
| 404 | not_found | No such sandbox for this key, or no such file |
| 404 | process_not_found | No process with that id in this sandbox (Background processes) |
| 408 | request_timeout | The request document did not arrive within 60 seconds, or an upload stopped sending data for 60 seconds. Send a complete request on a new connection |
| 409 | sandbox_not_running | The sandbox is not running and the request cannot wake it: it is resizing (retry once it leaves resizing) or failed, or the request sent Prized-Auto-Resume: false |
| 410 | sandbox_deleted | The sandbox is deleted or being deleted, before or while the request ran (The edge); a command that was running is stopped with it. Do not retry: create a new sandbox |
| 402, 409, 429 | The resume's codes (insufficient_balance, paid_balance_required, template_needs_payment, sandbox_quota_exceeded, …) | The request needed to resume a paused sandbox, and the resume was refused; nothing ran |
| 413 | body_too_large, file_too_large | Over 1 MiB for an exec or process-start document, or 100 MiB for a file. The same request fails again, so split or shrink it rather than retry; the edge's body_too_large says the limit in message. A request whose Content-Length is over the limit is refused before the key is checked: it wakes no paused sandbox and is not activity |
| 429 | rate_limited | Over the edge limits; Retry-After says when |
| 502 | sandbox_unreachable | The sandbox did not answer. An exec or a process start may or may not have run |
| 502 | process_start_failed, process_unreadable | A start or a process read did not complete: a start may or may not have run (its processId and Prized-Process-Id name it; read it before starting again); a read can be sent again, and so can a kill (it answers wasRunning: false if the first one landed) |
| 502 | resolve_failed, sandbox_credentials_unavailable | The edge could not look the sandbox up; retry |
| 503 | sandbox_not_ready | The sandbox did not reach running within the edge's 10-second wait (The edge); nothing ran. Retry after Retry-After |
| 504 | process_op_timed_out | A process request did not finish in time; read the process before you retry a start |
| 500 | control_plane_unavailable | The edge could not reach the control plane to check the key |
Not yet
| Not yet | Instead |
|---|---|
| Output pushed to you (SSE, WebSocket), or a terminal | The SDKs stream a command's output; without one, start a background process and read its output by offset. For a terminal, prized sandbox ssh or SSH access |
| Listing, moving, or deleting files through the edge | ls, mv, and rm through exec |
| Webhooks | Poll GET /api/v1/sandboxes/{id} |
| An OpenAPI document | The routes above with curl or any HTTP client, or the Python and TypeScript SDKs |