On a sandbox
snapshot works on a running or stopped sandbox. A running sandbox pauses briefly while the snapshot is taken.
nameis 1 to 64 printable characters and must be unique within the sandbox (name_takenotherwise). Left out, it issnapshot-and the UTC time, such assnapshot-20261111-104512.- A sandbox keeps at most 20 snapshots. The 21st fails with
limit_reached(409); delete one first. - Every snapshot includes memory (RAM) as well as disk. There are no disk-only snapshots, so the SDK has no option for it, and the API refuses
include_ram: false.
restore also needs the sandbox running or stopped. A running sandbox restarts from the snapshot and is running afterwards. A stopped sandbox stays stopped and resumes from the snapshot on its next start(). Anything done since the snapshot is lost unless you snapshot it first.
sbx.restore(snap) only takes a snapshot of sbx itself. Given another sandbox’s snapshot, it throws ZodeError with code wrong_sandbox (status 0) before calling the API, and nothing is rolled back. Given an snp_ id, it looks the snapshot up first and throws not_found (404) for an unknown id. The client’s zode.snapshots.restore(id) has no such check: it rolls back whichever sandbox the snapshot belongs to.
On the client
zode.snapshots works with snapshot ids directly, without loading a sandbox first.
The Snapshot record
Snapshot or fork
- Restore rolls one sandbox back in place. Use it to undo a step and try again.
- Fork makes a new running sandbox from the current state, memory and disk included, and leaves the original alone. Use it to try several things side by side.