> ## 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.

> ## Agent Instructions
> Authenticate REST, SDK, and CLI requests with the `x-api-key` header using the `HYPERBROWSER_API_KEY` environment variable (create keys at https://app.hyperbrowser.ai).
> Always stop browser sessions (`sessions.stop(id)` / `PUT /api/session/{id}/stop`) and sandboxes (`sandboxes.stop(id)` / `PUT /api/sandbox/{id}/stop`) in `try`/`finally` blocks to avoid idle billing.
> Choose the right surface: use Web API (`/api/web/fetch`, `batch-fetch`, `crawl`, `search`) for stateless reading and extraction (prefer it over legacy `/api/scrape`); Browser Sessions (`/api/session`) for interactive, authenticated, or Playwright/Puppeteer workflows; Cloud Agents (`/api/task/*`) for autonomous browser tasks; and Sandboxes (`/api/sandbox`) for isolated Linux or macOS code execution.
> Use `@hyperbrowser/sdk` for Node.js/TypeScript, `hyperbrowser` 1.0+ typed-dict request params for Python (avoid legacy Pydantic request classes), the unified `hx` CLI for terminal workflows, and hosted OAuth MCP at `https://mcp.hyperbrowser.ai/mcp/web` (web tools; use `https://mcp.hyperbrowser.ai/mcp` only when browser, sandbox, admin, and usage tools are needed).

# Session Snapshots

> Capture a running VM-backed browser session into a restorable memory snapshot and launch new sessions from it

Browser session snapshots capture the live state of a running VM-backed browser session so you can launch new browser sessions directly from that point—preserving open tabs, loaded DOM state, cookies, and in-memory application state.

> [!NOTE]
>
> Browser session snapshots are enabled per team on request. Contact [info@hyperbrowser.ai](mailto:info@hyperbrowser.ai) to enable snapshots for your team.

```mermaid theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
flowchart LR
  Warm["Warm Session\nOpen tabs, cookies & DOM"] --> Snap["POST /api/session/{id}/snapshot\nCapture live VM state"]
  Snap --> Ready["Snapshot Ready\n(snapshotId)"]
  Ready --> R1["Worker Session 1\nstartFromSnapshot"]
  Ready --> R2["Worker Session 2\nstartFromSnapshot"]
  Ready --> RN["Worker Session N\nstartFromSnapshot"]
```

***

## Create a Snapshot

Call `POST /api/session/{id}/snapshot` (requires the `browser.sessions.snapshots.create` scope) while the browser session is actively running.

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { Hyperbrowser } from "@hyperbrowser/sdk";

const client = new Hyperbrowser({
  apiKey: process.env.HYPERBROWSER_API_KEY,
});

const session = await client.sessions.create();

// ... navigate, authenticate, or warm up application state ...

const snapshot = await client.sessions.createSnapshot(session.id);
console.log(snapshot.snapshotId, snapshot.ready);
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import os
from hyperbrowser import Hyperbrowser

client = Hyperbrowser(api_key=os.environ["HYPERBROWSER_API_KEY"])

session = client.sessions.create()

# ... navigate, authenticate, or warm up application state ...

snapshot = client.sessions.create_snapshot(session.id)
print(snapshot.snapshot_id, snapshot.ready)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X POST "https://api.hyperbrowser.ai/api/session/${SESSION_ID}/snapshot" \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Response

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "snapshotName": "browser-session-962372c4-a140-400b-8c26-4ffe21d9fb9c",
  "snapshotId": "962372c4-a140-400b-8c26-4ffe21d9fb9c",
  "namespace": "team-namespace",
  "status": "created",
  "uploaded": false,
  "ready": false,
  "imageName": "browser-image",
  "imageId": "img-id",
  "imageNamespace": "global"
}
```

***

## Restore a Session from a Snapshot

Pass `startFromSnapshot: { snapshotId }` (`start_from_snapshot: {"snapshot_id": ...}` in Python) when creating a new browser session (`browser.sessions.create` scope):

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const restored = await client.sessions.create({
  startFromSnapshot: {
    snapshotId: snapshot.snapshotId,
  },
});

try {
  console.log("Restored live view:", restored.liveUrl);
  // Connect via restored.wsEndpoint and continue from the captured state
} finally {
  await client.sessions.stop(restored.id);
}
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
restored = client.sessions.create(
    params={
        "start_from_snapshot": {
            "snapshot_id": snapshot.snapshot_id,
        }
    }
)

try:
    print("Restored live view:", restored.live_url)
finally:
    client.sessions.stop(restored.id)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl -X POST https://api.hyperbrowser.ai/api/session \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "startFromSnapshot": {
      "snapshotId": "<SNAPSHOT_ID>"
    }
  }'
```

***

## Requirements & Constraints

* **Supported browser sessions only** — Snapshots are available for browser sessions running on Hyperbrowser's snapshot-capable browser runtime, which is selected automatically. Taking a snapshot of a session that doesn't support it returns `400`. To snapshot a sandbox, use [sandbox memory snapshots](https://hyperbrowser.ai/docs/sandboxes/snapshots.md) instead.
* **Region compatibility** — Restore the snapshot in a region compatible with the host where it was captured; incompatible regions return an error.
* **Memory size is preserved** — Restored sessions inherit the snapshot's original `browserMemorySize`.
* **Upload readiness** — If a snapshot is still uploading when you attempt to restore on another host, wait briefly and retry once `uploaded` / `ready` is `true`.
* **Web Bot Auth exclusion** — Sessions created with `webBotAuth` cannot be snapshotted, and `startFromSnapshot` cannot be combined with `webBotAuth`.
* **Snapshots containing filled credentials** — If credentials were filled into the source session via [Credential Fill](https://hyperbrowser.ai/docs/sessions/credentials.md), the snapshot is marked as containing secrets. Restoring secret-bearing snapshots requires team owner/admin permissions (or the `secrets.use` scope for API keys) and the Secrets feature enabled for your team. If you attach `credentials` when restoring from a snapshot, the source session must have been created with `credentials` or `disablePasswordManager: true`.

***

## Managing Snapshot Storage

Browser session snapshots are stored in your team snapshot namespace. List and delete snapshots using `GET /api/snapshots` (`firecracker.snapshots.read`) and `DELETE /api/snapshots/{id}` (`firecracker.snapshots.delete`), or via the [CLI](https://hyperbrowser.ai/docs/cli/sandboxes.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.