POST /v4/sandboxes

Creates a named sandbox environment. Named sandboxes have a unique name within a project and support automatic snapshotting on shutdown. When no image is provided (and the sandbox is not restored from a snapshot), the sandbox is created from the default universal image. Unlike v3, snapshots expire after 7 days by default and persistent sandboxes keep only their most recent snapshot unless keepLastSnapshots is configured otherwise (or set to null to disable the limit).

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Query parameters

Name Type Required Description
teamId String No

The Team identifier to perform the request on behalf of.

slug String No

The Team slug to perform the request on behalf of.

Request body fields

Name Type Required Description
source No

The source from which to initialize the sandbox filesystem. Can be a Git repository, a tarball URL, or an existing snapshot.

projectId String No

The target project slug or ID in which the sandbox will be assigned to.

region String No

The Vercel region in which to create the sandbox.

Valid values:

  • "cle1"
  • "iad1"
  • "sfo1"
  • "lhr1"
  • "hkg1"
  • "sin1"
  • "pdx1"
  • "bom1"
  • "cdg1"
  • "fra1"
  • "kix1"
  • "icn1"
  • "cpt1"
  • "yul1"
  • "dub1"
  • "gru1"
  • "syd1"
  • "hnd1"
  • "arn1"
failoverRegions[] Array No

The regions the sandbox falls back to when it cannot be created in region.

env Object No

Default environment variables for the sandbox. These are inherited by all commands unless overridden.

persistent Boolean No

Whether the sandbox persists its state across restarts via automatic snapshots. Defaults to true.

Default value: true

image String No

Image to use for the sandbox.

networkPolicy No
name String No

Name for the sandbox. Must be unique per project and URL-safe (alphanumeric, hyphens, underscores).

resources Object No

Resources to define the VM

resources.memory Integer No

The amount of memory in megabytes to allocate to the sandbox. Must equal vcpus * 2048.

resources.vcpus Integer No

The number of virtual CPUs to allocate to the sandbox. Must be 1, or an even number.

Default value: 2

tags Object No

Key-value tags to associate with the sandbox. Maximum 5 tags.

ports[] Array No

List of ports to expose from the sandbox. Each port will be accessible via a unique URL. Maximum of 15 ports can be exposed.

timeout Integer No

Maximum duration in milliseconds that the sandbox can run before being automatically stopped.

keepLastSnapshots No

Protect the N most recent snapshots with different expiration/deletion behavior. Persistent sandboxes default to keeping only the last snapshot (evicted snapshots are deleted). Set to null to disable the limit.

mounts Object No

List of drives to mount to the sandbox at the provided path.

mounts.name Object No
mounts.name.drive String Yes

Name of the drive to mount. The drive must already exist.

mounts.name.mode String No

Mount the drive read-only or read-write.

Valid values:

  • "read-write"
  • "read-only"

Default value: "read-write"

snapshotExpiration No

Default snapshot expiration time in milliseconds. Defaults to 7 days. Set to 0 to disable expiration. When set, this value is used as the default expiration for all snapshots created for this sandbox.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.