Snapshot a sandbox
Saves the sandbox's memory and disk as a snapshot you can create new sandboxes from. The sandbox keeps running (it pauses for the copy). New sandboxes restored from a snapshot get a fresh identity, so two of them never share random state. Writing the snapshot resets the sandbox's open connections to the outside (open PTY sessions, streaming execs and log streams, port preview connections, outbound TCP connections); new ones work as soon as the call returns. Snapshots are kept 7 days. An organization keeps at most `sandboxes.snapshots_max` snapshots (beta: 20) per node, counting at most `sandboxes.snapshot_storage_max` (beta: 40 GiB). Each snapshot counts its sandbox's memory plus its disk size: the memory is stored whole, and the disk copy comes to hold every block the sandbox rewrites after the snapshot. Past either limit the snapshot is refused with `422 limit_exceeded` until you delete some. While the node's snapshot store is nearly full, snapshots and forks are refused with `503 capacity_unavailable`.
/v1/sandboxes/{sandbox_id}/snapshot
Authentication
Path Parameters
sandbox_id
string
required
path
"sbx_01m5t68q1b590rj801nbzsqzkk"Header Parameters
Idempotency-Key
string
optional
header
Request Body
application/jsonname
string
metadata
object
Responses
application/jsonid
string
REQUIRED
object
string
REQUIRED
snapshotname
string | null
status
string
REQUIRED
creating, ready, failedsandbox_id
string
REQUIRED
template
object
REQUIRED
id
string
REQUIRED
name
string
REQUIRED
vcpu
integer
REQUIRED
memory_mib
integer
REQUIRED
disk_gib
integer
REQUIRED
size_bytes
integer
REQUIRED
created_at
string (date-time)
REQUIRED
expires_at
string (date-time) | null
REQUIRED
timing
object
total_ms
number
REQUIRED
metadata
object
REQUIRED
curl -X POST 'https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/snapshot' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "deps-installed"}'
const response = await fetch('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/snapshot', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "deps-installed" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/sandboxes/sbx_01m5t68q1b590rj801nbzsqzkk/snapshot', headers=headers, json={ "name": "deps-installed"})print(response.json())
{ "id": "snap_01m5t5mnvax7tp9peav8jajw3y", "object": "snapshot", "name": "deps-installed", "status": "ready", "sandbox_id": "sbx_01m5t68q1b590rj801nbzsqzkk", "template": { "id": "tpl_01m5t59b2ps0djyzdf082s18bz", "name": "base" }, "vcpu": 2, "memory_mib": 2048, "disk_gib": 4, "size_bytes": 734003200, "created_at": "2026-10-25T19:03:00.000Z", "expires_at": "2026-11-01T19:03:00.000Z", "timing": { "pause_ms": 0.5, "write_ms": 820.4, "total_ms": 823.1 }, "metadata": {}}
Try this endpoint
/v1/sandboxes/{sandbox_id}/snapshot