Pause, resume and snapshot a sandbox
Pause keeps a sandbox's memory and files for later. A snapshot saves its /workspace so you can start new sandboxes from it.
Pause and resume work on every plan. Snapshots come with Pro and up, within your organization’s snapshot policy (on or off, how many, how large and how long they are kept).
Pause and resume
await sandscale.sandboxes.pause(box.id, { region: box.region });
await sandscale.sandboxes.resume(box.id, { region: box.region });
sandscale.sandboxes.pause(box.id, region=box.region)
sandscale.sandboxes.resume(box.id, region=box.region)
curl -X POST "$API/instances/$ID/pause" -H "$AUTH"
curl -X POST "$API/instances/$ID/resume" -H "$AUTH"
Save a snapshot
const snap = await sandscale.sandboxes.snapshot(box.id, { region: box.region, label: 'after-npm-ci' });
snap = sandscale.sandboxes.snapshot(box.id, label="after-npm-ci", region=box.region)
curl -X POST "$API/instances/$ID/snapshot" -H "$AUTH"
A snapshot is an archive of the sandbox’s /workspace, checked end to end. Nothing mounted into the workspace is included, so runtime secrets are never in a snapshot. It belongs to your organization and keeps the sandbox’s project.
Start from a snapshot
const next = await sandscale.sandboxes.create({ snapshotId: snap.id });
nxt = sandscale.sandboxes.create(snapshot_id=snap.id)
curl -X POST "$API/instances" -H "$AUTH" -H "Content-Type: application/json" -d "{\"snapshot_id\": \"$SNAPSHOT_ID\"}"
The new sandbox starts with the snapshot’s files, in the snapshot’s project, with your own permissions. If the archive fails its check, the start fails rather than giving you a broken workspace.
List and delete
GET /api/v1/sandbox/snapshots lists your organization’s snapshots, and DELETE /api/v1/sandbox/snapshots/{snapshotId} deletes one. Snapshots past the policy’s retention are deleted for you. See the Sandboxes API.