Create a sandbox

Creates a sandbox by restoring a template or a snapshot, or by booting an image.

POST/v1/sandboxes

Creates a sandbox by restoring a template or a snapshot, or by booting an image. By default the call waits until the sandbox is running and answers 201. If the sandbox is still creating when wait_timeout_s passes, or if wait is false, the call answers 202 with the sandbox in creating. Poll its state with a get. If a waiting call observes the placed sandbox in error, it answers 202 with that sandbox's ID, error state and reason, such as create_failed. When no server has room, the call answers 503 no_capacity with retry_after_s. Nothing is made or billed. With hold_server, server_held in that answer says a whole server is now held for this create: retry at retry_after_s with the same idempotency key, and it lands there once the server has room. With count above 1, a swarm name or roles, it is a batch create: the copies make one group, and it always answers 202 with BatchCreated at once (wait: true is invalid). Each copy counts against creates_per_minute. A batch larger than the trust tier's swarm cap is quota_exceeded with limit: max_swarm; nothing is made. Copies no server took are listed in unplaced, and the rest carry on.

A key with the sandboxes:write scope.

Request

curl -X POST "https://api.pod.mapier.ai/v1/sandboxes" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"system":"linux","size":"small","labels":{"app":"quickstart"}}'

Parameters

NameInTypeRequiredWhat it is
Pod-End-UserheaderstringNoNarrows a project key to one of its end users: the call sees only that end user's sandboxes and usage, any other answering not_found, and a create is labelled with it. An end user of another project, or one that is not there, is not_found; a suspended one refuses creates and wakes (account_restricted).
Idempotency-KeyheaderstringYesRequired on this call. Makes a repeat safe for 24 hours.

Body

FieldTypeRequiredWhat it is
projectstringNoThe project the sandbox belongs to. A key's own project by default, and a key may name only that one; a signed-in person names any project of the organization (the organization's first by default). A project the caller may not see answers forbidden.
system"linux"No
size"small" | "medium" | "large" | "xlarge" | "ci-2" | "ci-4" | "ci-8" | "ci-16"Nosmall by default.
templatestringNoRestore this template. Give at most one of template, snapshot and image; with none, the system's default template.
snapshotstringNoRestore this snapshot.
imagestringNoBoot this image from its disk; slower than a restore.
class"shared" | "ci" | "nested"NoThe size's class by default; must match it.
waitbooleanNoWait until running and answer 201. Default true.
wait_timeout_sintegerNoDefault 60. From 1 to 300.
time_limit_sinteger | nullNoStop the sandbox this long after it starts. None by default. At least 1.
idle_sinteger | nullNoSleep after this long with no activity. The project's default, 15 minutes unless set. null: never sleep for want of activity, for a sandbox that must stay awake while it waits, such as a CI runner waiting for its job or a quiet build step. Its time limit still applies, and a sleep call still puts it to sleep. At least 60.
disk"persistent" | "throwaway"Nopersistent by default; always throwaway on CI sizes.
no_savebooleanNoRefuse snapshots, share links and forks to every key but the one that created the sandbox. Default false.
envEnvNoEnvironment variables. Never logged, stored or answered back.
labelsLabelsNoUp to 32 labels. Keys are lowercase, 1 to 63 characters; values up to 256.
end_userstringNoLabel the sandbox with this end user of the project (POST /v1/end_users), so its usage can be read by end user and the end user's limits count it. Never changed after the create. An end user the key cannot see is invalid.
volumesAttachVolumeRequest[]NoVolumes to attach at create, usually locked until the sandbox's work is known. Each is checked before anything is made: one that does not exist is invalid, one attached elsewhere conflict. Volumes must belong to the sandbox's project and mode. A batch with volumes is invalid because a volume has one attachment.
needs"kvm" | "ios-simulator"[]NoCapabilities the sandbox needs, in the spec file's words: the scheduler places it where they are, kvm in the pool kept for VMs inside sandboxes. A capability the system does not have is invalid; one this cell does not offer yet is system_not_offered.
nested_virtualizationbooleanNoRun VMs inside this sandbox: it is placed in the nested class's pool, on servers of its own, Linux only, in a shared size. The same as class: nested or kvm in needs; false beside either is invalid. It cannot be switched on later. A cell without the pool answers system_not_offered.
hintsPlacementHintsNo"This sandbox will use these volumes or this snapshot": the scheduler prefers a server that already holds them for this organization. A hint never refuses a create and never overrides room; an id of another organization's object is found nowhere. At most 16 ids together, repeats dropped. A create from a snapshot hints its own snapshot.
hold_serverbooleanNoHold a whole server for this create when none has room now. Only for a CI size of at least 16 cores (ci-16); on any other size it is invalid. The answer is still 503 no_capacity, with server_held saying whether a server is held; the retry with the same idempotency key lands there once it has room. Nothing is queued. A batch cannot hold a server (invalid). Default false.
countintegerNoHow many copies to make. Above 1 it is a batch create: 2 to 1000 copies as one swarm, answered 202 with BatchCreated. With roles, the roles' counts must add up to it; without count they set it. 0 is invalid. From 0 to 1000.
swarmstringNoThe swarm's name. Makes the create a batch.
rolesBatchRole[]NoThe copies' roles, each with its count. Copies are named <role>-<n> in the order given, n from 0 within its role, or member-<n> with no roles; the name is the copy's name on the group's private network. Makes the create a batch.
policystringNoRun the sandbox under this stored policy of the project (Pod Agent IAM's listPolicies). The front door binds it before the sandbox runs anything (Pod Agent IAM's bindSandbox), so the sandbox reaches only what the policy grants. Left out, with no rules, the sandbox runs under the project's default for sandboxes with no policy: the public internet within Pod's baseline, unless the project switched its default to deny. A policy the project does not hold is invalid (field policy); a key issued inside a sandbox may name only its parent's policy or one that narrows it.
rulesstringNoRules for this sandbox alone, in the simple form, one a line (Allow net api.github.com GET /repos/*). They are cut to the ceiling (the policy and, above it, the project's and the organization's), and what was cut is in the sandbox's binding. Rules here close the network as a policy does: the sandbox reaches only what they and its policy allow. A rule the compiler refuses is invalid (field rules).

Answer

201. The sandbox, running.

202. A single sandbox in creating or a waiting create's sandbox in error. For a batch, the group and its copies.

201
{
  "id": "sbx_3ahrz6dmv29gqy5ckt18fpx4b",
  "project": "prj_3ahrz6dmv29gqy5ckt18fp",
  "state": "running",
  "tier": null,
  "operation": null,
  "reason": null,
  "restarted": false,
  "system": "linux",
  "size": "small",
  "class": "shared",
  "disk": "persistent",
  "template": null,
  "parent": null,
  "created_at": "2026-11-23T12:00:00.000Z",
  "state_at": "2026-11-23T12:00:00.000Z",
  "time_limit_at": null,
  "idle_s": 900,
  "flags": {
    "no_save": false,
    "billing_mark": null
  },
  "labels": {
    "app": "quickstart"
  },
  "queue_position": null,
  "end_user": null,
  "group": null
}
FieldTypeAlwaysWhat it is
idstringYes
projectstringYes
state"creating" | "running" | "stopping" | "sleeping" | "waking" | "stopped" | "deleting" | "deleted" | "error"Yesrunning means restored and reset: a sandbox made or woken from a copy (a template, a snapshot or a fork) shows running only once Pod's agent inside it has reset the copy (random numbers, clock and identity), so nothing that runs in it shares them with another copy. Secrets and the machine profile load after the reset.
tier"memory" | "disk" | "none" | nullYesSet only while sleeping.
operation"snapshotting" | "forking" | "moving" | nullYes
reason"create_failed" | "boot_failed" | "server_lost" | "resize_failed" | "vm_crashed" | "time_limit" | "no_capacity" | "idle" | "stopped" | nullYes
restartedbooleanYesTrue when the last wake booted, so programs started again.
system"linux"Yes
size"small" | "medium" | "large" | "xlarge" | "ci-2" | "ci-4" | "ci-8" | "ci-16"Yes
class"shared" | "ci" | "nested"Yes
disk"persistent" | "throwaway"Yesthrowaway keeps writes on the server and never sends them to object storage; the sandbox cannot sleep to disk on another server and is lost with its server. The key that created it may still snapshot it, with its memory, and restore the snapshot at the same size; with no_save, every other key is refused.
templatestring | nullYes
parentstring | nullYesThe sandbox this one was forked from.
created_atstringYesRFC 3339 in UTC with milliseconds, for example 2026-11-23T17:04:05.123Z.
state_atstringYesRFC 3339 in UTC with milliseconds, for example 2026-11-23T17:04:05.123Z.
time_limit_atstring | nullYes
idle_sinteger | nullYesSeconds with no activity before it sleeps; null when it never sleeps for want of activity. At least 60.
flagsSandboxFlagsYes
labelsLabelsYesUp to 32 labels. Keys are lowercase, 1 to 63 characters; values up to 256.
queue_positioninteger | nullYesWhile waking and waiting for room. At least 1.
end_userstring | nullYesThe end user the sandbox was made for, if any.
groupstring | nullYesThe sandbox's group: its swarm, or its group of one, whose id is the sandbox's with grp_ for sbx_. Null only from a cell that predates groups.

Errors

The refusals this call is known for: invalid, forbidden, quota_exceeded, plan_required, account_restricted, spend_cap_reached, rate_limited, no_capacity, system_not_offered, conflict, in_other_cell. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.sandboxes.create({ … })
Pythonpod.sandboxes.create(…)
mpodmpod sandboxes create