Skip to content

Start, stop, sleep or wake a sandbox, or change its auto-sleep

PATCH
/sandboxes/{id}
curl --request PATCH \
--url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "access": "shared", "team_id": "example", "internet": { "mode": "open", "allowed_hosts": [ "github.com", "registry.npmjs.org", "pypi.org" ] }, "name": "example", "state": "running", "auto_sleep_seconds": 1, "checkpoint_every_hours": 1, "vcpus": 1, "memory_mb": 1, "disk_mb": 1, "checkpoint_keep": 1 }'

Stopping ends the sandbox’s processes and keeps its disk; starting runs its command again. Sleeping saves its memory and processes to disk; waking resumes them where they were.

id
required
string
Media typeapplication/json
object
access

Who sees and works in the sandbox: everyone in the organization (shared, the default), one team and the owners (team), or only its creator (private; owners and auditors see that it exists, and owners can stop or delete it).

string
Allowed values: shared team private
team_id

The team a team sandbox belongs to.

string
internet

Where the sandbox may connect. open is the internet (private networks are always blocked). allowlist is only the web (ports 80 and 443) on allowed_hosts and their subdomains; DNS keeps working.

object
mode
required
string
Allowed values: open allowlist
allowed_hosts
Array<string>
<= 100 items
name
string
>= 1 characters <= 100 characters
state

asleep saves memory and processes to disk; running wakes or starts it; stopped ends its processes.

string
Allowed values: running asleep stopped
auto_sleep_seconds
integer
<= 604800
checkpoint_every_hours

Take a checkpoint every this many hours while the sandbox runs; 0 turns it off.

integer
<= 720
vcpus

Resize. CPU cores (0.25 to 8), in force at once, whatever state the sandbox is in.

number format: double
memory_mb

Resize. Memory (128 to 16384 MB). Not below what a running sandbox uses.

integer
disk_mb

Resize. Disk (256 to 102400 MB). Not below what the disk holds.

integer
checkpoint_keep

How many periodic checkpoints to keep (default 3).

integer
>= 1 <= 100

The sandbox, with its new desired state

Media typeapplication/json
object
access

Who sees and works in the sandbox: everyone in the organization (shared, the default), one team and the owners (team), or only its creator (private; owners and auditors see that it exists, and owners can stop or delete it).

string
Allowed values: shared team private
team_id

The team a team sandbox belongs to.

string
environment

The environment the sandbox was made from, and the version it got.

object
id
required
string
version
required
integer
id
required
string
name
required

A name people choose, e.g. “Support bot”.

string
region
required
string
image
required
string
command
required

Empty means the image’s own command.

Array<string>
vcpus
required
number format: double
memory_mb
required
integer
disk_mb
required
integer
resizing

A new size is recorded and its server hasn’t applied it yet.

boolean
auto_sleep_seconds
required

The sandbox goes to sleep after this long idle; 0 means never.

integer
idle_seconds
required

How long the sandbox has been idle (no CPU, network, agent turn or terminal), as last reported.

integer
duplicate_of

For a duplicate, the sandbox it was copied from.

string
from_checkpoint

For a sandbox made from a checkpoint, the checkpoint’s ID.

string
checkpoint_every_hours
required

Take a checkpoint every this many hours while the sandbox runs; 0 means never.

integer
checkpoint_keep
required

How many periodic checkpoints to keep; older ones are deleted.

integer
state
required

What the sandbox is doing now. pending: waiting for a server with room. asleep: its memory and processes are saved to disk and it uses no memory or CPU; any request wakes it. starting, sleeping, waking, stopping and deleting: a server is carrying out a change. failed: the server could not start it (see error).

string
Allowed values: pending starting running sleeping asleep waking stopping stopped deleting deleted failed
desired_state
required
string
Allowed values: running asleep stopped deleted
error
string
stop_reason

Why the platform stopped the sandbox, e.g. a suspended organization or suspected crypto mining.

string
repository

The repository the sandbox was opened from, if any.

string
created_by

The ID of the person who created the sandbox, when one did (not an admin or a schedule).

string
internet
required
object
mode
required
string
Allowed values: open allowlist
allowed_hosts
required
Array<string>
applied
required

The sandbox’s server has put these rules in force; changes take a few seconds.

boolean
team_allowed_hosts

Present when the sandbox’s team limits it to these hosts (ADR 0040).

Array<string>
effective_hosts

Present when the sandbox is limited at all - what it may actually reach.

Array<string>
created_at
required
string format: date-time
updated_at
required
string format: date-time

Example

{
"access": "shared",
"state": "pending",
"desired_state": "running",
"internet": {
"mode": "open"
}
}

The request is invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

The API key is missing or invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

No such sandbox in your organization (or no such file)

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}