Skip to content
中文

Create a sandbox

POST/e2b/sandboxes● Supported

Official E2B docs ↗

Request body

  • templateIDstringrequired

    Identifier of the required template

  • timeoutintegeroptional
    default 15

    Time to live for the sandbox in seconds.

  • autoPausebooleanoptional
    default false

    Automatically pauses the sandbox after the timeout

  • metadataanyoptional
  • envVarsanyoptional
  • securebooleanoptional

    Secure all system communication with sandbox

  • allow_internet_accessbooleanoptional

    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.

  • autoPauseMemorybooleanoptional
    default true

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

  • autoResumeobjectoptional

    Auto-resume configuration for paused sandboxes.

    Expand sub-fields (1)
    • enabledbooleanrequired
      default false

      Auto-resume enabled flag for paused sandboxes. Default false.

  • networkobjectoptional
    Expand sub-fields (7)
    • allowPublicTrafficbooleanoptional
      default true

      Specify if the sandbox URLs should be accessible only with authentication.

    • allowOutarrayoptional

      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.

    • denyOutarrayoptional

      List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.

    • egressProxyobjectoptional

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

    • maskRequestHoststringoptional

      Specify host mask which will be used for all sandbox requests

    • httpsPortsarrayoptional

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

    • rulesobjectoptional

      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.

  • More parameters (3)
    • mcpobjectoptional

      MCP configuration for the sandbox

    • iamobjectoptional

      Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.

      Expand sub-fields (1)
      • tokensobjectoptional

        Named workload-token definitions, keyed by a caller-chosen token name.

    • volumeMountsarrayoptional
      Expand sub-fields (2)
      • namestringrequired

        Name of the volume

      • pathstringrequired

        Path of the volume

Returns

201

Deprecated: the latest official SDK uses v2. Like E2B, creating without a templateID uses the default base template; to use another, pick a templateID from List templates. Declare the lifecycle with autoPause: true is persistent (pauses, snapshots; for long-lived computers), false or absent is ephemeral (ends at its timeout and keeps nothing). Reaching a sandbox whose machine has ended returns SANDBOX_EXPIRED (410); create a new sandbox.

Errors follow the E2B format — see error codes

Request

curl
curl https://api.deepraxis.com/e2b/sandboxes \
  -H "X-API-Key: $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateID":"node22","timeout":300,"autoPause":false}'
Python
from e2b import Sandbox

opts = dict(
    api_key="$PRAXIS_API_KEY",
    api_url="https://api.deepraxis.com/e2b",
    domain="sandbox.praxisusercontent.com",
)

sandbox = Sandbox.create(template="node22", timeout=300, **opts)
print(sandbox.sandbox_id)
TypeScript
import { Sandbox } from "e2b";

const opts = {
  apiKey: "$PRAXIS_API_KEY",
  apiUrl: "https://api.deepraxis.com/e2b",
  domain: "sandbox.praxisusercontent.com",
};

const sandbox = await Sandbox.create("node22", { ...opts, timeoutMs: 300_000 });
console.log(sandbox.sandboxId);

Response 201

{
  "templateID": "node22",
  "sandboxID": "sbib185b70d57718fd1f3df06d4",
  "clientID": "iuf9ho516lcexp7svm6td",
  "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