Sandboxes
Sandboxes
Isolated code execution environments with shell access, file operations, multiple runtimes, and optional browser pairing.
A sandbox is an isolated Linux environment running on a dedicated machine. You get a full shell, file system access, and the ability to run code in multiple runtimes. Sandboxes are designed for tasks that go beyond browser automation — code generation, data processing, build pipelines, and multi-step AI agent workflows.
Creating a Sandbox
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes" \
-H "Authorization: Bearer br_live_..." \
-H "Content-Type: application/json" \
-d '{
"runtime": "bun"
}'Response:
{
"id": "k82g51hl3on646lel50o9f162t92xu7z",
"status": "queued",
"runtime": "bun",
"size": "standard",
"capabilities": null
}Poll GET /v1/sandboxes?id=... until the status becomes ready.
An empty body {} creates a sandbox with defaults: bun runtime, the standard sandbox compute shape, and ephemeral storage.
Runtimes
| Runtime | What's Included | Best For |
|---|---|---|
bun (default) | Bun JavaScript/TypeScript runtime, npm package support | Web scraping scripts, API integrations, TypeScript projects |
python | Python 3, pip package support | Data processing, ML scripts, analysis tasks |
base | Minimal Linux container with common CLI tools | Shell scripts, custom toolchains, general-purpose tasks |
You can install additional packages within a running sandbox using the runtime's package manager (bun add, pip install, apt-get).
Compute Shape
All sandboxes currently run on the same standard machine shape for stability:
| CPU | Memory | Notes |
|---|---|---|
| 2 shared vCPUs | 4 GB | The current standard sandbox worker shape used for all plans |
The public API and SDK expose a single sandbox size value: standard.
Session Options
env
Type: Record<string, string> (optional)
Environment variables to set in the sandbox:
{
"runtime": "bun",
"env": {
"API_KEY": "sk_test_...",
"NODE_ENV": "production"
}
}ephemeral
Type: boolean
Default: true
Whether the sandbox workspace is ephemeral. When true, the workspace is destroyed when the session ends. Set to false to enable checkpointing.
maxDurationMs
Type: number (optional)
Default: Your plan's maximum sandbox duration
Maximum session duration in milliseconds. Must be positive and cannot exceed your plan's limit:
| Plan | Maximum Duration |
|---|---|
| Free | 300,000 ms (5 minutes) |
| Builder | 1,800,000 ms (30 minutes) |
| Pro | 3,600,000 ms (60 minutes) |
| Scale | 7,200,000 ms (2 hours) |
region
Type: string (optional)
A 3-letter region code (e.g., iad, lhr) for preferred machine placement. Must match /^[a-z]{3}$/.
capabilities
Type: object (optional)
Enable advanced features. See Sandbox Capabilities for full details.
{
"runtime": "bun",
"capabilities": {
"opencode": { "enabled": true, "defaultAgent": "build", "allowPromptApi": true },
"browser": { "mode": "paired-banata-browser", "recording": true, "streamPreview": true },
"documents": { "libreofficeHeadless": true },
"storage": { "workspace": "checkpointed", "artifactPrefix": "my-project/" }
}
}Reading Sandbox Status
Single sandbox
curl "https://api.boxes.banata.dev/v1/sandboxes?id=SANDBOX_ID" \
-H "Authorization: Bearer br_live_..."Response:
{
"id": "k82g51hl3on646lel50o9f162t92xu7z",
"status": "ready",
"runtime": "bun",
"size": "standard",
"region": "iad",
"terminalUrl": "wss://...",
"previewBaseUrl": null,
"capabilities": null,
"pairedBrowser": null,
"opencode": null,
"browserPreview": null,
"humanHandoff": null,
"artifacts": null,
"duration": null,
"createdAt": 1772078705353
}List all sandboxes
Omit the id to list all sandbox sessions for your organization:
curl "https://api.boxes.banata.dev/v1/sandboxes" \
-H "Authorization: Bearer br_live_..."Response:
{
"items": [
{
"id": "k82g51hl3on646lel50o9f162t92xu7z",
"status": "ready",
"runtime": "bun",
"size": "standard",
"region": "iad",
"createdAt": 1772078705353,
"startedAt": 1772078708000
}
]
}Sandbox States
| State | Description |
|---|---|
queued | Waiting for machine assignment |
assigning | Machine selected, environment being prepared |
ready | Environment running, accepting commands |
active | Actively executing |
ending | Cleanup in progress |
ended | Session complete |
failed | Error during lifecycle |
pausing | Pause operation in progress |
paused | Suspended, can be resumed |
Pause and Resume
Sandboxes support pausing to save costs during idle periods. A paused sandbox preserves workspace state and can be resumed later.
Pause
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes/pause" \
-H "Authorization: Bearer br_live_..." \
-H "Content-Type: application/json" \
-d '{"id": "SANDBOX_ID"}'Resume
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes/resume" \
-H "Authorization: Bearer br_live_..." \
-H "Content-Type: application/json" \
-d '{"id": "SANDBOX_ID"}'After resuming, the sandbox re-enters the queued → assigning → ready flow. Your workspace files and state are preserved.
Ending a Sandbox
curl -X DELETE "https://api.boxes.banata.dev/v1/sandboxes?id=SANDBOX_ID" \
-H "Authorization: Bearer br_live_..."Response: { "ok": true }
This stops the machine and cleans up resources. If you need to preserve workspace contents, create a checkpoint or download artifacts before ending the session.
Concurrent Sandbox Limits
| Plan | Concurrent Sandboxes |
|---|---|
| Free | 1 |
| Builder | 3 |
| Pro | 10 |
| Scale | 50 |
Monthly Sandbox Hours
| Plan | Sandbox Hours/Month |
|---|---|
| Free | 5 |
| Builder | 50 |
| Pro | 500 |
| Scale | 5,000 |
Error Responses
| Status | Body | Cause |
|---|---|---|
| 400 | Invalid runtime. Must be one of: bun, python, base | Invalid runtime value |
| 400 | Invalid size: '...'. Must be one of: standard | Invalid sandbox size |
| 400 | Invalid maxDurationMs | Duration not positive or exceeds plan limit |
| 401 | Invalid or missing API key | Missing or invalid API key |
| 403 | Paired browser is not available on your current plan... | Requires Pro plan |
| 429 | Concurrent sandbox limit reached | At plan's concurrent limit |
| 429 | Monthly sandbox hours limit reached | Monthly quota exhausted |
Next Steps
- Sandbox Execution — Running commands and code
- Sandbox File System — File operations, checkpoints, and artifacts
- Sandbox Capabilities — Browser pairing, AI agents, and human handoff
- API Reference — Full endpoint documentation