Create sandbox

Create a sandbox. Returns the initial sandbox snapshot synchronously.

With snapshotId: 404 with code: snapshot_not_found if the snapshot does not
exist; 409 with code: snapshot_not_available if it is not available, or
code: snapshot_plan_mismatch if a runtime snapshot was requested with a
different plan.

With snapshotName: 400 with code: invalid_snapshot_name if the name is
malformed, 400 without a code if snapshotId is also set, and 404 with
code: snapshot_not_found if no available snapshot in the group has the
name. The 409 cases above apply to the resolved snapshot.

400 with code: invalid_sandbox_name if name is longer than 64 characters
or starts with sbx-.

409 with code: sandbox_group_suspended if the sandbox group is suspended.

400 with code: sandbox_group_limit_reached if the owner has no default
sandbox group and is already at its sandbox group limit.

400 with code: invalid_sandbox_plan if plan is not one the API currently
accepts. The message lists the accepted plans.

400 with code: invalid_timeout_seconds if timeoutSeconds is below 0 or
above 2592000 (30 days).

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required

The ID of the workspace the sandbox belongs to.

string
^sbg-[0-9a-v]{20}$

Group to create the sandbox in; defaults to the workspace's default group.

string
length ≤ 64

A label for the sandbox, like my-agent. It isn't unique, so the
sandbox ID stays the handle. It can't start with sbx-.

networkPolicy
object

Set either type or its deprecated alias default. Sending both is
only accepted when they name the same policy.

enum

Compute plan. See sandboxPlan for known values.


The compute plan to use. starter, standard and pro are deprecated.

integer

Maximum sandbox lifetime in seconds. Sandbox is terminated when reached.
Use 0 for no timeout. Positive values must be at least 60. Defaults to
86400, or to the source sandbox's timeout when starting from a snapshot.

integer
0 to 86400

Seconds of inactivity before the sandbox is suspended. Use 0 to disable
automatic idle suspension. Positive values must be at least 300. Defaults
to 900, or to the source sandbox's idle timeout when starting from a
snapshot.

env
object

Inline environment variables injected into the sandbox at creation.

string
^snp-[0-9a-v]{20}$

Start from this snapshot instead of the base image. Must be available
and in the same sandbox group. For a runtime snapshot, plan must
match the snapshot's plan. The new sandbox uses the source sandbox's
network policy, timeout and idle timeout. Include networkPolicy,
timeoutSeconds or idleTimeoutSeconds to set a different one.

string
length between 1 and 64

Start from the snapshot this name currently resolves to in the sandbox
group. Mutually exclusive with snapshotId. Same restore rules as
snapshotId.

string
^sbb-[0-9a-v]{20}$

Start from this build's image instead of the base image. The build
must have succeeded and be in the sandbox's group: 404 with code: build_not_found if it isn't in the group, and 409 with code: build_not_succeeded if it hasn't succeeded. Mutually exclusive
with buildName, snapshotId and snapshotName.

string
length between 1 and 255

Start from the newest succeeded build with this name in the
sandbox's group. 404 with code: build_not_found if the group has
no build with the name, and 409 with code: build_not_succeeded if
none of them has succeeded. Mutually exclusive with buildId,
snapshotId and snapshotName.

Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json