REST API
/sandboxesCreate a sandbox from a template.
Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.
Identifier of the template to boot
Time to live in seconds (default 15)
Pause instead of kill when the timeout runs out (default false)
Keep memory in the auto-pause snapshot (default true)
Auto-resume configuration for paused sandboxes
Secure all system communication with the sandbox
Allow outbound internet access
Network configuration — allowOut, denyOut, public traffic
Your own key-value metadata
Environment variables
MCP gateway configuration
Workload identity configuration
Volumes to mount — each with name and path
curl -X POST https://api.e2b.app/sandboxes \
-H "X-API-Key: $E2B_API_KEY" \
-H "Content-Type: application/json" \
-d '{"templateID": "base", "timeout": 300}'201 with sandboxID, templateID, alias, envdVersion, and — for secure sandboxes — envdAccessToken and trafficAccessToken.
| Status | Meaning |
|---|---|
400 |
Bad request |
401 |
Missing or invalid API key |
500 |
Server error |
503 |
Service unavailable — the SDKs raise ServiceBusyError |
504 |
Backend timeout |
Rate-limited calls get 429; since September 14, 2026 the SDKs retry them up to three times, honouring the server's delay. Plain HTTP clients should do the same.