# pages.snapshot

`POST /api/public/v1/sessions/{id}/page-snapshot`

Queue a fresh accessibility snapshot of an explicit tab; read its result with operations.get.

- Capability: `agent.observe`
- Command (idempotent): No
- Idempotency: resend the same `idempotency_key` on retry; never generate a new key.
- MCP tool: `pages_snapshot`

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | Yes |  |
| `idempotency_key` | body | string | Yes | (min length 1, max length 163) |
| `target_id` | body | string | Yes | (min length 1, max length 128) |
| `token_budget` | body | integer | No | (min 256, max 3000000) Default: `16000`. |
| `interactive_only` | body | boolean | No | Default: `false`. |

## Response

`200` with `{ data, correlation_id }`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `operation_id` | string (uuid) \| null | Yes |  |
| `state_version` | integer | Yes | (min 0, max 9007199254740991) |
| `retryable` | false | Yes |  |
| `next` | object \| null | Yes |  |
| `next.operation` | "operations.get" | Yes |  |
| `next.operation_id` | string (uuid) | Yes |  |
| `ok` | true | Yes |  |
| `data` | object | Yes |  |

New fields can appear at any time; ignore the ones you do not know.

## Errors

| Code | HTTP | Retryable |
|---|---|---|
| `UNAUTHENTICATED` | 401 | No |
| `FORBIDDEN` | 403 | No |
| `RATE_LIMITED` | 429 | Yes |
| `VALIDATION_FAILED` | 422 | No |
| `NOT_FOUND` | 404 | No |
| `ACTION_OUTCOME_UNKNOWN` | 202 | No |
| `IDEMPOTENCY_KEY_REUSED` | 409 | No |
| `DEPENDENCY_UNAVAILABLE` | 503 | Yes |
| `UNKNOWN` | 500 | No |

## Examples (curl)

```bash
curl -X POST "https://browlix.com/api/public/v1/sessions/<id>/page-snapshot" \
  -H "Authorization: Bearer $BROWLIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"idempotency_key":"<idempotency_key>","target_id":"<target_id>"}'
```

## Examples (TypeScript SDK)

```ts
import { Browlix } from "@browlix/sdk";

const bx = new Browlix({ apiKey: process.env.BROWLIX_API_KEY! });
const reply = await bx.call("pages.snapshot", { path: { id: "<id>" }, body: {"idempotency_key":"<idempotency_key>","target_id":"<target_id>"} });
console.log(reply.data);
```

## Examples (Python)

```python
import os
import requests

r = requests.post(
    "https://browlix.com/api/public/v1/sessions/<id>/page-snapshot",
    headers={"Authorization": f"Bearer {os.environ['BROWLIX_API_KEY']}"},
    json={"idempotency_key":"<idempotency_key>","target_id":"<target_id>"},
    timeout=60,
)
print(r.status_code, r.json())
```

## Examples (MCP)

```json
{
  "method": "tools/call",
  "params": {
    "name": "pages_snapshot",
    "arguments": {
      "id": "<id>",
      "idempotency_key": "<idempotency_key>",
      "target_id": "<target_id>"
    }
  }
}
```
