Skip to content
中文

Create a sandbox

POST/sandbox/v1/sandboxes● Supported

Official E2B docs ↗

Request body

  • templateIDstringrequired

    Identifier of the required template

  • timeoutintegeroptional
    default 300

    Lifetime of the new sandbox in seconds. Defaults to 300 seconds when omitted.

  • autoPausebooleanoptional
    default false

    Lifecycle declaration on the E2B-compatible face. true creates a persistent sandbox that pauses at its timeout and can be resumed; false or absent creates an ephemeral sandbox that ends at its timeout and keeps nothing. Keep true only for long-lived computers. The own face declares with ephemeral instead.

  • metadataanyoptional

    Your own string key/value pairs stored with the sandbox; usable as a filter in listSandboxes.

  • envVarsanyoptional

    Environment variables as name to value string pairs.

  • 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

    Network policy of the sandbox: public access, egress allow and deny lists and proxy.

    Expand sub-fields (9)
    • 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

      Unlike E2B, network.httpsPorts is rejected; omit it when creating a sandbox.

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

    • staticEgressIpbooleanoptional

      Own face, persistent sandboxes only (autoPause: true, or ephemeral: false): true gives the sandbox one fixed public egress IP for its whole life, held through pause and resume and released when the sandbox is deleted. Without it the egress IP is not stable: it changes when a spot machine is reclaimed, when a paused machine starts again, and when the machine is rebuilt. An ephemeral sandbox returns INVALID_PARAMS; the E2B face refuses the field; it is placed only on capacity that declares static IPs, and without such capacity the create does not start (it never falls back to a changing IP). Billed as the usage item sandbox:public_ip:hours from allocation to release, paused time included, plus outbound traffic as usual.

    • egressIpstringoptional

      Own face, read-only: the fixed public egress IP of a sandbox created with staticEgressIp: true, present once the machine has bound it; add this address to the IP allowlist of the service you call (for example a WeCom trusted IP list). Absent on a sandbox that did not ask for a static IP, because its public address can change.

  • mcpobjectoptional

    MCP configuration for the sandbox

  • More parameters (14)
    • 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

      Volumes to mount into the sandbox, each with the volume name and the path inside the sandbox.

      Expand sub-fields (2)
      • namestringrequired

        Name of the volume

      • pathstringrequired

        Path of the volume

    • ephemeralbooleanoptional

      Own face, required unless sku is named: true for an ephemeral sandbox (ends at its timeout, never pauses, cannot be snapshotted), false for a persistent one (pauses, resumes, snapshots, mounts volumes). Leaving it out returns INVALID_PARAMS.

    • sizestringoptional

      Own face: the machine size, a SKU id such as base-2c4g or, for an android phone, android-2c4g. Omitted, the template's default size is used.

    • namestringoptional

      Own face: a display name for the sandbox, 1 to 64 characters. Omitted, one is generated from the template.

    • waitForReadybooleanoptional

      Own face, android phones only: keep the create open until the phone is running or 55 seconds have passed since the request arrived; running out is not an error and answers the state reached.

    • onExpirestringoptional

      Own face: what happens at the timeout. pause needs ephemeral: false; must agree with autoPause when both are sent.

      values killpause
    • idleTimeoutintegeroptional

      Own face, persistent sandboxes only: pause after this many milliseconds without activity; null turns the idle pause off.

    • idleActivitystringoptional

      Own face, persistent sandboxes only: whose activity resets idleTimeout. traffic (default) counts data-plane calls, preview traffic and live processes; caller counts only your own control-plane calls.

      values trafficcaller
    • skustringoptional

      Own face: a demand-profile SKU <kind>.<image>.<size>, such as run.document.medium (someone waits; starts fast), job.base.large (background work that must not be cut off), batch.base.large (retried work that may be reclaimed) or computer.base.medium (keeps its disk). It fixes ephemeral, interruptible, size and the template, so those may be left out; any of them you also send must agree with it, otherwise the create fails with INVALID_PARAMS naming the field. The sandbox answers it back as sku and as the read-only label praxis.sku.

    • kindstringoptional

      Own face: the kind of sandbox you need, when you do not name a full sku. The sandbox completes <kind>.<image>.<size> from the template you start (its family, or custom for your own environment or snapshot) and the size you send, or medium. run is for work someone waits for (starts fast), job is background work that must not be cut off, batch is retried work that may be reclaimed (spot capacity), computer keeps its disk, and compat is the E2B-compatible persistent series. The kind fixes ephemeral and interruptible, so leave those out; if you also send them, or a sku of another kind, the create fails with INVALID_PARAMS naming the field. The light template always starts the light shell, whatever the kind says.

      values runjobbatchcomputercompat
    • interruptiblebooleanoptional

      Own face, ephemeral sandboxes only: true says this sandbox may be reclaimed while it runs (a build or test you retry), which lets it run on cheaper spot capacity. A reclaimed sandbox ends with PROVIDER_FAILED; create it again. Absent or false keeps the usual capacity.

    • onLossstringoptional

      Own face, persistent sandboxes only: what happens when the provider loses the machine. fail (default) ends the sandbox; rebuild starts a new machine under the same id with its state lost.

      values failrebuild
    • outputsarrayoptional

      Own face: up to eight absolute paths to keep when the sandbox ends; each is packed as .tar.gz into File and listed on the killed event.

      Expand sub-fields (1)
      • pathstringrequired

        Absolute path of a directory or file inside the sandbox.

Returns

201

Like E2B, creating without a templateID uses the default base template; to use another, pick a templateID from List templates. Every sandbox declares its lifecycle at creation. On the own face (X-Praxis-Face: own-v1) send ephemeral: true for an ephemeral sandbox (never pauses, deleted when it ends; for jobs) or ephemeral: false for a persistent one (pauses, snapshots, mounts volumes; for long-lived computers); leaving it out returns INVALID_PARAMS. The E2B-compatible face declares with autoPause: true is persistent, false or absent is ephemeral. Persistent-only fields (autoPause: true, onExpire: pause, autoPauseMemory, autoResume, idleTimeout, retention, volumes) need ephemeral: false. Choose persistent only for long-lived computers. Reaching a sandbox whose machine has ended returns SANDBOX_EXPIRED (410): its files are gone, create a new sandbox. To keep results, declare outputs: [{ path }] on the own face (up to eight absolute paths): on any ending except provider loss or a failed start each is stored in File as .tar.gz, and the killed event lists each fileId or why it was not kept; the E2B face refuses outputs. Responses echo ephemeral.

Errors follow the E2B format — see error codes

Request

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

api_key = "$PRAXIS_API_KEY"

# Call /sandbox/v1 directly over HTTP.
resp = requests.post(
    "https://api.deepraxis.com/sandbox/v1/sandboxes",
    headers={"X-API-Key": api_key},
    json={"templateID": "node22", "timeout": 300, "ephemeral": False},
)
print(resp.status_code, resp.text)
TypeScript
const apiKey = "$PRAXIS_API_KEY";

// Call /sandbox/v1 directly over HTTP.
const resp = await fetch(`https://api.deepraxis.com/sandbox/v1/sandboxes`, {
  method: "POST",
  headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({ templateID: "node22", timeout: 300, ephemeral: false }),
});
console.log(resp.status, await resp.text());

Response 201

{
  "templateID": "node22",
  "sandboxID": "sbib2586b83c183533da70bced2",
  "clientID": "i42g6lkj181tyvouozh1o",
  "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
machine string What kind of machine this sandbox is, so you can decide whether to drive it as a computer without knowing which vendor placed it. full: a complete environment that runs files, commands, terminals and background processes through the data plane — drive it as a computer. light: a light machine without that. none: a single-use box that is reachable but must not be driven as a computer.