REST API reference
The SDKs and the CLI call this HTTP API. Call it directly from any language, or when an SDK has no method for what you need.
Base URL and authentication
Every route is on https://sandbox.tangle.tools. Send your account API key as a bearer token:
Authorization: Bearer sk-tan-...Create a key at id.tangle.tools/app/keys. Keep it on a server; for browsers, mint a scoped token as shown in Authentication.
A first request
Create a sandbox, run a command in it, and delete it:
API=https://sandbox.tangle.tools
AUTH="Authorization: Bearer $TANGLE_API_KEY"
SANDBOX_ID=$(curl -s -X POST "$API/v1/sandboxes" -H "$AUTH" \
-H "Content-Type: application/json" -d '{"name": "api-demo"}' | jq -r .id)
# Create usually answers with a running sandbox; a provisioning one is polled until it runs.
until [ "$(curl -s "$API/v1/sandboxes/$SANDBOX_ID" -H "$AUTH" | jq -r .status)" = running ]; do sleep 2; done
curl -s -X POST "$API/v1/sandboxes/$SANDBOX_ID/runtime/process/spawn" -H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"executable": "uname", "args": ["-a"], "blocking": true}' | jq .data.stdout
curl -s -X DELETE "$API/v1/sandboxes/$SANDBOX_ID" -H "$AUTH"client.fetch does not raise on an error status; check status_code. The TypeScript SDK’s client.create() and box.exec() make the same calls; see the Quickstart.
Route groups
| Page | Covers |
|---|---|
| Sandboxes and GPU | Create, list, read, stop, resume, snapshot, branch and delete sandboxes; egress rules, events and GPU leases. |
| In-sandbox runtime | Commands, processes, code kernels, files, git, terminals, ports, preview links and coding-agent runs inside one sandbox. |
| Sessions and backends | Coding-agent sessions, plans, the coding agents and models your key can use, and intelligence reports. |
| Fleets, templates and teams | Fleets, templates, images, instances, secrets, SSH keys, startup scripts, lines and teams. |
| Account, usage and pricing | Your account, usage, egress, billing, public prices, notifications, sign-in and service health. |
| E2B-compatible routes | E2B’s REST shape under /e2b, for code written against E2B’s API. |
OpenAPI document
The full API, with every request and response schema, is in one OpenAPI 3 document: /sandbox-openapi.json. Load it into an API client such as Postman or Insomnia, or generate a client from it.
Requests and responses
- Bodies are JSON unless a route says otherwise. Send
Content-Type: application/json. - An error answers with a JSON body whose
codenames it. Branch oncode; see Error codes. - To retry a create safely, send an
Idempotency-Keyheader and reuse it; see Retry the right errors. - Responses carry
X-RateLimit-*headers; the limits are on Limits and timeouts.
Next steps
- Sandboxes and GPU routes: the routes most programs start with.
- In-sandbox runtime routes: run commands and read files over HTTP.
- Error codes: every error code and what to do about it.