Overview

The Sandbox API provides VM-based code execution with configurable resources, network access, and toolchains. Sandboxes run on infrastructure you control. For organization-scoped templates and long-lived instances, see Cloud Sandboxes.

Base URL

Local development:

Endpoints

Get capabilities

Response:

Execute code

Request body: Response:

Files in and out

Pass files to stage uploads (from POST /api/v1/uploads) into the sandbox working folder as in/<name>. Whatever the code writes to out/ comes back in the response as files, each stored as an upload you can fetch with GET /api/v1/uploads/:id.
Response (extra field):
Each output file has size (bytes stored) and url (where to fetch it). Downloads use the protective headers listed in Uploads API. files is left out of the response when the request staged no files. Input and output are each limited to 20 MB in total. A file name must not be empty or contain /, \, quotes or control characters. files needs the VM sandbox: the plain-subprocess fallback used when no VM driver is configured refuses it, and /sandbox/execute/stream rejects it with 400 files_unsupported.

Streaming execution

Response (SSE):

Health check

Response:

Security

  • Buffered /sandbox/execute (execute_handler) runs on the VM driver; when a warm pool is configured it checks out a health-checked VM and returns it afterwards, and a checkout failure returns 503 rather than falling back to an unsandboxed run.
  • /sandbox/execute/stream does not use the VM driver or the pool. It spawns the process directly on the API host with a cleared, allow-listed environment, supports python, node and bash, and caps the timeout at 300 seconds. Use /sandbox/execute when you need VM isolation.
  • network_enabled defaults to false.
  • Execution timeout is enforced by the server.

Error codes