---
title: "Create sandbox"
method: POST
path: "/sandboxes"
tags: ["sandboxes"]
---

# Create sandbox

`POST /sandboxes`

Create a sandbox from the template

## Request body

- NewSandbox
  - `templateID` string, required — Identifier of the required template
  - `timeout` integer — Time to live for the sandbox in seconds.
  - `autoPause` boolean — Automatically pauses the sandbox after the timeout
  - `autoPauseMemory` boolean — 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).
  - `autoResume` SandboxAutoResumeConfig — Auto-resume configuration for paused sandboxes.
    - `enabled` boolean, required — Auto-resume enabled flag for paused sandboxes. Default false.
  - `secure` boolean — Secure all system communication with sandbox
  - `allow_internet_access` boolean — 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.
  - `network` SandboxNetworkConfig
    - `allowPublicTraffic` boolean — Specify if the sandbox URLs should be accessible only with authentication.
    - `allowOut` string[] — 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.
    - `denyOut` string[] — List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules.
    - `egressProxy` SandboxEgressProxyConfig, nullable — 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).
      - `address` string, required — SOCKS5 proxy address in host:port format (e.g. "proxy.example.com:1080").
      - `username` string — Optional SOCKS5 username (RFC 1929), max 255 bytes.
      - `password` string — Optional SOCKS5 password (RFC 1929), max 255 bytes.
    - `maskRequestHost` string — Specify host mask which will be used for all sandbox requests
    - `rules` object — Per-domain transform rules applied to matching egress HTTP/HTTPS requests. Keys are domains (e.g. "api.example.com", "example.com"). A domain listed here is not automatically allowed - use allowOut to permit the traffic.
  - `metadata` unknown
  - `envVars` unknown
  - `mcp` Mcp, nullable — MCP configuration for the sandbox
  - `iam` SandboxIam — Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the sandbox.
    - `tokens` SandboxIamTokens — Named workload-token definitions, keyed by a caller-chosen token name.
  - `volumeMounts` SandboxVolumeMount[]
    - `name` string, required — Name of the volume
    - `path` string, required — Path of the volume

## Response `201`

The sandbox was created successfully

- Sandbox
  - `templateID` string, required — Identifier of the template from which is the sandbox created
  - `sandboxID` string, required — Identifier of the sandbox
  - `alias` string — Alias of the template
  - `clientID` string, required — Identifier of the client
  - `envdVersion` string, required — Version of the envd running in the sandbox
  - `envdAccessToken` string — Access token used for envd communication
  - `trafficAccessToken` string, nullable — Token required for accessing sandbox via proxy.
  - `domain` string, nullable — Base domain where the sandbox traffic is accessible

## Other responses

- `400` — Bad request
- `401` — Authentication error
- `500` — Server error
- `503` — Service unavailable
- `504` — Backend timeout

## Changes

- **2026-08-20** `e01b3f5506fe` — 5 info
  - added the non-success response with the status `503`
  - added the non-success response with the status `504`
  - added the optional property `error_code` to the response with the `400` status
  - added the optional property `error_code` to the response with the `401` status
  - …1 more
- **2026-08-19** `a264494323e1` — 2 breaking, 1 warning, 3 info
  - added the new required request property `network/egressProxy/address`
  - the `network/egressProxy` request property type/format changed from ``/`` to `object`/``
  - removed `#/components/schemas/SandboxEgressProxyConfig` from the `network/egressProxy` request property `allOf` list
  - added the new optional request property `network/egressProxy/password`
  - …2 more
- **2026-07-24** `93ed246a4c10` — 4 info
  - the endpoint scheme security `AdminApiKeyAuth AND AdminTeamAuth` was added to the API
  - the endpoint scheme security `Supabase1TokenAuth AND Supabase2TeamAuth` was removed from the API
  - added the new optional request property `iam`
  - added the new optional request property `network/egressProxy`
- **2026-06-25** `cea884caee43` — 1 info
  - added the new optional request property `autoPauseMemory`
- **2026-05-27** `e13ef89d456c` — 1 info
  - the endpoint scheme security `AuthProviderBearerAuth AND AuthProviderTeamAuth` was added to the API

[Full history](https://skmtc.dev/e2b-dev/apis/e2b-api/changes/sandboxes/post.md)

---

[API](https://skmtc.dev/e2b-dev/apis/e2b-api.md) · [All operations](https://skmtc.dev/e2b-dev/apis/e2b-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/e2b-dev/e2b-api/revisions/e01b3f5506fe/schema)
