DOCSThe API
DOCS

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

  1. In the console, open Settings.

  2. 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.

  3. 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:

shell
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.

ScopeWhat it allows
sandbox:readRead sandboxes, their execs, logs, metrics and snapshots; connectors, your users and their usage; the workspace's settings and audit log
sandbox:writeCreate, 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:executeRun and cancel execs; read, write and delete files
mcp:readRead MCP servers, their client tokens, traces and stats
mcp:writeCreate, 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:readPull images and list tags at registry.caas.sh
registry:writePush and delete images at registry.caas.sh, and pull them
billing:readRead the balance, usage and auto-recharge, and see billing records in the audit log
billing:writeAdd funds and change auto-recharge

Roles

A key can do what its scopes allow, within the role its creator has in the workspace now:

RoleScopes the role allows
OwnerAll of them
OperatorAll but billing:read and billing:write
Viewersandbox: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 gets 413. An unknown field is refused, naming it.

  • Sandboxes, snapshots, images, pools, providers and provider accounts are sandboxrouter.io/v1 objects: { apiVersion, kind, metadata, spec, status }, what you set in spec and what Sandbox Router and the provider report in status. 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/v1 objects answers { "apiVersion", "kind": "<Kind>List", "metadata": { "continue" }, "items": [...] }. A paged one (sandboxes, snapshots) takes ?continue=: pass metadata.continue back for the next page, until it is absent. A page can hold fewer items than its limit with more to come, so page until continue is absent, never by count. ?labelSelector= keeps the objects whose labels match: key=value or key==value, comma-joined, each to match; !=, in, notin, exists and !key are refused, naming labelSelector. Any other list answers { "<resource>": [...] }, and a paged one its nextCursor beside it: pass it back as ?cursor= for the next page. It's null on the last page.

  • A sandboxrouter.io/v1 route refuses a query parameter it doesn't take, or one given twice, naming it.

  • Deleting a sandbox answers 202 with it, its metadata.deletionTimestamp set. Deleting an MCP server answers { "id": "…", "deleted": true, "sandboxDeleted" }, whether its sandbox went with it; a connector's adds how many users' connections and whether an account went 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:

json
{ "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:

json
{ "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.

codeStatusMeaning
invalid_request400A field, query or header the API refuses, or a body that isn't JSON
unauthorized401No API key, or one that's unknown or revoked
payment_method_required, out_of_funds, spend_cap_reached402The 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
forbidden403The key's scopes or its creator's role don't allow the request
tenant_suspended403The workspace is suspended. Billing still works, so an owner can pay.
not_found404No such route, sandbox, server, exec, file, snapshot or connector
method_not_allowed405The route doesn't take this method; the Allow header lists the ones it does
conflict409The request conflicts with the resource's state, or an idempotency key was reused with another body
name_taken409The name belongs to another server or schedule
not_running409An exec, a file transfer or another call that needs the sandbox running, for one that doesn't run
provider_not_connected400, 422A provider that runs only on your own account, which your workspace hasn't connected
provider_feature_unavailable409; 422 on a sandboxrouter.io/v1 routeWhat 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_unavailable503The 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_provisioning503Your workspace's sandboxes are still being set up. Try again shortly.
too_large413The body is too large
unsupported_media_type415A body whose Content-Type the route doesn't take
rate_limited429A rate limit was reached; see Rate limits
unavailable502, 503A 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

RequestsLimit
To the API, from one client address6,000 a minute
To the API, with one API key6,000 a minute
To one MCP endpoint, with a valid client token1,200 a minute
To the MCP gateway without a valid client token, from one client address600 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.

RequestA repeat with the same keyWith another body
POST /v1/namespaces/<namespace>/sandboxes:run, POST …/sandboxes200 with the same sandbox409
POST …/sandboxes/<sandbox>/execThat exec, as it now stands409
POST /v1/namespaces/<namespace>/sandboxsnapshots200 with the same snapshot, as it now stands409
POST /v1/mcp-servers200 with the server, without its tokens' secrets409
POST /v1/billing/top-ups (required)The same top-up409

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

RouteScopeWhat it does
POST /v1/namespaces/<namespace>/sandboxes:runsandbox:writeRuns a sandbox, holding until it runs; see Run or create a sandbox
POST /v1/namespaces/<namespace>/sandboxessandbox:writeCreates a sandbox, answering at once
GET /v1/namespaces/<namespace>/sandboxessandbox:readLists sandboxes; see Read and list sandboxes
GET …/sandboxes/<sandbox>sandbox:readReads one
PATCH …/sandboxes/<sandbox>sandbox:writeChanges its labels, outbound access, idle timeout or state; see Change a sandbox
DELETE …/sandboxes/<sandbox>sandbox:writeDeletes it; see Delete a sandbox
POST …/execsandbox:executeRuns a command; see Execs
GET …/execsandbox:readLists the execs that run
GET …/exec/<exec-id>sandbox:readReads an exec
DELETE …/exec/<exec-id>sandbox:executeCancels a running exec
GET …/logssandbox:readIts log; see Logs
GET …/metricssandbox:readIts CPU, memory and disk over time, as its provider measured them; see Metrics
GET, PUT, DELETE …/files/<path>sandbox:executeIts files; see Files
GET …/ports/<port>sandbox:executeIts 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

shell
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:

json
{
  "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.

  • :run holds until the sandbox runs and answers 201 Created with it. A sandbox that failed answers 201 too, with status.phase Failed and why on its Ready condition. 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 …/sandboxes makes the same create and answers at once, 201 with the sandbox Pending: its Ready condition False with Provisioning, and no status.provider or status.resources yet. Its metadata.uid is its own from then on. Read it by that uid with ?waitMs= to see it run, or fail.

  • A repeat with the same Idempotency-Key and body answers 200 with the same sandbox, as it then stands; a :run and a create of one body under one key are one create. The key with another body is refused 409 Conflict, 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 one Idempotency-Key. A name is 1 to 63 lowercase letters, digits and -, never of a uid's form (u-… or s-…). 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 its metadata.uid; to create exactly once, send an Idempotency-Key.

  • Placement. A sandbox whose spec.placement.selector names 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:

shell
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:

Statusreason or details.codeWhen
400Invalid, at spec.from.imageRef.refThe image's tag or digest isn't in your registry, or the image is another workspace's
400Invalid, 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
400provider_not_connected, at spec.placement.selectorA provider that runs only on your own account, which your workspace hasn't connected
402payment_method_required, out_of_funds, spend_cap_reachedThe workspace can't run sandboxes now; see Errors
422InvalidA field it doesn't take, or a value out of its rules, named. A sandbox on your own image needs size m or larger
422UnschedulableNowhere 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)
422UnsupportedIts provider doesn't offer what it asks, such as limiting a destination to ports, the capability named in message
503ProviderError, provider_unavailableEvery 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:

FieldWhat it counts
wallMsIts running time
vcpuMs, memoryGibMs, diskGibMsIts allocation over that time: a vCPU, a GiB of memory or a GiB of disk for a millisecond
egressBytesThe bytes it sent out on its own network, where its provider meters them
proxyEgressBytesThe 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 to null is removed, and "labels": null removes all of yours. Labels count up to 16 with the ones Sandbox Router keeps on the sandbox, so a sandbox created with an Idempotency-Key and a user has room for 12 of yours. On Freestyle, a value is at most 63 characters.

  • spec.lifecycle.idleTimeout: whole minutes from 5m to 4h. null is refused.

  • spec.network.egress, merged into the sandbox's: mode and allow are each replaced where the patch names them, and allow is 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 to none or a list, nor one created with none or a list to every destination (422, naming spec.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 (422 Unsupported, egress.live): stop it, change it, and start it, the change and the start in one patch if you like.

  • spec.state: Running starts it and Stopped stops it, answering at once while it settles, with spec.state the new state and status.phase Pending while it starts, or Stopped once it is stopping. Read it with ?waitMs= to wait until it has settled. Paused is refused 422 Unsupported. A start needs the workspace's funds (402). A failed sandbox reads Stopped, and Running starts 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

shell
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 }'
FieldValue
commandRequired. 1 to 32 arguments of up to 512 characters; no shell is added
stdinText sent to the command, up to 64 KiB
envVariables 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
workdirIts 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
timeoutSeconds1 to 7,200, or up to 86,400 when detached; without it, no time limit
detachtrue 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:

json
{ "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 422 Invalid, naming it. A body over 2,120,452 bytes is refused 413.

  • The same Idempotency-Key and body again answers that exec as it now stands, never running it twice; the key with another body is refused 409.

  • A sandbox that doesn't run is refused 409 not_running: nothing starts it.

  • A provider that can't take the exec's stdin, env, workdir or time limit refuses it 422 Unsupported, naming exec.stdin, exec.env, exec.cwd or exec.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

RouteWhat 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.

AnswerWhen
400 Invalid, naming pathA path out of these rules
404A sandbox the namespace doesn't have, or a file the sandbox doesn't have; the message says which
409 ConflictA name two sandboxes have: name the sandbox by its uid
409 not_runningA sandbox that doesn't run. A file isn't a reason to start it
422 UnsupportedAn 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.

json
{
  "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" } }
}
FieldWhat it is
metadata.nameIts name: yours, or <namespace>-xxxxx where you give none
metadata.uidIts uid: s-, 52 characters, - and a number. No name takes this form
metadata.labelsYour labels, and sandboxrouter.io/sandbox-uid, its sandbox's uid, which you don't set
metadata.creationTimestampWhen it was taken
metadata.deletionTimestampWhen you deleted it, while its provider removes it
spec.sandboxRef.nameThe sandbox it's of, by its uid
spec.includeMemoryWhether it kept the sandbox's memory and processes, or its disk alone
status.providerThe provider that holds it: its sandbox's
status.accountThe account it's on: sandboxrouter (Native) or own (your account at the provider). A restore stays there
status.refThe provider's own ID for it
status.stateIts 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.messageWhy it's Failed or Expired, in its provider's words
status.expiresAtWhen its provider ends it on its own, where it does; a restore may move it
status.bytesIts size at the provider, where the provider says
status.resourcesThe size it restores at, as its provider says
RouteScopeWhat it does
POST /v1/namespaces/<namespace>/sandboxsnapshotssandbox:writeTakes a snapshot, answering 201 with it at once; see Take a snapshot
GET /v1/namespaces/<namespace>/sandboxsnapshotssandbox:readLists the namespace's snapshots; see Read, list and delete snapshots
GET …/sandboxsnapshots/<snapshot>sandbox:readReads one, by its name or uid
DELETE …/sandboxsnapshots/<snapshot>sandbox:writeDeletes 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

json
{ "apiVersion": "sandboxrouter.io/v1", "kind": "SandboxSnapshot", "metadata": { "name": "build-agent-nightly", "labels": { "team": "web" } },
  "spec": { "sandboxRef": { "name": "build-agent" } } }
  • spec.sandboxRef.name names the sandbox by its name or uid. The sandbox must run: one that doesn't is refused 409 not_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 refused 422 Invalid, naming spec.sandboxRef.name, and a name two sandboxes have 409 Conflict, naming both uids.

  • metadata.name is optional. Without it, the snapshot is named <namespace>-xxxxx, the same name for each repeat of one Idempotency-Key. A name is 1 to 63 lowercase letters, digits and -, never of a uid's form (u-… or s-…). A name another snapshot of the namespace has is refused 409 AlreadyExists (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 answers 409 Conflict, naming both uids.

  • metadata.labels take 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 an Idempotency-Key, so a snapshot has room for 13 of yours, or 12.

  • spec.includeMemory: true keeps the sandbox's memory and processes, false its 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 refused 422 Unsupported, in the provider's words: true where they keep no memory, and false where every one keeps it, naming spec.includeMemory; either where the provider takes none, naming spec.sandboxRef.

  • It answers 201 at once with the snapshot: Pending while its provider still makes it, else Ready, or Failed with why in status.message. Read it again to see a Pending one become Ready; only then does it restore.

  • The same Idempotency-Key and body again answers 200 with the same snapshot, as it now stands, never taking it twice; the key with another body is refused 409 Conflict. A key counts per sandbox, but the name it generates is the namespace's: the key again on another sandbox, without metadata.name, is refused 409 AlreadyExists.

  • apiVersion and kind, when given, are sandboxrouter.io/v1 and SandboxSnapshot, 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 56,898 bytes 413.

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 422 Unsupported, naming spec.placement.selector.

  • Without spec.resources.size, it boots at the snapshot's own size, its status.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 as spec.resources.sizeMatch asks, roundUp (the default) covering it and exact equal to it, else 422 Unschedulable, naming spec.resources.sizeMatch. So is a size asked of a snapshot whose provider hasn't said its whole size.

  • A Ready snapshot boots, and an Inactive one is renewed by its provider first, then boots. A Pending one, or one being deleted, is refused 409 Conflict; a Failed or Expired one 422 Invalid, naming spec.from.snapshotRef.name. A restore of a Native snapshot moves its status.expiresAt.

  • A snapshot the namespace doesn't have is refused 422 Invalid, naming spec.from.snapshotRef.name, and a name two snapshots have 409 Conflict. 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.

json
{
  "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: …" } ] }
}
RouteScopeWhat it does
POST /v1/namespaces/<namespace>/sandboximagessandbox:writeMakes an image, answering 201 with it
GET /v1/namespaces/<namespace>/sandboximagessandbox:readLists the namespace's images: a SandboxImageList, every one at once, by name. It takes ?labelSelector= alone
GET …/sandboximages/<name>sandbox:readReads one; a name the namespace has none of answers 404
DELETE …/sandboximages/<name>sandbox:writeRemoves 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

FieldValue
metadata.nameRequired: 1 to 63 lowercase letters, digits and -, unique in the namespace, never of a uid's form
metadata.labelsAs a sandbox's: up to 16, values up to 256 characters
spec.source.imageAn 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.providerRefAn 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:

stateWhat it means
ReadyA sandbox naming the image can boot it there
UnsupportedIt can't, and message says why: a sandbox naming the image is never placed there
Pending, BuildingA Dockerfile's build there is under way
FailedA 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):

providerrefIts size
daytonaA snapshot's nameThe snapshot's own
e2bA 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
maritimeA 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.

RouteScopeWhat it does
GET /v1/sandboxproviders, GET /v1/sandboxproviders/<name>sandbox:readThe providers
GET /v1/sandboxpools, GET /v1/sandboxpools/<name>sandbox:readSandbox Router's own pools: cloudflare, Native
GET /v1/namespaces/<namespace>/sandboxpools, GET …/sandboxpools/<name>sandbox:readYour namespace's own pools, each named by its account
GET /v1/providerssandbox:readEach provider's place in your workspace; see The providers in your workspace
GET /v1/providers/auto, PUT /v1/providers/autosandbox:read; sandbox:write and owner to changeYour workspace's Auto order; see The Auto order
json
{ "apiVersion": "sandboxrouter.io/v1", "kind": "SandboxProvider", "metadata": { "name": "e2b" }, "spec": { "displayName": "E2B" } }
json
{
  "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.labels are topology.sandboxrouter.io/provider, and on your own pool topology.sandboxrouter.io/account: the labels a sandbox's spec.placement.selector names. metadata.namespace is on your own pools alone.

  • spec.sizing.sizes are the sizes the provider takes (Freestyle and Maritime stop at xl), each as the pool asks the provider for it; the provider may give more, which a sandbox's status.resources shows. defaultSize is 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 answers 404.

The providers in your workspace

GET /v1/providers answers { "providers": [...] }, one entry for each provider:

FieldWhat it says
id, nameThe provider, as spec.placement.selector names it, and its name
statusavailable; 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
accountown once you connected a key; sandboxrouter for Native; else null
byokWhether you can connect your own key
keyConnectedAtWhen your key was connected, or null
sizesThe 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
customIts custom size's bounds, or null
featuresWhat it offers here: ownImage, ports, egressHosts, connectors, mcpServers, workflows and env
ratesWhat Sandbox Router bills there, in micro-USD; see pricing
autoPositionIts 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).

json
{
  "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" }
}
RouteScopeWhat it does
GET /v1/namespaces/<namespace>/sandboxproviderconfigssandbox:readLists your accounts, every one at once, by name, those being removed among them
GET …/sandboxproviderconfigs/<name>sandbox:readReads one; a name no account has answers 404
PUT …/sandboxproviderconfigs/<name>sandbox:write, ownerConnects the account's key, or replaces the one it holds
DELETE …/sandboxproviderconfigs/<name>sandbox:write, ownerDeletes the account's sandboxes and removes it
  • metadata.name is 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.provider is daytona, e2b, freestyle or maritime; 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.connectedAt is when the key it holds was connected, and status.phase where the key stands:

phaseWhat it means
VerifyingThe provider hasn't answered its check yet; it goes on by itself
ReadyThe provider took the key, and sandboxes can run on the account
RefusedThe 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
RemovingIts removal has started and isn't done yet

Connect a key

json
{ "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:

Providercredentials
DaytonaapiKey, 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 -
E2BapiKey, a project's e2b_… key, and optionally domain, the domain of its region's deployment (e2b.app without it)
Freestyle, MaritimeapiKey

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:

StatusWhen
400, naming spec.providerA provider Sandbox Router doesn't offer now
403A key whose creator isn't an owner, or a suspended workspace (tenant_suspended)
409 ConflictA 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 Invalidspec.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

RouteScopeWhat it does
POST /v1/mcp-serversmcp:write, sandbox:writeCreates a server, in a new sandbox or one you have
GET /v1/mcp-serversmcp:readLists servers: { mcpServers, nextCursor }
GET /v1/mcp-servers/<server>mcp:readReads one
PATCH /v1/mcp-servers/<server>mcp:write, sandbox:writeRenames it, or changes its port and path
DELETE /v1/mcp-servers/<server>mcp:write; sandbox:write too when it deletes the server's sandboxDeletes it, and the sandbox its create made unless ?keepSandbox=true
GET /v1/mcp-servers/<server>/tokensmcp:readLists its client tokens, never a secret
POST /v1/mcp-servers/<server>/tokensmcp:writeMints a token: { "label", "expiresAt", "allowedTools" }; the answer has its secret, once
DELETE /v1/mcp-servers/<server>/tokens/<token-id>mcp:writeRevokes a token
GET /v1/mcp-servers/<server>/tracesmcp:readIts newest 100 requests
GET /v1/mcp-servers/<server>/statsmcp:readIts gateway's last 24 hours
shell
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"] }]
  }'
FieldValue
nameRequired. 1 to 63 lowercase letters, digits and hyphens, unique among the workspace's servers
sandboxA new sandbox: { "image", "command", "env", "size", "egress", "idleStopMinutes", "labels", "provider", "user", "connectors" }, each optional; see MCP servers
sandboxIdInstead 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)
tokensThe 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

RouteScopeWhat it does
GET /v1/connector-catalogsandbox:readLists the catalog's tools, each with available, reason and added
POST /v1/connectors/discoversandbox:write, ownerSays how an MCP server's users would connect: { "mcpUrl" }. Nothing is kept.
POST /v1/connectorssandbox:write, ownerAdds 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:readLists connectors, or reads one, with its workspace account
PATCH /v1/connectors/<id>sandbox:write, ownerChanges its name, selector, envVar, app or githubApp
DELETE /v1/connectors/<id>sandbox:write, ownerRemoves it with its workspace account and its users' connections
POST /v1/connectors/<id>/accountsandbox:write, ownerConnects 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/callbacksandbox:write, ownerFinishes a sign-in that came back to the console: { "session", "confirm" }
DELETE /v1/connectors/<id>/accountsandbox:write, ownerDisconnects its workspace account
GET /v1/connectors/<id>/connectionssandbox:readIts users' connections: { connections, next }
GET /v1/userssandbox:readYour 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:writeReads a user with their connections, or removes them with their connections, logins and usage
GET /v1/users/<user>/usagesandbox:readTheir sandbox time and browser time per UTC day: ?from= and ?to=, YYYY-MM-DD
POST /v1/users/<user>/connectionssandbox:writeA connect link: { "connector", "returnUrl"? }, or the user's key: { "connector", "key" }
POST /v1/users/<user>/connections/<connector>/sign-insandbox:writeThe 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:writeReads 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:writeThe user's logins: list ({ logins, nextCursor }), add, read, change and remove one
…/logins/<login>/passkeys/<passkey>, …/session, …/live, …/live/done, …/checksandbox:read, sandbox:writeRename 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/linksandbox:writeA link for the user to sign in to a site: { login, connectUrl }
/v1/connectors/<id>/account/logins…sandbox:read; changes an ownerYour 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.

shell
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.

shell
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.

RouteScopeWhat it does
GET /v1/billing/balancebilling: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/usagebilling:readA 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-rechargebilling:read{ enabled, minimumMicroUsd, targetMicroUsd, active, failure }
PUT /v1/billing/auto-rechargebilling:writeChanges any of enabled, minimumMicroUsd ($5 to $1,000) and targetMicroUsd (at least $5 more, up to $2,000)
POST /v1/billing/top-upsbilling:writeAdds 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)
shell
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

RouteScopeWhat it does
GET /v1/settingssandbox:read{ "timeZone": "UTC" }
PATCH /v1/settingssandbox:writeSets the time zone, as an IANA name: { "timeZone": "Europe/Berlin" }
GET /v1/audit-logsandbox:readThe audit log, newest first: { records, nextCursor, retentionDays }

GET /v1/audit-log takes these filters, each at most once:

ParameterValue
actionAn action, such as sandbox.stop, or a group, such as sandbox, command or mcp_server
actorA 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
targetAn ID, such as a sandbox's
outcomesuccess or failure
since, untilTimes in milliseconds since the Unix epoch
limit1 to 100 records; 50 by default
cursorThe 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.