Create a sandbox
Create a sandbox from a template.
/sandbox/v1/sandboxes● SupportedRequest body
templateIDstring必填Template ID or alias from templates.list; resolves to your ready Environment first, then a public Base. Supply it explicitly.
timeoutinteger可选Lifetime of the new sandbox in seconds. Defaults to 300 seconds when omitted.
autoPauseboolean可选Automatically pauses the sandbox after the timeout
metadataany可选Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes.
envVarsany可选Environment variables as name to value string pairs.
allow_internet_accessboolean可选Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config.
autoPauseMemoryboolean可选Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
autoResumeobject可选Auto-resume configuration for paused sandboxes.
▸ 展开子字段(1)
enabledboolean必填Auto-resume enabled flag for paused sandboxes. Default false.
networkobject可选Network policy of the sandbox: public access, egress allow and deny lists and proxy.
▸ 展开子字段(7)
allowPublicTrafficboolean可选Specify if the sandbox URLs should be accessible only with authentication.
allowOutarray可选List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. "8.8.8.8/32"), a bare IP address (e.g. "8.8.8.8"), or a domain name (e.g. "example.com", "*.example.com"). Allowed entries always take precedence over denied entries.
denyOutarray可选List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobject可选SOCKS5 proxy for sandbox egress. Outbound TCP is tunneled through the proxy after allow/deny filtering; the sandbox is unaware. Domain-matched flows use remote DNS (ATYP=domain).
maskRequestHoststring可选Specify host mask which will be used for all sandbox requests
httpsPortsarray可选Unlike E2B, network.httpsPorts is rejected; omit it and serve plaintext HTTP inside the sandbox. The public port URL still uses HTTPS. The upstream field denotes HTTPS-speaking internal ports, permits self-signed certificates and excludes envd port 49983.
rulesobject可选Per-domain transform rules applied to matching outbound HTTPS requests. Keys may be exact DNS names (for example, "api.example.com") or a leading wildcard (for example, "*.example.com"), and are normalized to lowercase on write. Wildcards match subdomains at any depth but not the apex domain; a bare "*" is invalid. Exact rules take precedence, followed by the longest matching wildcard suffix, and matching rule sets are not merged. Broad wildcards such as "*.com" are allowed and may expose transformed credentials to every matching destination the sandbox contacts. Rules do not grant network access; configure allowOut separately to permit the destination.
mcpobject可选MCP configuration for the sandbox
▸ 更多参数(2)
iamobject可选Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
▸ 展开子字段(1)
tokensobject可选Named workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarray可选Volumes to mount into the sandbox, each with the volume name and the path inside the sandbox.
▸ 展开子字段(2)
namestring必填Name of the volume
pathstring必填Path of the volume
Returns
201
The platform does not provide E2B's default base template yet: Sandbox.create() without a template returns 404, so name a template explicitly (see List templates for what is available).
Errors follow the E2B format — see error codes
Response
HTTP 201
The sandbox was created successfully
application/json
| Name | Type | Description |
|---|---|---|
| templateID | string | Identifier of the template from which is the sandbox created |
| sandboxID | string | Identifier of the sandbox |
| alias | string | Alias of the template |
| clientID | string | Identifier of the client |
| envdVersion | string | Version of the envd running in the sandbox |
| envdAccessToken | string | Access token used for envd communication |
| trafficAccessToken | string | Token required for accessing sandbox via proxy. |
| domain | string | Domain returned for sandbox traffic. Build an HTTP service URL as https://<port>-<sandboxID>.<domain> using the returned values, without replacing or stripping the sandboxID suffix. |
Sandbox API
Our sandbox API has exactly one version, v1: one interface per function, shaped like E2B's current latest version for that function. The official E2B SDK cannot be pointed here unmodified — call each endpoint with the request examples shown below.
Upgrade to a full sandbox
Upgrade a light instance to a full sandbox, terminating programs, processes and terminals. Files, sandbox ID and name are preserved. Returns HTTP 200 with sandbox detail and a new envdAccessToken; reconnect with it because the old token is revoked. Migration failure preserves source files but does not restart programs. Own face only; E2B ingress returns 404.