Overview

REST API

POST/sandboxes

Create a sandbox from a template.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Body
templateIDstringrequired

Identifier of the template to boot

timeoutinteger

Time to live in seconds (default 15)

autoPauseboolean

Pause instead of kill when the timeout runs out (default false)

autoPauseMemoryboolean

Keep memory in the auto-pause snapshot (default true)

autoResumeobject

Auto-resume configuration for paused sandboxes

secureboolean

Secure all system communication with the sandbox

allow_internet_accessboolean

Allow outbound internet access

networkobject

Network configuration — allowOut, denyOut, public traffic

metadataobject

Your own key-value metadata

envVarsobject

Environment variables

mcpobject

MCP gateway configuration

iamobject

Workload identity configuration

volumeMountsarray

Volumes to mount — each with name and path

Example
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}'
Response

201 with sandboxID, templateID, alias, envdVersion, and — for secure sandboxes — envdAccessToken and trafficAccessToken.

Errors
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.

The rest of the API#

Next#

Updated

Was this page helpful?