> ## Documentation Index
> Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox Snapshots

> Create memory snapshots and start sandboxes from snapshots

Memory snapshots let you capture a running sandbox and start new sandboxes from that saved state.

When you take a snapshot, you are freezing the sandbox's memory, processes, and filesystem at that point in time.
Starting a sandbox from a snapshot is instant and you can start a new sandbox from the same snapshot multiple times.

## Create a Memory Snapshot

Create a snapshot from a running sandbox.

<CodeGroup>
  ```typescript Node.js theme={null}
  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);
  ```

  ```python Python theme={null}
  from hyperbrowser.models import SandboxMemorySnapshotParams

  snapshot = sandbox.create_memory_snapshot(
      SandboxMemorySnapshotParams(
          snapshot_name="python-after-setup",
      )
  )

  print(f"Snapshot name: {snapshot.snapshot_name}")
  print(f"Snapshot ID: {snapshot.snapshot_id}")
  print(f"Status: {snapshot.status}")
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.hyperbrowser.ai/api/sandbox/SANDBOX_ID/snapshot \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "snapshotName": "node-after-setup"
    }'
  ```
</CodeGroup>

## Start a Sandbox From a Snapshot

Use the snapshot name to start a new sandbox:

<CodeGroup>
  ```typescript Node.js theme={null}
  const sandbox = await client.sandboxes.create({
    snapshotName: "node-after-setup",
    snapshotId: "snapshot-id", // if omitted uses the latest snapshot
  });

  console.log(sandbox.id);
  ```

  ```python Python theme={null}
  from hyperbrowser.models import CreateSandboxParams

  sandbox = client.sandboxes.create(
      CreateSandboxParams(
          snapshot_name="python-after-setup",
          snapshot_id="snapshot-id",  # if omitted uses the latest snapshot
      )
  )

  print(sandbox.id)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.hyperbrowser.ai/api/sandbox \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "snapshotName": "node-after-setup",
      "snapshotId": "snapshot-id"
    }'
  ```
</CodeGroup>

## List Images and Snapshots

List the available sandbox images and snapshots:

<CodeGroup>
  ```typescript Node.js theme={null}
  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));
  ```

  ```python Python theme={null}
  from hyperbrowser.models import SandboxSnapshotListParams

  images = client.sandboxes.list_images()
  snapshots = client.sandboxes.list_snapshots(
      SandboxSnapshotListParams(
          status="created",
          limit=100,
      )
  )

  print([image.image_name for image in images.images])
  print([snapshot.snapshot_name for snapshot in snapshots.snapshots])
  ```

  ```bash cURL theme={null}
  curl -X GET https://api.hyperbrowser.ai/api/images \
    -H "x-api-key: YOUR_API_KEY"

  curl -X GET "https://api.hyperbrowser.ai/api/snapshots?status=created&limit=100" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

## Snapshot Response

The snapshot create API returns metadata about both the snapshot and its backing image:

<ResponseField name="snapshotName" type="string">
  Snapshot name.
</ResponseField>

<ResponseField name="snapshotId" type="string">
  Unique snapshot identifier.
</ResponseField>

<ResponseField name="namespace" type="string">
  The team that owns the snapshot.
</ResponseField>

<ResponseField name="status" type="string">
  Snapshot creation status.
</ResponseField>

<ResponseField name="imageName" type="string">
  Backing image name for the snapshot. What the snapshot was created from.
</ResponseField>
