Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.capy.ai/llms.txt

Use this file to discover all available pages before exploring further.

What are browser snapshots?

Browser snapshots store authenticated browser state — cookies and localStorage — that gets injected into agent VMs at startup. This lets agents interact with authenticated services (dashboards, staging environments, internal tools) without needing to log in.

How it works

  1. Create a snapshot with your cookies and localStorage via POST /browser-snapshots
  2. Mark it as default so it’s automatically applied to all sessions, or pass specific snapshot IDs when creating threads
  3. Agents get authenticated sessions — cookies and localStorage are injected into Chrome on the VM before the agent starts

Using snapshots with threads

Pass browserSnapshotIds when creating a thread or sending a message to control which snapshots are applied:
curl -X POST \
  -H "Authorization: Bearer capy_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "your-project-id",
    "prompt": "Test the login flow on staging",
    "browserSnapshotIds": ["snapshot-id-1", "snapshot-id-2"]
  }' \
  https://capy.ai/api/v1/threads
If you don’t pass browserSnapshotIds, the agent uses all snapshots marked as default for the project.

Visibility

  • Public snapshots (isPrivate: false) are visible to all project members
  • Private snapshots (isPrivate: true) are only visible to their creator
  • Snapshots marked default (isDefault: true) are automatically applied to all agent sessions unless overridden

Quick start

1. Create a snapshot

curl -X POST \
  -H "Authorization: Bearer capy_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Staging Auth",
    "storageState": {
      "cookies": [
        {
          "name": "session",
          "value": "your-session-token",
          "domain": "staging.yourapp.com",
          "path": "/",
          "expires": 1798761600,
          "httpOnly": true,
          "secure": true,
          "sameSite": "Lax"
        }
      ],
      "origins": []
    }
  }' \
  https://capy.ai/api/v1/projects/{projectId}/browser-snapshots
Domains are automatically extracted from your cookies — you don’t need to specify them separately.

2. Verify it was created

curl -H "Authorization: Bearer capy_xxxx" \
  https://capy.ai/api/v1/projects/{projectId}/browser-snapshots

3. Use it in a thread

curl -X POST \
  -H "Authorization: Bearer capy_xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "your-project-id",
    "prompt": "Check the admin dashboard for errors",
    "browserSnapshotIds": ["your-snapshot-id"]
  }' \
  https://capy.ai/api/v1/threads
The storageState format matches Playwright’s storage state. You can export state from Playwright and use it directly.