Create a sandbox (v2)
/e2b/v2/sandboxes● SupportedRequest body
templateIDstringrequiredIdentifier of the required template
timeoutintegeroptionalTime to live for the sandbox in seconds.
autoPausebooleanoptionalAutomatically pauses the sandbox after the timeout
metadataanyoptionalenvVarsanyoptionalallow_internet_accessbooleanoptionalAllow 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.
autoPauseMemorybooleanoptionalControls 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).
autoResumeobjectoptionalAuto-resume configuration for paused sandboxes.
Expand sub-fields (1)
enabledbooleanrequiredAuto-resume enabled flag for paused sandboxes. Default false.
networkobjectoptionalExpand sub-fields (7)
allowPublicTrafficbooleanoptionalSpecify if the sandbox URLs should be accessible only with authentication.
allowOutarrayoptionalList 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.
denyOutarrayoptionalList of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
egressProxyobjectoptionalSOCKS5 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).
maskRequestHoststringoptionalSpecify host mask which will be used for all sandbox requests
httpsPortsarrayoptionalSandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work. The envd port (49983) cannot be listed.
rulesobjectoptionalPer-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.
mcpobjectoptionalMCP configuration for the sandbox
More parameters (2)
iamobjectoptionalSandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
Expand sub-fields (1)
tokensobjectoptionalNamed workload-token definitions, keyed by a caller-chosen token name.
volumeMountsarrayoptionalExpand sub-fields (2)
namestringrequiredName of the volume
pathstringrequiredPath of the volume
Returns
201
Errors follow the E2B format — see error codes
Request
curl
curl https://api.deepraxis.com/e2b/v2/sandboxes \
-H "X-API-Key: $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"templateID":"node22","timeout":300,"autoPause":false}'Python
import requests
opts = dict(
api_key="$PRAXIS_API_KEY",
api_url="https://api.deepraxis.com/e2b",
domain="sandbox.praxisusercontent.com",
)
# 官方 SDK 的 Sandbox.create 调用 v1;这个 v2 端点直接用 HTTP 调用
resp = requests.post(
f"{opts['api_url']}/v2/sandboxes",
headers={"X-API-Key": opts["api_key"]},
json={"templateID": "node22", "timeout": 300},
)
print(resp.json())TypeScript
const opts = {
apiKey: "$PRAXIS_API_KEY",
apiUrl: "https://api.deepraxis.com/e2b",
domain: "sandbox.praxisusercontent.com",
};
// 官方 SDK 的 Sandbox.create 调用 v1;这个 v2 端点直接用 HTTP 调用
const resp = await fetch(`${opts.apiUrl}/v2/sandboxes`, {
method: "POST",
headers: { "X-API-Key": opts.apiKey, "Content-Type": "application/json" },
body: JSON.stringify({ templateID: "node22", timeout: 300 }),
});
console.log(await resp.json());Response 201
{
"templateID": "node22",
"sandboxID": "sbid428b7204d8ed92ca3a81d83",
"clientID": "iz543sld35y2kktz05af5",
"envdVersion": "0.9.0",
"envdAccessToken": "<access-token>",
"domain": "sandbox.praxisusercontent.com"
}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 | Base domain where the sandbox traffic is accessible |