Sandboxes

POST /v1/sandboxes

Changed on

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    HTTP bearer

Request body

_runtimestring nullable
allow_dockerboolean

Permit installing/running Docker with normal guest-root privileges. Requires backend="microsandbox". Does not install Docker or expose the host socket.

backendstring nullable

Isolation backend: "docker" (default), "firecracker" (ADR-029, hardware-virtualized microVM — requires a host provisioned with temps firecracker setup) or "microsandbox" (ADR-050, experimental libkrun microVM — requires temps microsandbox setup). Omit for the platform default; existing clients are unaffected. Requesting an unavailable backend fails with 400 rather than silently downgrading isolation.

cpu_limitnumber double nullable

CPU cores, [0.01, 16], bounded by the placement host and any administrator maximum. Omit for the effective placement default.

creation_idstring nullable

Id the client gives this create, so it can read the create's steps from GET /v1/sandboxes/creations/{creation_id} while it waits for this request: 8 to 64 letters, digits, - or _, new for every create (a UUID works). Optional.

disk_size_mbinteger nullable

Root disk size in MB, [1, 65536] (Firecracker only; Docker ignores it). Omit for the platform default (1 GiB).

envobject

Extra env vars baked into the container on create.

from_snapshotstring nullable

Create the sandbox from a snapshot (ADR-037).

Mutually exclusive with image: if both are set the request fails with 400. When set, the sandbox is created with the snapshotted filesystem rather than a base image, giving users a reproducible starting point.

The snapshot must be in ready status and belong to the calling user.

imagestring nullable

Docker image override. null uses the platform default.

lifecyclestring nullable

Lifecycle class (ADR-036, temps-native): "ephemeral" (default) or "workspace".

A workspace is a long-lived development environment: it is still suspended after timeout_secs of inactivity, but the next exec or filesystem call wakes it transparently instead of returning 409, and nothing ever destroys it automatically. Use it for "give me a place to work on this repo"; leave it unset for throwaway sandboxes.

memory_limit_mbinteger nullable

Memory in MB, [6, 32768] (lower if an administrator set a maximum, and never more than the host has). Omit for the operator's default.

namestring nullable
networkPolicyunknown
nodestring nullable

Node to create the sandbox on (ADR-048): a node name, a node id, or control-plane / 0 for the control plane. Omit to let Temps place it (the control plane when allowed, otherwise the allowed worker with the fewest live sandboxes). The node must be allowed by the operator's sandbox placement settings and online; otherwise the request fails with 422 — it never silently falls back to another node.

pids_limitinteger nullable

Max processes, [1, 4096] (lower if an administrator set a maximum); 0/negative (unlimited) is rejected. Omit for the platform default (512).

portsinteger[]

Ports the sandbox will listen on. Each port becomes a routes[] entry in the create/get response so @vercel/sandbox's sandbox.domain(port) can resolve it client-side without an extra round-trip.

preview_passwordstring password nullable

A credential. Write-only: it is never returned, and the AI assistant supplies it through a secret slot instead of typing it into the conversation.

projectIdstring nullable
project_idinteger nullable

Create the sandbox against a temps project (temps-native). The project's connected repo and git credential seed the work dir when no explicit source is given, and the sandbox is attributed to the project so it can be listed alongside it.

Requires access to the project and git_repositories:read when Temps derives the source from the project. The same team/scope rules that gate every other project-scoped endpoint apply.

timeoutinteger nullable

Idle timeout as sent by @vercel/sandbox (milliseconds). Converted to seconds when timeout_secs is absent.

timeout_secsinteger nullable

Idle timeout in seconds (temps-native). Clamped to [60, 86400].

Example request

{
  "creation_id": "6f1c2a9e-3b7d-4e0a-9c55-0d2f8a1b7e43",
  "egress_policy": {
    "rules": [
      {
        "cidr": "1.1.1.0/24",
        "host": "api.example.com"
      }
    ]
  },
  "node": "worker-1"
}

Response

Sandbox created

Example response

{
  "sandbox": {
    "egress_policy": {
      "rules": [
        {
          "cidr": "1.1.1.0/24",
          "host": "api.example.com"
        }
      ]
    }
  }
}

Changes