The API
The Sandbox Router API lets you automate sandboxes, MCP servers, connectors, your users' logins and billing with an API key. It's a JSON API over HTTPS at https://api.sandboxrouter.io/v1, the sandboxrouter CLI (The CLI) maps its commands onto it one to one, and the TypeScript SDK (The TypeScript SDK) offers it as typed methods.
This guide is the API's reference: authentication, the conventions every route follows, and for each resource its objects, its requests, what they answer and refuse, and their limits. The other guides explain what each resource does. The API's OpenAPI 3.1 description is at https://sandboxrouter.io/openapi.json.
Authenticate
Create an API key
In the console, open Settings.
In the API keys card, enter a Key name, such as
ci, and choose Create key. If you're an owner, you can also check Billing access, which lets the key read the balance and add funds.Copy the key. It starts with
ck_, and it isn't shown again.
Owners and operators can create keys; viewers can't. A key from the console doesn't expire: it works until you choose Revoke beside it. Keys, members and invitations are managed only in the console, never with an API key.
Send the key
Send the key as a bearer token:
export SANDBOXROUTER_API_KEY=<api-key>
export NS=<namespace>
curl "https://api.sandboxrouter.io/v1/namespaces/$NS/sandboxes" \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY"A key belongs to one workspace, and every request it sends acts in that workspace. The paths of its sandboxes, snapshots, images, pools and provider accounts name the workspace's namespace, its slug, made from its name when the workspace was created: its letters a to z in lowercase and its digits, each run of other characters one -, at most 57 characters (Acme Inc. is acme-inc, and a name with no letter or digit is workspace), with - and a short ID after it where another workspace had that slug first. It never changes. Copy it from the console under Settings → Workspace, where it's the Namespace. A namespace of another workspace answers 401, and one no workspace has 404. A sandbox, server or connector of another workspace, by ID or name, answers 404, as one that doesn't exist does. To work in another workspace, use a key created there.
Scopes
A key's scopes say which routes it may call. A key from the console has every scope but the two billing ones, and Billing access adds those.
| Scope | What it allows |
|---|---|
sandbox:read | Read sandboxes, their execs, logs, metrics and snapshots; connectors, your users and their usage; the workspace's settings and audit log |
sandbox:write | Create, change, start, stop and delete sandboxes; take and delete snapshots; change the workspace's settings; make connect links, get and see your users' sign-in codes, disconnect and remove your users; change connectors and their workspace accounts (owners only); add, change and delete schedules, and run them now (with sandbox:execute) |
sandbox:execute | Run and cancel execs; read, write and delete files |
mcp:read | Read MCP servers, their client tokens, traces and stats |
mcp:write | Create, change and delete MCP servers (with sandbox:write, which a delete that leaves the server's sandbox doesn't need), and mint and revoke client tokens |
registry:read | Pull images and list tags at registry.caas.sh |
registry:write | Push and delete images at registry.caas.sh, and pull them |
billing:read | Read the balance, usage and auto-recharge, and see billing records in the audit log |
billing:write | Add funds and change auto-recharge |
Roles
A key can do what its scopes allow, within the role its creator has in the workspace now:
| Role | Scopes the role allows |
|---|---|
| Owner | All of them |
| Operator | All but billing:read and billing:write |
| Viewer | sandbox:read, mcp:read, registry:read and billing:read |
So if an operator who created a key becomes a viewer, the key can only read, and if they leave the workspace, the key gets 403. Adding, changing and removing connectors, and connecting or disconnecting their workspace accounts, needs an owner's key.
A revoked key, or a changed role, takes effect within a minute. Requests that grant access check the key at once instead: minting MCP client tokens, creating an MCP server, every change of a connector or its workspace account, and adding funds or changing auto-recharge.
Requests and responses
Send request bodies as JSON, with
Content-Type: application/json, except for files and a sandbox's change, a JSON merge patch (application/merge-patch+json). A body larger than its route takes gets413. An unknown field is refused, naming it.Sandboxes, snapshots, images, pools, providers and provider accounts are
sandboxrouter.io/v1objects:{ apiVersion, kind, metadata, spec, status }, what you set inspecand what Sandbox Router and the provider report instatus. Their times are RFC 3339. Every other resource is flat, what you set and what Sandbox Router reports side by side, and its times are milliseconds since the Unix epoch, as are an exec's and a log entry's. Money is in micro-USD: 1,000,000 is $1.A path's
<sandbox>is a sandbox's name or uid (u-…),<snapshot>a snapshot's name or uid (s-…), and<server>an MCP server's ID or name.A list of
sandboxrouter.io/v1objects answers{ "apiVersion", "kind": "<Kind>List", "metadata": { "continue" }, "items": [...] }. A paged one (sandboxes, snapshots) takes?continue=: passmetadata.continueback for the next page, until it is absent. A page can hold fewer items than itslimitwith more to come, so page untilcontinueis absent, never by count.?labelSelector=keeps the objects whose labels match:key=valueorkey==value, comma-joined, each to match;!=,in,notin,existsand!keyare refused, naminglabelSelector. Any other list answers{ "<resource>": [...] }, and a paged one itsnextCursorbeside it: pass it back as?cursor=for the next page. It'snullon the last page.A
sandboxrouter.io/v1route refuses a query parameter it doesn't take, or one given twice, naming it.Deleting a sandbox answers
202with it, itsmetadata.deletionTimestampset. Deleting an MCP server answers{ "id": "…", "deleted": true, "sandboxDeleted" }, whether its sandbox went with it; a connector's adds how many users'connectionsand whether anaccountwent with it; a file answers{ "path": "…", "deleted": true }. Revoking a client token answers the token.
Errors
Every error of a route of MCP servers, connectors, users, billing and the rest has the same JSON body:
{ "error": { "code": "invalid_request", "message": "idleStopMinutes must be a whole number from 5 to 240", "field": "sandbox.idleStopMinutes" } }field names the request field a validation error is about; a nested one is dotted, as in sandbox.size. Other fields some errors carry sit inside error: a billing refusal's billingUrl, a 5xx's requestId.
An error of a route of sandboxrouter.io/v1 objects is a Status, with the same codes in details.code:
{ "apiVersion": "sandboxrouter.io/v1", "kind": "Status", "status": "Failure", "code": 422, "reason": "Invalid",
"message": "spec.lifecycle.idleTimeout must be whole minutes from 5m to 4h",
"details": { "kind": "Sandbox", "name": "build-agent", "code": "invalid_request", "causes": [{ "field": "spec.lifecycle.idleTimeout" }] } }code is the HTTP status, and details.causes[0].field names the field: a body's path (spec.env[0].name), a query parameter (waitMs), a path parameter (port) or a header (content-type). details.kind and details.name name the object it's about, as the request named it. reason is Invalid (400, 413, 415, 422), Unauthorized, Forbidden, NotFound, Conflict or AlreadyExists (409), Unschedulable (422: nowhere its placement allows can run it), Unsupported (422: what its provider doesn't offer, provider_feature_unavailable, the capability it lacks named in message), ProviderError (the provider failed, or couldn't run it now) or InternalError. A 402, 405 or 429 has no reason.
code | Status | Meaning |
|---|---|---|
invalid_request | 400 | A field, query or header the API refuses, or a body that isn't JSON |
unauthorized | 401 | No API key, or one that's unknown or revoked |
payment_method_required, out_of_funds, spend_cap_reached | 402 | The workspace can't run what it asked for: no card on file, a balance of $0 or below, or this month's spend cap reached. Creating or starting a sandbox answers out_of_funds for each of them, within an hour of the change |
forbidden | 403 | The key's scopes or its creator's role don't allow the request |
tenant_suspended | 403 | The workspace is suspended. Billing still works, so an owner can pay. |
not_found | 404 | No such route, sandbox, server, exec, file, snapshot or connector |
method_not_allowed | 405 | The route doesn't take this method; the Allow header lists the ones it does |
conflict | 409 | The request conflicts with the resource's state, or an idempotency key was reused with another body |
name_taken | 409 | The name belongs to another server or schedule |
not_running | 409 | An exec, a file transfer or another call that needs the sandbox running, for one that doesn't run |
provider_not_connected | 400, 422 | A provider that runs only on your own account, which your workspace hasn't connected |
provider_feature_unavailable | 409; 422 on a sandboxrouter.io/v1 route | What the sandbox's provider doesn't offer, named in the message, such as an exec's stdin, a snapshot or a port's URL |
provider_unavailable | 503 | The sandbox's provider, or under auto every provider of its size, couldn't run it now; with Retry-After when the provider said how long |
sandboxes_provisioning | 503 | Your workspace's sandboxes are still being set up. Try again shortly. |
too_large | 413 | The body is too large |
unsupported_media_type | 415 | A body whose Content-Type the route doesn't take |
rate_limited | 429 | A rate limit was reached; see Rate limits |
unavailable | 502, 503 | A temporary failure. Try again shortly. |
Every 402 has a billingUrl: the console page where an owner adds funds or a card. See Billing and usage.
Request IDs
Every response has an x-sandboxrouter-request-id header that names the request. Sandbox Router logs everything the request did under that ID, and the audit log records it with each change. Quote it when you report a problem.
Rate limits
| Requests | Limit |
|---|---|
| To the API, from one client address | 6,000 a minute |
| To the API, with one API key | 6,000 a minute |
| To one MCP endpoint, with a valid client token | 1,200 a minute |
| To the MCP gateway without a valid client token, from one client address | 600 a minute |
A request over a limit gets 429 with "code": "rate_limited" and a Retry-After header. Limits are counted at each edge location separately.
Idempotency keys
Requests that create something you mustn't create twice take an Idempotency-Key header of 8 to 128 letters, digits, _ and -. If you get no answer, or a 5xx, send the request again with the same key and body. If the first one went through, you get its result, and nothing is created twice.
| Request | A repeat with the same key | With another body |
|---|---|---|
POST /v1/namespaces/<namespace>/sandboxes:run, POST …/sandboxes | 200 with the same sandbox | 409 |
POST …/sandboxes/<sandbox>/exec | That exec, as it now stands | 409 |
POST /v1/namespaces/<namespace>/sandboxsnapshots | 200 with the same snapshot, as it now stands | 409 |
POST /v1/mcp-servers | 200 with the server, without its tokens' secrets | 409 |
POST /v1/billing/top-ups (required) | The same top-up | 409 |
Without the header, each request creates something new.
Sandboxes
A sandbox is a Sandbox object. Fields lists every field you set in its metadata and spec, and what Sandbox Router and its provider report in its status; Sandboxes explains what each does.
Sandbox routes
| Route | Scope | What it does |
|---|---|---|
POST /v1/namespaces/<namespace>/sandboxes:run | sandbox:write | Runs a sandbox, holding until it runs; see Run or create a sandbox |
POST /v1/namespaces/<namespace>/sandboxes | sandbox:write | Creates a sandbox, answering at once |
GET /v1/namespaces/<namespace>/sandboxes | sandbox:read | Lists sandboxes; see Read and list sandboxes |
GET …/sandboxes/<sandbox> | sandbox:read | Reads one |
PATCH …/sandboxes/<sandbox> | sandbox:write | Changes its labels, outbound access, idle timeout or state; see Change a sandbox |
DELETE …/sandboxes/<sandbox> | sandbox:write | Deletes it; see Delete a sandbox |
POST …/exec | sandbox:execute | Runs a command; see Execs |
GET …/exec | sandbox:read | Lists the execs that run |
GET …/exec/<exec-id> | sandbox:read | Reads an exec |
DELETE …/exec/<exec-id> | sandbox:execute | Cancels a running exec |
GET …/logs | sandbox:read | Its log; see Logs |
GET …/metrics | sandbox:read | Its CPU, memory and disk over time, as its provider measured them; see Metrics |
GET, PUT, DELETE …/files/<path> | sandbox:execute | Its files; see Files |
GET …/ports/<port> | sandbox:execute | Its provider's own URL for a port; see Ports |
… is /v1/namespaces/<namespace>/sandboxes/<sandbox> for the routes under a sandbox. A route takes the methods the table lists, and answers any other 405 with an Allow header. Viewers' keys and a suspended workspace's read sandboxes, and change none.
Run or create a sandbox
curl "https://api.sandboxrouter.io/v1/namespaces/$NS/sandboxes:run" \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: build-agent-0001" \
-d '{
"metadata": { "name": "build-agent", "labels": { "team": "ci" } },
"spec": {
"resources": { "size": "l" },
"env": [{ "name": "MODE", "value": "ci" }],
"network": { "egress": { "mode": "allow", "allow": [{ "domain": "api.github.com" }, { "domain": "*.npmjs.org" }] } },
"connectors": ["github"]
}
}'{} alone is a whole request, every field taking its default. Once the sandbox runs, it answers 201 Created with it:
{
"apiVersion": "sandboxrouter.io/v1", "kind": "Sandbox",
"metadata": { "name": "build-agent", "namespace": "acme", "uid": "u-pjcusquzsv73qilmgdi6pmwfqhlyg7cn5xiehulebdf32cv42qsq",
"creationTimestamp": "2026-10-11T09:30:00.000Z", "labels": { "team": "ci" } },
"spec": { "resources": { "size": "l" }, "env": [{ "name": "MODE", "value": "ci" }],
"network": { "egress": { "mode": "allow", "allow": [{ "domain": "api.github.com" }, { "domain": "*.npmjs.org" }] } },
"state": "Running", "lifecycle": { "idleTimeout": "15m" }, "connectors": ["github"] },
"status": { "phase": "Running", "provider": { "name": "cloudflare", "id": "sb-4f9a0c1d2e3b" },
"resources": { "cpu": "1", "memory": "6Gi", "disk": "12Gi" }, "startedAt": "2026-10-11T09:30:03.000Z",
"conditions": [{ "type": "Scheduled", "status": "True", "reason": "Scheduled", "lastTransitionTime": "2026-10-11T09:30:00.000Z" },
{ "type": "Ready", "status": "True", "reason": "Running", "lastTransitionTime": "2026-10-11T09:30:03.000Z" }] }
}The body is a Sandbox, every field optional: apiVersion and kind, when given, are sandboxrouter.io/v1 and Sandbox, metadata.namespace is the path's, and status is ignored. Any other field is refused 422 Invalid, naming it. A body that isn't JSON is refused 400, and one over 14,071,430 bytes 413.
:runholds until the sandbox runs and answers201 Createdwith it. A sandbox that failed answers201too, withstatus.phaseFailedand why on itsReadycondition. Sandbox Router sets no deadline of its own: how long to wait is yours to decide, and a create you stop waiting for goes on.POST …/sandboxesmakes the same create and answers at once,201with the sandboxPending: itsReadyconditionFalsewithProvisioning, and nostatus.providerorstatus.resourcesyet. Itsmetadata.uidis its own from then on. Read it by that uid with?waitMs=to see it run, or fail.A repeat with the same
Idempotency-Keyand body answers200with the same sandbox, as it then stands; a:runand a create of one body under one key are one create. The key with another body is refused409Conflict, and so is a repeat once its sandbox was deleted.Names. Without
metadata.name, the sandbox is named<namespace>-xxxxx, the same name for each repeat of oneIdempotency-Key. A name is 1 to 63 lowercase letters, digits and-, never of a uid's form (u-…ors-…). A name is a label, not an identity: sandboxes may share one, and a create is never refused for its name. The sandbox's identity is itsmetadata.uid; to create exactly once, send anIdempotency-Key.Placement. A sandbox whose
spec.placement.selectornames a provider (topology.sandboxrouter.io/provider) or one of your accounts (topology.sandboxrouter.io/account) runs there, on Sandbox Router's own account for Native and on your own account for the others. Without a selector, the workspace's Auto order places it: the create tries each provider of the order that can run it, in turn, and the next takes the create when a provider refused it or its sandbox never ran. The sandbox keeps one uid throughout, and its placement is its create's for good. See Routing and policies.A restore (
spec.from.snapshotRef) runs on its snapshot's own provider and account; see Restore a snapshot.
A create pinned to your E2B account:
curl "https://api.sandboxrouter.io/v1/namespaces/$NS/sandboxes:run" \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: build-agent-e2b-0001" \
-d '{
"metadata": { "name": "build-agent-e2b" },
"spec": {
"resources": { "size": "l" },
"placement": { "selector": { "topology.sandboxrouter.io/provider": "e2b" } }
}
}'It runs on E2B or nowhere, and its status.provider.name is e2b. { "topology.sandboxrouter.io/account": "e2b-team-a" } names the account by its name instead.
A create is refused before anything is created when:
| Status | reason or details.code | When |
|---|---|---|
400 | Invalid, at spec.from.imageRef.ref | The image's tag or digest isn't in your registry, or the image is another workspace's |
400 | Invalid, at spec.network.egress.allow[N] | A destination its network doesn't admit: a domain outside the top-level domains in What a list allows, or any cidr range |
400 | provider_not_connected, at spec.placement.selector | A provider that runs only on your own account, which your workspace hasn't connected |
402 | payment_method_required, out_of_funds, spend_cap_reached | The workspace can't run sandboxes now; see Errors |
422 | Invalid | A field it doesn't take, or a value out of its rules, named. A sandbox on your own image needs size m or larger |
422 | Unschedulable | Nowhere its placement allows can run it, naming the field that decides: spec.placement.selector (an account you don't have, one whose key isn't Ready, or a provider other than the account's), spec.from.imageRef.ref (an image its provider doesn't boot) or spec.resources.sizeMatch (no provider gives exactly the size) |
422 | Unsupported | Its provider doesn't offer what it asks, such as limiting a destination to ports, the capability named in message |
503 | ProviderError, provider_unavailable | Every provider its placement allows couldn't run it now, with Retry-After when the provider said how long |
Read and list sandboxes
GET …/sandboxes/<sandbox> answers the sandbox. ?waitMs= (whole milliseconds) holds the read while the sandbox starts or stops, until it settles or that long passes; it takes no other parameter. By uid, a sandbox is found at once; by name, through a list that can miss a sandbox for a moment after its create. A name that more than one sandbox has is refused 409 Conflict, naming each uid: read each by its uid. A deleted sandbox, or a name or uid the namespace doesn't have, answers 404.
GET /v1/namespaces/<namespace>/sandboxes answers a SandboxList of every sandbox of the workspace, newest first, those your MCP servers and workflows run among them. It takes ?labelSelector=, ?limit= (a whole number of at least 1) and ?continue=. A page holds at most 9,993 sandboxes, whatever its limit, and a new sandbox shows within seconds.
A read and a list carry each sandbox's status.usage, what was metered of it since its create:
| Field | What it counts |
|---|---|
wallMs | Its running time |
vcpuMs, memoryGibMs, diskGibMs | Its allocation over that time: a vCPU, a GiB of memory or a GiB of disk for a millisecond |
egressBytes | The bytes it sent out on its own network, where its provider meters them |
proxyEgressBytes | The bytes it sent out through the egress proxy |
Each is a whole number, 0 before anything was metered. A running sandbox is metered in stretches of up to an hour, each counted once it ends. Money isn't in it: GET /v1/billing/usage prices the workspace's usage (Billing).
Change a sandbox
PATCH …/sandboxes/<sandbox> takes a JSON merge patch (Content-Type: application/merge-patch+json; any other type is refused 415, naming content-type) and answers 200 with the sandbox. It changes these, any of them in one patch, and keeps what it leaves out:
metadata.labels. A key set to a value takes it, a key set tonullis removed, and"labels": nullremoves all of yours. Labels count up to 16 with the ones Sandbox Router keeps on the sandbox, so a sandbox created with anIdempotency-Keyand a user has room for 12 of yours. On Freestyle, a value is at most 63 characters.spec.lifecycle.idleTimeout: whole minutes from5mto4h.nullis refused.spec.network.egress, merged into the sandbox's:modeandalloware each replaced where the patch names them, andallowis replaced whole. To go from a list to none, send{ "mode": "none", "allow": null }. A sandbox stays on the network its create gave it: one created with every destination can't change tononeor a list, nor one created withnoneor a list to every destination (422, namingspec.network.egress); run a new sandbox for that. A provider that changes outbound access only at a start refuses a change of a running sandbox's (422Unsupported,egress.live): stop it, change it, and start it, the change and the start in one patch if you like.spec.state:Runningstarts it andStoppedstops it, answering at once while it settles, withspec.statethe new state andstatus.phasePendingwhile it starts, orStoppedonce it is stopping. Read it with?waitMs=to wait until it has settled.Pausedis refused422Unsupported. A start needs the workspace's funds (402). A failed sandbox readsStopped, andRunningstarts it again.
metadata.name and metadata.namespace may be given, and must be the sandbox's own; any other field is refused 422, naming it (spec.resources is not a field spec takes). A body over 12,366,280 bytes is refused 413.
A patch changes the labels, idle timeout and outbound access first, all or none, then starts or stops the sandbox. A refusal part-way names its field, and what came before it stays changed. A sandbox that is starting or stopping takes no change of its labels, idle timeout or outbound access (409 Conflict), so read it with ?waitMs= first. Send an Idempotency-Key only to retry the same change: it answers the sandbox as it now is. Make one change of a sandbox at a time: two at once can lose one's labels or outbound access.
Delete a sandbox
DELETE …/sandboxes/<sandbox> answers 202 with the sandbox, its metadata.deletionTimestamp set, and takes no Idempotency-Key. From then on, a read, a list and another delete answer 404. Its snapshots stay until you delete them; the MCP server it hosted ends, and the browsers its AI tools opened close.
Execs
curl "https://api.sandboxrouter.io/v1/namespaces/$NS/sandboxes/build-agent/exec" \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: run-tests-0001" \
-d '{ "command": ["npm", "test"], "env": { "CI": "1" }, "workdir": "/workspace/app", "timeoutSeconds": 1800 }'| Field | Value |
|---|---|
command | Required. 1 to 32 arguments of up to 512 characters; no shell is added |
stdin | Text sent to the command, up to 64 KiB |
env | Variables over the sandbox's, as an object, { "NAME": "value" }: up to 64, names of letters, digits and _, not starting with a digit or SANDBOXROUTER_, values up to 4,096 characters |
workdir | Its directory, the sandbox's by default: an absolute path of up to 1,024 characters, without . or .. parts, not under /proc, /sys, /dev or /workspace/.sandboxrouter |
timeoutSeconds | 1 to 7,200, or up to 86,400 when detached; without it, no time limit |
detach | true answers at once while it runs |
The request holds until the command ends and answers 200; with ?waitMs=, 202 once that long passed while it runs, or at once with "detach": true:
{ "apiVersion": "sandboxrouter.io/v1", "kind": "Execution", "execId": "…", "state": "succeeded", "createdAt": 1791797400000,
"endedAt": 1791797412000, "exitCode": 0, "signal": null, "stdout": "…", "stderr": "" }state is running, succeeded, failed (an exit code other than 0), timed_out, canceled or lost (its provider couldn't run it, or lost it, with error); stdout and stderr are null until it ends, then the whole output. Its times are milliseconds since the Unix epoch. Output arrives when the command ends: follow a long one with ?waitMs= and a read by its execId.
A field it doesn't take, or a value out of its rules, is refused
422Invalid, naming it. A body over 2,120,452 bytes is refused413.The same
Idempotency-Keyand body again answers that exec as it now stands, never running it twice; the key with another body is refused409.A sandbox that doesn't run is refused
409not_running: nothing starts it.A provider that can't take the exec's
stdin,env,workdiror time limit refuses it422Unsupported, namingexec.stdin,exec.env,exec.cwdorexec.timeout.
GET …/exec answers an ExecutionList of the execs that run, oldest first, every one at once. GET …/exec/<exec-id> reads one (?waitMs= holds while it runs, answering 202 while it still does); an ID the sandbox has no exec of answers 404. DELETE …/exec/<exec-id> cancels one where its provider can stop a command it started earlier (else 422 Unsupported, exec.detach), and answers the exec as the cancel left it; an exec that ended already is answered as it stands. A cancel takes no Idempotency-Key.
Logs
GET …/sandboxes/<sandbox>/logs answers { "entries": [{ "at", "stream", "message", "kind" }] }: every entry at or after ?since= (milliseconds or an ISO 8601 time), oldest first, kept for the sandbox's lifetime. Each is what Sandbox Router recorded of the sandbox's lifecycle (stream system): a state it reached, as its kind, such as sandbox.running, sandbox.stopped or sandbox.deleted, with why as its message. What its command writes is its provider's, and a command's output is in its exec. With ?follow=true, the answer is newline-delimited JSON (application/x-ndjson): those entries, then each new one as it comes, until you stop reading. It may end at any time, so follow on with since set to the last entry's at. A sandbox deleted while you follow it sends its sandbox.deleted entry, then nothing more. It takes no other parameter; a deleted sandbox's log answers 404.
Metrics
GET …/sandboxes/<sandbox>/metrics answers { "samples": [{ "at", "cpuPct", "memUsedBytes", "memTotalBytes", "diskUsedBytes", "diskTotalBytes" }] }: the sandbox's provider's own measurements of its CPU (as a percentage of all its CPUs, which can pass 100 where a provider lets a sandbox burst), memory and disk (in bytes), oldest first, from ?from= to ?to=, as far back as the provider keeps them, whether the sandbox runs or not. from and to are RFC 3339 times to the millisecond, such as 2026-10-11T09:00:00Z (percent-encode a + as %2B); without from, from the sandbox's create, and without to, until now. A value the provider doesn't measure is null. A provider that keeps no metrics refuses them 422 Unsupported (metrics), and a from after to is refused, naming from.
Files
| Route | What it does |
|---|---|
GET …/files/<path> | Answers the file's bytes as application/octet-stream |
PUT …/files/<path> | Writes the body as the file, whole and of any size, answering { "path", "bytes" } |
DELETE …/files/<path> | Deletes the file, answering { "path", "deleted": true } |
Each is the provider's own file operation on the running sandbox, one file at a time; there's no directory listing, and no route takes a query parameter. <path> is the absolute path with each segment percent-encoded, as in …/sandboxes/build-agent/files/workspace/my%20file.txt: up to 1,024 characters, without empty, . or .. parts, and not under /proc, /sys, /dev or /workspace/.sandboxrouter. …/files/ is /, which can only be read. A write and a delete take no Idempotency-Key; writing the same bytes again leaves the same file.
| Answer | When |
|---|---|
400 Invalid, naming path | A path out of these rules |
404 | A sandbox the namespace doesn't have, or a file the sandbox doesn't have; the message says which |
409 Conflict | A name two sandboxes have: name the sandbox by its uid |
409 not_running | A sandbox that doesn't run. A file isn't a reason to start it |
422 Unsupported | An operation its provider doesn't offer: files.read, files.write or files.delete |
Ports
GET …/sandboxes/<sandbox>/ports/<port> answers where a port of the running sandbox is reached, at its provider's own URL: { "port", "url", "headers", "expiresAt" }. headers are what a request to the URL carries, the provider's authorization for it: keep them secret, and read the port again at expiresAt, when they lapse. <port> is 1024 to 65535 (else 400, naming port). It needs sandbox:execute, as the headers reach into the sandbox. A provider that gives no URL refuses it 422 Unsupported (ports.url), and a sandbox that doesn't run answers 409 not_running.
Snapshots
A snapshot is a SandboxSnapshot, a provider's own copy of a sandbox. It's named as a sandbox is, reached by its name or its uid, and kept until you delete it, even once its sandbox is gone. See Snapshots for what each provider keeps.
{
"apiVersion": "sandboxrouter.io/v1", "kind": "SandboxSnapshot",
"metadata": { "name": "build-agent-nightly", "namespace": "acme", "uid": "s-h64wqqeyfvytzewvebb2p2kshgfpahtw5g2gjvtximnbcqcahbqq-1",
"creationTimestamp": "2026-11-15T09:00:00.000Z",
"labels": { "team": "web", "sandboxrouter.io/sandbox-uid": "u-pjcusquzsv73qilmgdi6pmwfqhlyg7cn5xiehulebdf32cv42qsq" } },
"spec": { "sandboxRef": { "name": "u-pjcusquzsv73qilmgdi6pmwfqhlyg7cn5xiehulebdf32cv42qsq" }, "includeMemory": false },
"status": { "provider": "daytona", "account": "own", "ref": "snap-3f2a…", "state": "Ready", "bytes": 1234567890,
"resources": { "cpu": "1", "memory": "4Gi", "disk": "8Gi" } }
}| Field | What it is |
|---|---|
metadata.name | Its name: yours, or <namespace>-xxxxx where you give none |
metadata.uid | Its uid: s-, 52 characters, - and a number. No name takes this form |
metadata.labels | Your labels, and sandboxrouter.io/sandbox-uid, its sandbox's uid, which you don't set |
metadata.creationTimestamp | When it was taken |
metadata.deletionTimestamp | When you deleted it, while its provider removes it |
spec.sandboxRef.name | The sandbox it's of, by its uid |
spec.includeMemory | Whether it kept the sandbox's memory and processes, or its disk alone |
status.provider | The provider that holds it: its sandbox's |
status.account | The account it's on: sandboxrouter (Native) or own (your account at the provider). A restore stays there |
status.ref | The provider's own ID for it |
status.state | Its provider's: Pending while the provider still makes it, Ready, Inactive (held, and renewed by a restore), Failed (not made) or Expired (ended by its provider on its own) |
status.message | Why it's Failed or Expired, in its provider's words |
status.expiresAt | When its provider ends it on its own, where it does; a restore may move it |
status.bytes | Its size at the provider, where the provider says |
status.resources | The size it restores at, as its provider says |
| Route | Scope | What it does |
|---|---|---|
POST /v1/namespaces/<namespace>/sandboxsnapshots | sandbox:write | Takes a snapshot, answering 201 with it at once; see Take a snapshot |
GET /v1/namespaces/<namespace>/sandboxsnapshots | sandbox:read | Lists the namespace's snapshots; see Read, list and delete snapshots |
GET …/sandboxsnapshots/<snapshot> | sandbox:read | Reads one, by its name or uid |
DELETE …/sandboxsnapshots/<snapshot> | sandbox:write | Deletes one at its provider, by its name or uid: 200 once it's gone, 202 while its provider removes it |
A snapshot is never changed: a route answers a method the table doesn't list 405, with an Allow header. Viewers' keys and a suspended workspace's read snapshots, and take or delete none.
Take a snapshot
{ "apiVersion": "sandboxrouter.io/v1", "kind": "SandboxSnapshot", "metadata": { "name": "build-agent-nightly", "labels": { "team": "web" } },
"spec": { "sandboxRef": { "name": "build-agent" } } }spec.sandboxRef.namenames the sandbox by its name or uid. The sandbox must run: one that doesn't is refused409not_running, and nothing starts it. A provider whose snapshot pauses or stops the sandbox leaves it stopped. A sandbox the namespace doesn't have, a deleted one among them, is refused422Invalid, namingspec.sandboxRef.name, and a name two sandboxes have409Conflict, naming both uids.metadata.nameis optional. Without it, the snapshot is named<namespace>-xxxxx, the same name for each repeat of oneIdempotency-Key. A name is 1 to 63 lowercase letters, digits and-, never of a uid's form (u-…ors-…). A name another snapshot of the namespace has is refused409AlreadyExists(name_taken), naming its uid, and nothing is taken. A name is found through a list that can miss a snapshot for a moment after its take, so two takes of one name at the same moment can both take it; a read of that name then answers409Conflict, naming both uids.metadata.labelstake the keys and values a sandbox's do, and count up to 16 with the ones Sandbox Router keeps on the snapshot: three, or four with anIdempotency-Key, so a snapshot has room for 13 of yours, or 12.spec.includeMemory:truekeeps the sandbox's memory and processes,falseits disk alone; without it, the snapshot keeps what its provider's snapshots keep. E2B's take either, and keep memory without it; Freestyle's always keep memory; Native's and Daytona's keep the disk alone; Maritime takes none. What its provider's snapshots can't be is refused422Unsupported, in the provider's words:truewhere they keep no memory, andfalsewhere every one keeps it, namingspec.includeMemory; either where the provider takes none, namingspec.sandboxRef.It answers
201at once with the snapshot:Pendingwhile its provider still makes it, elseReady, orFailedwith why instatus.message. Read it again to see aPendingone becomeReady; only then does it restore.The same
Idempotency-Keyand body again answers200with the same snapshot, as it now stands, never taking it twice; the key with another body is refused409Conflict. A key counts per sandbox, but the name it generates is the namespace's: the key again on another sandbox, withoutmetadata.name, is refused409AlreadyExists.apiVersionandkind, when given, aresandboxrouter.io/v1andSandboxSnapshot,metadata.namespaceis the path's, andstatusis ignored. Any other field is refused422Invalid, naming it. A body that isn't JSON is refused400, and one over 56,898 bytes413.
Read, list and delete snapshots
GET …/sandboxsnapshots/<snapshot> reads one, by its name or uid, whether its sandbox is deleted or not. By uid, a snapshot is found at once; by name, through a list that can miss a snapshot for a moment after its take. A name that two snapshots have is refused 409 Conflict, naming both uids: read each by its uid. A name or uid the namespace has no snapshot of answers 404.
GET …/sandboxsnapshots answers a SandboxSnapshotList of the namespace's snapshots, newest first, deleted sandboxes' among them. It takes ?labelSelector=, ?limit= (a whole number of at least 1; without it, a page holds every snapshot) and ?continue=, and a continue that names no page is refused 400, naming continue. A selector matches your labels and sandboxrouter.io/sandbox-uid: ?labelSelector=sandboxrouter.io/sandbox-uid=<uid> lists one sandbox's snapshots. A new snapshot shows within seconds.
DELETE …/sandboxsnapshots/<snapshot> deletes one at its provider, by its name or uid, and takes no Idempotency-Key. Once it's gone, it answers 200 with the snapshot, its metadata.deletionTimestamp set, and a read, a list and another delete then answer 404; a Native snapshot is gone at once. While its provider still removes it, as Daytona's does, it answers 202 with the snapshot, its metadata.deletionTimestamp set: it reads and lists so, another delete answers 202 again, and a restore of it is refused 409 Conflict, until it's gone.
Restore a snapshot
A sandbox's create (:run or POST …/sandboxes) with "spec": { "from": { "snapshotRef": { "name": "build-agent-nightly" } } } boots the snapshot, named by its name or uid. spec.from takes imageRef or snapshotRef, not both.
It runs on the snapshot's own provider and account, by its name or without a selector; a selector naming another provider is refused
422Unsupported, namingspec.placement.selector.Without
spec.resources.size, it boots at the snapshot's own size, itsstatus.resources. With one, a provider that restores a snapshot at another size takes it, as any create; elsewhere the snapshot's own size must match it asspec.resources.sizeMatchasks,roundUp(the default) covering it andexactequal to it, else422Unschedulable, namingspec.resources.sizeMatch. So is a size asked of a snapshot whose provider hasn't said its whole size.A
Readysnapshot boots, and anInactiveone is renewed by its provider first, then boots. APendingone, or one being deleted, is refused409Conflict; aFailedorExpiredone422Invalid, namingspec.from.snapshotRef.name. A restore of a Native snapshot moves itsstatus.expiresAt.A snapshot the namespace doesn't have is refused
422Invalid, namingspec.from.snapshotRef.name, and a name two snapshots have409Conflict. A deleted sandbox's snapshot restores as a running one's does.The restored sandbox reads back with its size and provider, and no
spec.from.snapshotRef.
Images of the namespace
A SandboxImage names what sandboxes boot, made once in a namespace: of an image of your registry, of an artifact already at a provider, or of a Dockerfile. A sandbox boots it by "spec": { "from": { "imageRef": { "name": "python-dev" } } }. See Images and the registry for your registry itself.
{
"apiVersion": "sandboxrouter.io/v1", "kind": "SandboxImage",
"metadata": { "name": "python-dev", "namespace": "acme", "uid": "0b0f7e6c-7c47-4c49-9b2d-6f0b0a7c2f4e",
"creationTimestamp": "2026-11-11T09:00:00.000Z", "labels": { "team": "ml" } },
"spec": { "source": { "image": { "registry": "registry.caas.sh", "repository": "python", "tag": "3.12" } } },
"status": { "digest": "sha256:…", "materializations": [
{ "provider": "e2b", "account": "own", "state": "Ready", "method": "direct", "ref": "registry.caas.sh/…@sha256:…" },
{ "provider": "maritime", "account": "own", "state": "Unsupported", "message": "Maritime cannot pull images of registry.caas.sh: …" } ] }
}| Route | Scope | What it does |
|---|---|---|
POST /v1/namespaces/<namespace>/sandboximages | sandbox:write | Makes an image, answering 201 with it |
GET /v1/namespaces/<namespace>/sandboximages | sandbox:read | Lists the namespace's images: a SandboxImageList, every one at once, by name. It takes ?labelSelector= alone |
GET …/sandboximages/<name> | sandbox:read | Reads one; a name the namespace has none of answers 404 |
DELETE …/sandboximages/<name> | sandbox:write | Removes it, answering 200 with it as it was |
An image is never changed: to follow a newer push of its tag, or to build it again, delete it and make it again.
Make an image
| Field | Value |
|---|---|
metadata.name | Required: 1 to 63 lowercase letters, digits and -, unique in the namespace, never of a uid's form |
metadata.labels | As a sandbox's: up to 16, values up to 256 characters |
spec.source.image | An image of your registry: { "registry": "registry.caas.sh", "repository": "[<tenant-id>/]<name>", "tag" }, or "digest" in place of tag, or neither for latest. A tag is pinned to the digest it names now, status.digest |
spec.source.providerRef | An artifact already at a provider, on your own account there: { "provider", "ref" }; see A provider's artifact |
spec.source.dockerfile | { "content" }, a Dockerfile's text; see A Dockerfile |
spec.source takes exactly one of image, providerRef and dockerfile. Any other field is refused 422, naming it, and a body over 11,724,170 bytes 413. A create takes no Idempotency-Key: a name is one image, so a create sent again is refused 409 AlreadyExists (name_taken), and the image it made is read by its name. A tag or digest your registry doesn't have, or another workspace's image, is refused 400, naming spec.source.image.
status.materializations says where the image is bootable now: one entry for each provider and account the namespace's sandboxes may be placed on (each size, for a Dockerfile's builds), read each time the image is read. Each has its provider, its account (own or sandboxrouter), its state, and where it's Ready, its method and the ref its provider boots:
state | What it means |
|---|---|
Ready | A sandbox naming the image can boot it there |
Unsupported | It can't, and message says why: a sandbox naming the image is never placed there |
Pending, Building | A Dockerfile's build there is under way |
Failed | A Dockerfile's build there failed, with the provider's reason as message |
An image of your registry is Ready (method: direct) on each provider that boots images of your registry, handed to the provider as it is, and Unsupported on Maritime, which pulls only public images.
A provider's artifact
spec.source.providerRef names an artifact already at a provider, on your own account of it, which must be connected and Ready (else 422 provider_not_connected, naming spec.source.providerRef.provider):
provider | ref | Its size |
|---|---|---|
daytona | A snapshot's name | The snapshot's own |
e2b | A template's name or ID: a lowercase letter or digit, then up to 127 lowercase letters, digits, _ and - | The template's own, at its last successful build |
maritime | A template's ID: a letter or digit, then up to 127 letters, digits, ., _ and - | The size the sandbox asks for |
Freestyle's snapshots and Native aren't offered, and are refused 422, naming spec.source.providerRef.provider. When you make the image, Sandbox Router reads a Daytona snapshot or an E2B template at your account, within the request (up to 20 seconds), to check that it's there, that it boots now, and its size. It's refused 422, naming spec.source.providerRef.ref, when your account holds no such artifact or it doesn't boot now (still building, failed or deactivated): make the image again once it does. A key that names an API, a region or a deployment of its own (Daytona's apiUrl or target, E2B's domain) can't be read through, and is refused 422 (provider_feature_unavailable). A provider that refused the read answers 502, or 503 where asking again may help. A Maritime template isn't read: Maritime refuses one your account doesn't hold when a sandbox boots it.
Its one materialization is on your account of its provider (method: providerRef), with the artifact's size as resources where it fixes one. A sandbox naming it runs on that account alone, whatever its placement (another provider named is refused 422 Unsupported), and its size follows spec.resources.sizeMatch against the artifact's: roundUp takes a size the artifact covers, and exact only the artifact's own; else 422 Unschedulable. It reads back as spec.from.imageRef.ref template:<ref> on E2B and Maritime, and with no spec.from on Daytona. Deleting the image leaves the artifact at its provider.
A Dockerfile
spec.source.dockerfile.content is a Dockerfile's text, not blank, of at most 1,944,618 bytes as JSON writes it. It builds from what its own instructions fetch, its FROM image and what its RUN steps download: there's no build context, so a COPY or ADD of local files finds none, and contextRef is refused 422.
It's built on your own Daytona account, into a snapshot for each size, starting when you make the image, and on a Daytona account you connect later once its key is Ready. Its materializations are one for each size there (method: snapshot, with its size), Pending, Building, Ready or Failed; every other account is Unsupported, saying why. A size that failed stays failed: make the image again to build it again. Two images of one Dockerfile share its builds.
A sandbox naming it boots the snapshot of its size (m without one) on your Daytona account, whatever its placement (another provider named is refused 422 Unsupported). While that size builds, the create is refused 409 Conflict, naming spec.from.imageRef.name: create the sandbox once its materialization is Ready. A size whose build failed is refused 422, with Daytona's reason. Deleting the image stops following its builds; the snapshots stay at Daytona.
Boot an image
A sandbox's spec.from.imageRef takes { "name" }, an image of the namespace, or { "ref" }, a reference, not both. By name, a create boots the image's digest exactly as a ref naming that digest would, and the sandbox reads back with that ref. It's refused 422 for a name the namespace has no image of, 400 for a digest your registry no longer has, and 422 Unschedulable where a provider named in spec.placement.selector doesn't boot it, each naming spec.from.imageRef.name. A sandbox on an image of your registry needs size m or larger.
Providers and pools
A provider is a SandboxProvider: cloudflare (Native, Sandbox Router's own runtime), daytona, e2b, freestyle and maritime. A pool is a SandboxPool, one provider in one account: Sandbox Router's own, the same in every workspace, and your namespace's own, one for each of your provider accounts whose key is Ready. Both are read-only.
| Route | Scope | What it does |
|---|---|---|
GET /v1/sandboxproviders, GET /v1/sandboxproviders/<name> | sandbox:read | The providers |
GET /v1/sandboxpools, GET /v1/sandboxpools/<name> | sandbox:read | Sandbox Router's own pools: cloudflare, Native |
GET /v1/namespaces/<namespace>/sandboxpools, GET …/sandboxpools/<name> | sandbox:read | Your namespace's own pools, each named by its account |
GET /v1/providers | sandbox:read | Each provider's place in your workspace; see The providers in your workspace |
GET /v1/providers/auto, PUT /v1/providers/auto | sandbox:read; sandbox:write and owner to change | Your workspace's Auto order; see The Auto order |
{ "apiVersion": "sandboxrouter.io/v1", "kind": "SandboxProvider", "metadata": { "name": "e2b" }, "spec": { "displayName": "E2B" } }{
"apiVersion": "sandboxrouter.io/v1", "kind": "SandboxPool",
"metadata": { "name": "e2b-team-a", "namespace": "acme",
"labels": { "topology.sandboxrouter.io/provider": "e2b", "topology.sandboxrouter.io/account": "e2b-team-a" } },
"spec": { "provider": "e2b", "sizing": { "mode": "fixed", "defaultSize": "m", "sizes": [
{ "name": "xs", "cpu": "0.0625", "memory": "0.25Gi", "disk": "2Gi" }, { "name": "s", "cpu": "0.25", "memory": "1Gi", "disk": "4Gi" },
{ "name": "m", "cpu": "0.5", "memory": "4Gi", "disk": "8Gi" }, { "name": "l", "cpu": "1", "memory": "6Gi", "disk": "12Gi" },
{ "name": "xl", "cpu": "2", "memory": "8Gi", "disk": "16Gi" }, { "name": "2xl", "cpu": "4", "memory": "12Gi", "disk": "20Gi" } ] } }
}A pool's
metadata.labelsaretopology.sandboxrouter.io/provider, and on your own pooltopology.sandboxrouter.io/account: the labels a sandbox'sspec.placement.selectornames.metadata.namespaceis on your own pools alone.spec.sizing.sizesare the sizes the provider takes (Freestyle and Maritime stop atxl), each as the pool asks the provider for it; the provider may give more, which a sandbox'sstatus.resourcesshows.defaultSizeis the size of a create that names none.A list answers every object at once, by name, and takes
?labelSelector=alone. A provider has no labels. A name no pool or provider has answers404.
The providers in your workspace
GET /v1/providers answers { "providers": [...] }, one entry for each provider:
| Field | What it says |
|---|---|
id, name | The provider, as spec.placement.selector names it, and its name |
status | available; verifying while it checks your key; key_invalid when it refused your key, with keyError, { code, message }; unavailable when it runs only on your own account and you haven't connected one, or while your key is being removed; unconfigured when Sandbox Router doesn't offer it now, so it takes no key and places no sandbox |
account | own once you connected a key; sandboxrouter for Native; else null |
byok | Whether you can connect your own key |
keyConnectedAt | When your key was connected, or null |
sizes | The sizes it takes, each with its vCPU, memory and disk and what an hour of it running costs, microUsdPerHour: 0 on every provider but Native, as each of the others bills you directly |
custom | Its custom size's bounds, or null |
features | What it offers here: ownImage, ports, egressHosts, connectors, mcpServers, workflows and env |
rates | What Sandbox Router bills there, in micro-USD; see pricing |
autoPosition | Its place in your Auto order, 1 for the first, or null when the order leaves it out |
The Auto order
GET /v1/providers/auto answers { "order": [...] }, the providers a sandbox without a provider tries, in turn. Until an owner sets it, it's ["maritime", "daytona", "freestyle", "e2b", "cloudflare"]. PUT /v1/providers/auto with { "order": ["e2b", "cloudflare"] } sets it for every create after it: each provider at most once, [] leaving such a sandbox nowhere to run. A provider the order leaves out is never used for it, and one whose key you haven't connected is passed over until you do. Only an owner's key sets it (403 otherwise), and a body is at most 16 KiB. In the console, it's Settings → Auto order.
Provider accounts
A provider account is a SandboxProviderConfig: one account of yours at a provider, by its key. Once the provider takes the key, your namespace has the account's own pool, and a sandbox's spec.placement.selector can name the account with topology.sandboxrouter.io/account. That provider bills you directly for what runs there. In the console, connect one under Settings → Providers, with Connect key; with the CLI, sandboxrouter provider-configs connect (Providers).
{
"apiVersion": "sandboxrouter.io/v1", "kind": "SandboxProviderConfig",
"metadata": { "name": "e2b-team-a", "namespace": "acme" },
"spec": { "provider": "e2b" },
"status": { "phase": "Ready", "connectedAt": "2026-11-11T09:00:00.000Z" }
}| Route | Scope | What it does |
|---|---|---|
GET /v1/namespaces/<namespace>/sandboxproviderconfigs | sandbox:read | Lists your accounts, every one at once, by name, those being removed among them |
GET …/sandboxproviderconfigs/<name> | sandbox:read | Reads one; a name no account has answers 404 |
PUT …/sandboxproviderconfigs/<name> | sandbox:write, owner | Connects the account's key, or replaces the one it holds |
DELETE …/sandboxproviderconfigs/<name> | sandbox:write, owner | Deletes the account's sandboxes and removes it |
metadata.nameis a name of your own for the account, 1 to 63 lowercase letters, digits and-. A name that is a provider's (e2b) is that provider's account.spec.providerisdaytona,e2b,freestyleormaritime; Native runs on Sandbox Router's own account and takes no key. It can't change once the account is connected.A read never shows the key: Sandbox Router doesn't keep, log or record it.
status.connectedAtis when the key it holds was connected, andstatus.phasewhere the key stands:
phase | What it means |
|---|---|
Verifying | The provider hasn't answered its check yet; it goes on by itself |
Ready | The provider took the key, and sandboxes can run on the account |
Refused | The provider refused it: status.error is { code, message }, code one of invalid_key, forbidden, rate_limited, unavailable and invalid_account, message the provider's words. A check the provider couldn't answer is tried again up to 8 times first |
Removing | Its removal has started and isn't done yet |
Connect a key
{ "apiVersion": "sandboxrouter.io/v1", "kind": "SandboxProviderConfig", "metadata": { "name": "e2b-team-a" },
"spec": { "provider": "e2b", "credentials": { "apiKey": "e2b_…", "domain": "e2b.app" } } }spec.credentials takes exactly the provider's fields:
| Provider | credentials |
|---|---|
| Daytona | apiKey, and optionally apiUrl, its API's public https:// URL, and target, its target region: a letter or digit, then up to 127 letters, digits, ., _ and - |
| E2B | apiKey, a project's e2b_… key, and optionally domain, the domain of its region's deployment (e2b.app without it) |
| Freestyle, Maritime | apiKey |
An apiKey is 8 to 4,096 printable characters without spaces. spec.provider names a new account's provider, and may be left out for an account that has one or a name that is a provider's. apiVersion, kind, metadata.name and metadata.namespace may be given, and must be the API's, SandboxProviderConfig, the path's name and the path's namespace. A refusal names its field (spec.credentials.apiKey) and never echoes the key. A body over 17,791 bytes is refused 413.
The key is checked with the provider at once. The request waits up to 20 seconds for it and answers 200 with the account, Ready or Refused; while the check still runs, it answers 202, Verifying: read the account again to see where it stands. A new key replaces the one there, and sandboxes on the account use it from their next operation. On Daytona and E2B, connecting a key also registers the provider's webhook, so what the provider does to your sandboxes shows at once.
It's refused:
| Status | When |
|---|---|
400, naming spec.provider | A provider Sandbox Router doesn't offer now |
403 | A key whose creator isn't an owner, or a suspended workspace (tenant_suspended) |
409 Conflict | A second account of a provider your workspace has one of (a workspace connects one account of each provider), or an account whose key is being removed |
422 Invalid | spec.provider naming Native, no provider, or a provider other than the account's; credentials out of the rules above |
Remove an account
DELETE …/sandboxproviderconfigs/<name> deletes your sandboxes on the account, stopped ones too, while the key still reaches the provider, then removes the provider's webhook and the key. It answers 200 with a Status of success once it's done, { "apiVersion": "sandboxrouter.io/v1", "kind": "Status", "status": "Success", "code": 200, "details": { "kind": "SandboxProviderConfig", "name": "e2b-team-a" } }, or 202 with the account, Removing, while it goes on by itself. Once it's gone, a new key can be connected at once. An account you don't have answers 404.
Reading accounts needs sandbox:read, as viewers' keys have. Connecting and removing one need sandbox:write and an owner, checked at once, as a key decides whose account sandboxes run and are billed on. The audit log records each change as provider.key.set or provider.key.delete, never the key.
MCP servers
| Route | Scope | What it does |
|---|---|---|
POST /v1/mcp-servers | mcp:write, sandbox:write | Creates a server, in a new sandbox or one you have |
GET /v1/mcp-servers | mcp:read | Lists servers: { mcpServers, nextCursor } |
GET /v1/mcp-servers/<server> | mcp:read | Reads one |
PATCH /v1/mcp-servers/<server> | mcp:write, sandbox:write | Renames it, or changes its port and path |
DELETE /v1/mcp-servers/<server> | mcp:write; sandbox:write too when it deletes the server's sandbox | Deletes it, and the sandbox its create made unless ?keepSandbox=true |
GET /v1/mcp-servers/<server>/tokens | mcp:read | Lists its client tokens, never a secret |
POST /v1/mcp-servers/<server>/tokens | mcp:write | Mints a token: { "label", "expiresAt", "allowedTools" }; the answer has its secret, once |
DELETE /v1/mcp-servers/<server>/tokens/<token-id> | mcp:write | Revokes a token |
GET /v1/mcp-servers/<server>/traces | mcp:read | Its newest 100 requests |
GET /v1/mcp-servers/<server>/stats | mcp:read | Its gateway's last 24 hours |
curl https://api.sandboxrouter.io/v1/mcp-servers \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "search-mcp",
"sandbox": { "image": "registry.caas.sh/<tenant-id>/search-mcp@sha256:…", "egress": ["api.search.example.com"] },
"transport": { "http": { "port": 8080 } },
"tokens": [{ "label": "laptop-claude", "allowedTools": ["search.query"] }]
}'| Field | Value |
|---|---|
name | Required. 1 to 63 lowercase letters, digits and hyphens, unique among the workspace's servers |
sandbox | A new sandbox: { "image", "command", "env", "size", "egress", "idleStopMinutes", "labels", "provider", "user", "connectors" }, each optional; see MCP servers |
sandboxId | Instead of sandbox: an existing sandbox, by its uid or name. It hosts at most one server. |
transport | { "http": { "port": 3000, "path": "/mcp" } }: the port the sandbox's server serves MCP over HTTP on, and its path (/mcp by default) |
tokens | The client tokens to mint, up to 20; one Initial client token without it |
The answer, 201, is the server: its id, its endpoint url (https://mcp.sandboxrouter.io/<id>), the sandboxId it runs in, transport, state, stats, and tokens, each minted token with its secret. See MCP servers for the endpoint, tokens and traces.
Connectors
| Route | Scope | What it does |
|---|---|---|
GET /v1/connector-catalog | sandbox:read | Lists the catalog's tools, each with available, reason and added |
POST /v1/connectors/discover | sandbox:write, owner | Says how an MCP server's users would connect: { "mcpUrl" }. Nothing is kept. |
POST /v1/connectors | sandbox:write, owner | Adds a connector: { "catalog" }, { "mcpUrl", "auth"?, "app"? } or { "api": { "hosts" }, "app"? }, with id, name, selector, envVar and, for GitHub, githubApp optional |
GET /v1/connectors, GET /v1/connectors/<id> | sandbox:read | Lists connectors, or reads one, with its workspace account |
PATCH /v1/connectors/<id> | sandbox:write, owner | Changes its name, selector, envVar, app or githubApp |
DELETE /v1/connectors/<id> | sandbox:write, owner | Removes it with its workspace account and its users' connections |
POST /v1/connectors/<id>/account | sandbox:write, owner | Connects its workspace account: { "method": "key", "key" }, or sign_in or install, whose next step is in action, or device, whose code is in signIn |
POST /v1/connectors/<id>/account/callback | sandbox:write, owner | Finishes a sign-in that came back to the console: { "session", "confirm" } |
DELETE /v1/connectors/<id>/account | sandbox:write, owner | Disconnects its workspace account |
GET /v1/connectors/<id>/connections | sandbox:read | Its users' connections: { connections, next } |
GET /v1/users | sandbox:read | Your users, with their connections' statuses, their logins and this month's usage: { users, next } |
GET /v1/users/<user>, DELETE /v1/users/<user> | sandbox:read, sandbox:write | Reads a user with their connections, or removes them with their connections, logins and usage |
GET /v1/users/<user>/usage | sandbox:read | Their sandbox time and browser time per UTC day: ?from= and ?to=, YYYY-MM-DD |
POST /v1/users/<user>/connections | sandbox:write | A connect link: { "connector", "returnUrl"? }, or the user's key: { "connector", "key" } |
POST /v1/users/<user>/connections/<connector>/sign-in | sandbox:write | The user's code for Codex (ChatGPT): { connection, signIn }, the code under way while it still works, else a new one; for a user who's signed in, a sign-in again |
GET /v1/users/<user>/connections/<connector>, DELETE … | sandbox:read, sandbox:write | Reads one connection, with its code's signIn, or disconnects the user |
GET, POST /v1/users/<user>/logins, GET, PATCH, DELETE …/logins/<login> | sandbox:read, sandbox:write | The user's logins: list ({ logins, nextCursor }), add, read, change and remove one |
…/logins/<login>/passkeys/<passkey>, …/session, …/live, …/live/done, …/check | sandbox:read, sandbox:write | Rename or remove a passkey; read, upload or remove a saved sign-in; open, finish or end a live view; check whether the site is still signed in |
POST /v1/users/<user>/logins/<login>/link, POST /v1/users/<user>/logins/link | sandbox:write | A link for the user to sign in to a site: { login, connectUrl } |
/v1/connectors/<id>/account/logins… | sandbox:read; changes an owner | Your workspace's logins, with the same routes as a user's but the link |
<user> is your ID for the user, URL-encoded: user_123, or auth0%7Cabc for auth0|abc. The two lists take ?limit= (1 to 100, 50 by default) and ?after=, from the answer's next.
curl https://api.sandboxrouter.io/v1/users/user_123/connections \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "connector": "linear", "returnUrl": "https://app.acme.com/settings" }'The answer's connectUrl is the link to send the user. A sandbox created with "user": "user_123" then uses their accounts for the connectors its create names, and their logins in its browsers (see Logins). Codex (ChatGPT)'s users sign in with a code instead, from POST /v1/users/<user>/connections/<connector>/sign-in, made before a sandbox of theirs needs it; see Sign users in with a code.
curl https://api.sandboxrouter.io/v1/connectors \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "catalog": "openai" }'
curl https://api.sandboxrouter.io/v1/connectors/openai/account \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "method": "key", "key": "sk-..." }'A sandbox gets a connector when its create names it ("connectors": ["openai"]). Sandboxes without a user then use the workspace's account. A connector's selector picks the workflows' sandboxes it reaches by their labels ({}, every one). See Connectors.
Billing
Billing routes need a key with Billing access, which only an owner can create. They work while the workspace is suspended.
| Route | Scope | What it does |
|---|---|---|
GET /v1/billing/balance | billing:read | { balanceMicroUsd, autoRecharge, card, topUps, entries, nextCursor }: the balance, auto-recharge, the card on file, recent top-ups with their receipts, and the balance's history, 60 entries a page |
GET /v1/billing/usage | billing:read | A month's usage report: ?month=2026-10, the current UTC month by default. Add &format=csv for the month as a CSV file. |
GET /v1/billing/auto-recharge | billing:read | { enabled, minimumMicroUsd, targetMicroUsd, active, failure } |
PUT /v1/billing/auto-recharge | billing:write | Changes any of enabled, minimumMicroUsd ($5 to $1,000) and targetMicroUsd (at least $5 more, up to $2,000) |
POST /v1/billing/top-ups | billing:write | Adds funds, { "amountMicroUsd": 25000000 } ($5 to $2,000 of credits, in whole cents), with a required idempotency key. The card is charged the credits; the top-up's feeMicroUsd is 0 (only a top-up made from October 20, 2026 until the fee's removal can carry a fee) |
curl "https://api.sandboxrouter.io/v1/billing/usage?month=2026-10" \
-H "Authorization: Bearer $SANDBOXROUTER_API_KEY"The usage report has a lines entry for each meter, with its quantity, unit and amountMicroUsd, the month's totalMicroUsd, a total for each UTC day in daily, and, while the month is under way, a projection for the whole month. The CSV has one row per UTC day and meter: day,meter,quantity,unit,rate_usd,amount_usd.
Adding funds charges the card on file and answers { "topUp": { … }, "url": null }; the balance goes up once the payment is confirmed. Without a card, or with "checkout": true, url is a Stripe Checkout page to finish the payment in. A declined card gets 402 with the failed topUp. See Billing and usage, and pricing for the rates.
Settings and the audit log
| Route | Scope | What it does |
|---|---|---|
GET /v1/settings | sandbox:read | { "timeZone": "UTC" } |
PATCH /v1/settings | sandbox:write | Sets the time zone, as an IANA name: { "timeZone": "Europe/Berlin" } |
GET /v1/audit-log | sandbox:read | The audit log, newest first: { records, nextCursor, retentionDays } |
GET /v1/audit-log takes these filters, each at most once:
| Parameter | Value |
|---|---|
action | An action, such as sandbox.stop, or a group, such as sandbox, command or mcp_server |
actor | A user's or API key's ID, a sandbox's ID (what its AI did), one of your users' IDs (what they did through a link), operator or system |
target | An ID, such as a sandbox's |
outcome | success or failure |
since, until | Times in milliseconds since the Unix epoch |
limit | 1 to 100 records; 50 by default |
cursor | The previous page's nextCursor |
Each record has its time (at), actor, action, target, outcome, HTTP status, requestId and a short detail, never a secret, a token or a command's text. Records are kept for 365 days. An API key never sees records about API keys, members or invitations, sees billing records only with billing:read, and sees a user who made a change by ID, without their email.