Skip to main content

Sandboxes

Create Sandbox

string
required
Base image template. See Available Templates below.
integer
Number of vCPUs (1-8, default: 2).
integer
Memory in MB (128-8192, default: 512).
integer
Disk in GB (1-50, default: 5).
string
Network access: full, none, or allowlist.
string[]
Allowed hosts when network_mode is allowlist.
object
Environment variables as key-value pairs.
string
Git repository URL to clone (HTTPS).
string
PAT or OAuth token for private repositories. GitHub: ghp_..., GitLab: personal access token.
string
Branch to checkout (default: main/master).
string
Specific commit SHA to checkout (overrides repo_branch).
string
Monorepo subdirectory to extract into /workspace.
number
Maximum spend in USD.
string
Shell command to run after creation.
integer
Idle timeout in seconds before auto-sleep.
string[]
Packages to pre-install (npm/pip packages).
string[]
AI agents to install: claude, aider, codex.
Private Repository Example
Response 201 Created

List Sandboxes

Response 200 OK

Get Sandbox

Execute a Command

Run a shell command inside a sandbox and get the output back. Supports pipes, redirects, and environment variables. This is how you interact with sandboxes programmatically — including prompting installed AI agents. POST /v1/sandboxes/{id}/exec
string
required
Shell command to execute. Runs via /bin/sh -c inside the sandbox with the sandbox’s environment (including any env vars set at creation).
Response 200 OK
Prompting an agent — if the sandbox was created with "agents": ["claude"], you can prompt Claude Code non-interactively:
Error semantics — the three outcomes are distinguishable:
A failed command still returns HTTP 200 — the API call succeeded; the command result is data. Exec requests can run for up to 5 minutes, so long agent prompts are fine.
For a fully interactive TTY session (e.g. the Claude Code TUI), use the terminal WebSocket instead: wss://api.caged.dev/v1/sandboxes/{id}/terminal.

Pause Sandbox

Freezes the sandbox in memory. No compute charges while paused. An auto-snapshot is created.

Resume Sandbox

Unfreezes a paused sandbox.

Destroy Sandbox

Permanently destroys a sandbox and all its data.
This action is irreversible. Create a snapshot first if you need to preserve the state.
Response 204 No Content

Available Templates

Pre-configured sandbox environments with common runtimes and tools.

JavaScript / TypeScript

Python

Base

Using minimal? You can install any runtime manually. The sandbox persists your changes until destroyed.