Copy a running sandbox, memory and processes included, into new sandboxes
const url = 'https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/duplicate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"count":1,"vcpus":1,"memory_mb":1,"disk_mb":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/duplicate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "count": 1, "vcpus": 1, "memory_mb": 1, "disk_mb": 1 }'Makes count copies of the sandbox as it is now: memory, running processes and disk. The source keeps
running; it is paused only while its memory is saved and its disk copied (milliseconds for small sandboxes).
Each duplicate has its own disk and network address, and records the source in duplicate_of. A sleeping
source is woken first. A sandbox can’t be deleted while it has duplicates that aren’t deleted. The request waits
up to 2 minutes for the duplicates to run.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”object
Copies at a different size (Sprint 16). Memory can’t be less than the sandbox uses.
Responses
Section titled “Responses”The duplicates, running or failed (see error), or still starting if they took longer
object
object
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).
The team a team sandbox belongs to.
The environment the sandbox was made from, and the version it got.
object
A name people choose, e.g. “Support bot”.
Empty means the image’s own command.
A new size is recorded and its server hasn’t applied it yet.
The sandbox goes to sleep after this long idle; 0 means never.
How long the sandbox has been idle (no CPU, network, agent turn or terminal), as last reported.
For a duplicate, the sandbox it was copied from.
For a sandbox made from a checkpoint, the checkpoint’s ID.
Take a checkpoint every this many hours while the sandbox runs; 0 means never.
How many periodic checkpoints to keep; older ones are deleted.
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).
Why the platform stopped the sandbox, e.g. a suspended organization or suspected crypto mining.
The repository the sandbox was opened from, if any.
The ID of the person who created the sandbox, when one did (not an admin or a schedule).
object
The sandbox’s server has put these rules in force; changes take a few seconds.
Present when the sandbox’s team limits it to these hosts (ADR 0040).
Present when the sandbox is limited at all - what it may actually reach.
Example
{ "sandboxes": [ { "access": "shared", "state": "pending", "desired_state": "running", "internet": { "mode": "open" } } ]}The request is invalid
object
Example
{ "code": "not_found"}The API key is missing or invalid
object
Example
{ "code": "not_found"}No such sandbox in your organization (or no such file)
object
Example
{ "code": "not_found"}The sandbox isn’t running, or its server is unreachable right now
object
Example
{ "code": "not_found"}