Memory snapshots let you capture a running sandbox and start new sandboxes from that saved state.
Create a Memory Snapshot
Create a snapshot from a running sandbox:
const snapshot = await sandbox.createMemorySnapshot({
snapshotName: "node-after-setup",
});
console.log("Snapshot name:", snapshot.snapshotName);
console.log("Snapshot ID:", snapshot.snapshotId);
console.log("Status:", snapshot.status);
If you omit snapshotName, Hyperbrowser generates one automatically.
Start a Sandbox From a Snapshot
Use the snapshot name to start a new sandbox:
const restored = await client.sandboxes.create({
snapshotName: "node-after-setup",
snapshotId: "snapshot-id", // optional but recommended
});
console.log(restored.id);
List Images and Snapshots
List the available sandbox images and snapshots:
const { images } = await client.sandboxes.listImages();
const { snapshots } = await client.sandboxes.listSnapshots({
status: "created",
limit: 100,
});
console.log(images.map((image) => image.imageName));
console.log(snapshots.map((snapshot) => snapshot.snapshotName));
Snapshot Response
The snapshot create API returns metadata about both the snapshot and its backing image:
Unique snapshot identifier.
Namespace that owns the snapshot.
Snapshot creation status.
Backing image name for the snapshot.
Backing image ID for the snapshot.
Namespace that owns the backing image.