Sandboxes API
Compute primitives: isolated execution with exec, files, logs. For stateful agent conversations, use Sessions API.
Templates
standard
Minimal Linux rootfs
browser
Chromium headless
cua
Xvfb + fluxbox + Chromium + OmniParser for agent desktop control
canvas
HTML canvas rendering
Create Sandbox
POST
api.e2a.bot/v1/sandboxesCreate a new sandbox. Optionally attach an agent for one-shot execution.
Request
{
"template": "standard", // required: "standard" | "browser" | "cua" | "canvas"
"agent": "claude-code", // optional: "deictic" | "claude-code" | "codex"
"llm_key": "sk-ant-...", // required if agent is set
"task": "summarize README.md", // optional: one-shot prompt
"model": "claude-sonnet-4-5", // required for deictic; prefix-validated for claude-code/codex
"idle_timeout_seconds": 60, // optional, default 60
"max_lifetime_seconds": 7200, // optional, default + hard cap 7200
"env_vars": { "MY_VAR": "value" }, // optional; reserved keys rejected
"metadata": { "tag": "prod" } // optional free-form
}Response (201)
{
"vm_id": "sbx_7f3k9m2x",
"state": "running",
"host_port": 30090,
"endpoint": "http://worker-ip:9090"
}| Code | Meaning | When |
|---|---|---|
| 201 | Created | sandbox provisioned and Running |
| 400 | Bad request | missing required field, reserved env-var key, agent without llm_key |
| 401 | Unauthorized | missing or invalid API key |
| 409 | Conflict | no capacity on any worker |
| 501 | Not implemented | unknown agent type or template |
| 503 | Service unavailable | no workers registered |
List Sandboxes
GET
api.e2a.bot/v1/sandboxesList all sandboxes owned by the authenticated user.
Response (200)
[
{
"vm_id": "sbx_7f3k9m2x",
"state": "running",
"vcpu": 1,
"cpu_fraction": 0.5,
"memory_mib": 512,
"metadata": { "tag": "prod", "user_id": "usr_abc" }
}
]
// Partial failure returns wrapped object:
{ "sandboxes": [...], "partial": true }Get Sandbox
GET
api.e2a.bot/v1/sandboxes/{id}Get details for a specific sandbox.
Response (200)
{
"vm_id": "sbx_7f3k9m2x",
"state": "running",
"vcpu": 1,
"cpu_fraction": 0.5,
"memory_mib": 512,
"rootfs": "standard.ext4",
"metadata": { "tag": "prod" },
"agent_exit_code": 0, // optional; present once agent exits
"agent_status": "completed" // "running" | "completed" | "failed"
}| Code | Meaning | When |
|---|---|---|
| 200 | OK | sandbox found and caller owns it |
| 401 | Unauthorized | missing or invalid API key |
| 404 | Not found | no such sandbox or cross-tenant access |
Execute Command
POST
api.e2a.bot/v1/sandboxes/{id}/execExecute a shell command inside the sandbox via SSH. Blocking.
Request
curl -X POST https://api.e2a.bot/v1/sandboxes/sbx_7f3k9m2x/exec \
-H "Authorization: Bearer e2a_live_..." \
-H "Content-Type: application/json" \
-d '{"command": "echo hello && ls /workspace"}'Response (200)
{
"output": "hello\ntotal 0\n"
}Destroy Sandbox
DELETE
api.e2a.bot/v1/sandboxes/{id}Destroy a sandbox. Synchronous — returns once teardown is complete.
Response (200)
{
"vm_id": "sbx_7f3k9m2x",
"state": "destroyed"
}| Code | Meaning | When |
|---|---|---|
| 200 | OK | sandbox destroyed |
| 401 | Unauthorized | missing or invalid API key |
| 404 | Not found | no such sandbox or cross-tenant access |
Get Logs
GET
api.e2a.bot/v1/sandboxes/{id}/logsFetch stdout/stderr logs from the sandbox.
Query Parameters
| Name | Type | Description |
|---|---|---|
| limit | integer | Max lines (default 100) |
| since | ISO 8601 | Only logs after this timestamp |
Cancel Sandbox
POST
api.e2a.bot/v1/sandboxes/{id}/cancelSend a cooperative cancel signal to the agent. Agent decides how to respond.
Response (200)
{
"vm_id": "sbx_7f3k9m2x",
"cancelled": true,
"reason": "user_request"
}To forcibly destroy the VM, use DELETE /v1/sandboxes/{id}.