# pages.list

`POST /api/public/v1/sessions/{id}/tabs/list`

Yêu cầu danh sách tab đang mở của phiên (target_id, url, tiêu đề); đọc bằng operations.get.

- Quyền: `agent.observe`
- Lệnh (chống trùng): Không
- Chống trùng: gửi cùng `idempotency_key` khi thử lại; không tạo khóa mới.
- Tool MCP: `pages_list`

## Tham số

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|---|
| `id` | path | string (uuid) | Có |  |
| `idempotency_key` | body | string | Có | (độ dài tối thiểu 1, độ dài tối đa 163) |

## Phản hồi

`200` với `{ ok, data, operation_id, state_version, retryable, next }`; kết quả chấp nhận lệnh không chứng minh worker hoàn tất.

| Trường | Kiểu | Luôn có | Mô tả |
|---|---|---|---|
| `operation_id` | string (uuid) \| null | Có |  |
| `state_version` | integer | Có | (tối thiểu 0, tối đa 9007199254740991) |
| `retryable` | false | Có |  |
| `next` | object \| null | Có |  |
| `next.operation` | "operations.get" | Có |  |
| `next.operation_id` | string (uuid) | Có |  |
| `ok` | true | Có |  |
| `data` | object | Có |  |

Trường mới có thể xuất hiện bất cứ lúc nào; hãy bỏ qua trường bạn không biết.

## Lỗi

| Mã | HTTP | Thử lại |
|---|---|---|
| `UNAUTHENTICATED` | 401 | Không |
| `FORBIDDEN` | 403 | Không |
| `RATE_LIMITED` | 429 | Có |
| `VALIDATION_FAILED` | 422 | Không |
| `NOT_FOUND` | 404 | Không |
| `DEPENDENCY_UNAVAILABLE` | 503 | Có |
| `UNKNOWN` | 500 | Không |

## Ví dụ (curl)

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

## Ví dụ (TypeScript SDK)

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

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

## Ví dụ (Python)

```python
import os
import requests

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

## Ví dụ (MCP)

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