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

# Authentication & API Keys

> Authenticate requests with API keys, scoped permissions, OAuth 2.0, and X402 payment tokens

Hyperbrowser supports three authentication methods depending on how you connect:

* **API keys (`x-api-key`)** — Primary authentication for the REST API and the Node and Python SDKs. The API also accepts a key as `Authorization: Bearer <api-key>`, and the `hx` CLI accepts one through `HYPERBROWSER_API_KEY`.
* **OAuth 2.0** — Used by MCP clients connecting to Hyperbrowser's hosted MCP server, and by the `hx` CLI's default sign-in (`hx auth login`).
* **X402 wallet payments and management tokens** — Pay-per-request access for autonomous agents without a Hyperbrowser account or API key.

## API Keys

Create and manage API keys in the [Hyperbrowser Dashboard](https://app.hyperbrowser.ai). Pass your key in the `x-api-key` HTTP header, or export it as `HYPERBROWSER_API_KEY` when using the SDKs or CLI.

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
curl https://api.hyperbrowser.ai/api/team/credit-info \
  -H "x-api-key: $HYPERBROWSER_API_KEY"
```

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

// Reads HYPERBROWSER_API_KEY automatically when apiKey is omitted
const client = new Hyperbrowser({
  apiKey: process.env.HYPERBROWSER_API_KEY,
});
```

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

# Reads HYPERBROWSER_API_KEY automatically when api_key is omitted
client = Hyperbrowser(api_key=os.environ["HYPERBROWSER_API_KEY"])
```

> [!WARNING]
>
> Never commit API keys to source control or embed them in client-side browser code. Use scoped keys for automated pipelines and rotate compromised keys immediately from the dashboard.

***

## Scoped API Keys & Permissions

API keys can be **unrestricted** (full access to all team API endpoints) or **scoped** to a specific subset of permissions. Use least-privilege scoped keys in production, CI jobs, and third-party integrations.

* When a scoped key calls an endpoint outside its granted scopes, the API returns `403 Forbidden` with:
  ```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  { "error": "API_KEY_SCOPE_DENIED" }
  ```
* Account, billing, and API key management endpoints cannot be called with restricted API keys.

### Permission Groups

Scopes follow the format `<resource>.<action>` and are organized into six permission groups:

#### 1. Web APIs (`web`)

| Feature | Scopes | Access |
| - | - | - |
| Fetch | `web.fetch.run`, `web.fetch.read` | Start single-page fetch requests/jobs and read status or results. |
| Batch fetch | `web.batch-fetch.run`, `web.batch-fetch.read` | Start batch fetch jobs and read status, pages, or results. |
| Crawl | `web.crawl.run`, `web.crawl.read` | Start Web API v2 crawl jobs and list or read crawled pages. |
| Search | `web.search.run`, `web.search.read` | Run web searches and read search status or results. |
| Legacy scrape | `web.scrape.run`, `web.scrape.read` | Run and read legacy `/api/scrape` jobs. |
| Legacy batch scrape | `web.batch-scrape.run`, `web.batch-scrape.read` | Run and read legacy `/api/scrape/batch` jobs. |
| Legacy crawl | `web.legacy-crawl.run`, `web.legacy-crawl.read` | Run and read legacy `/api/crawl` jobs. |
| Extract | `web.extract.run`, `web.extract.read` | Run and read `/api/extract` jobs. |

#### 2. AI Agents (`agents`)

Each agent family supports `.run` (start tasks), `.read` (list tasks and read status/results), and `.stop` (stop running tasks):

| Agent | Scopes |
| - | - |
| Generic agent | `agents.generic.run`, `agents.generic.read`, `agents.generic.stop` |
| Browser Use | `agents.browser-use.run`, `agents.browser-use.read`, `agents.browser-use.stop` |
| OpenAI CUA | `agents.cua.run`, `agents.cua.read`, `agents.cua.stop` |
| Claude Computer Use | `agents.claude-computer-use.run`, `agents.claude-computer-use.read`, `agents.claude-computer-use.stop` |
| HyperAgent | `agents.hyper-agent.run`, `agents.hyper-agent.read`, `agents.hyper-agent.stop` |
| Gemini Computer Use | `agents.gemini-computer-use.run`, `agents.gemini-computer-use.read`, `agents.gemini-computer-use.stop` |
| Meta Computer Use | `agents.meta-computer-use.run`, `agents.meta-computer-use.read`, `agents.meta-computer-use.stop` |
| Grok Computer Use | `agents.grok-computer-use.run`, `agents.grok-computer-use.read`, `agents.grok-computer-use.stop` |
| Jev | `agents.jev.run`, `agents.jev.read`, `agents.jev.stop` |

#### 3. Browser Sessions (`browser`)

| Scope | Access |
| - | - |
| `browser.sessions.create` | Create hosted browser sessions. |
| `browser.sessions.read` | List sessions and read session details, connection info, and credit usage. |
| `browser.sessions.update` | Extend or update active sessions and evaluate CAPTCHAs. |
| `browser.sessions.stop` | Stop one or all active sessions. |
| `browser.sessions.logs.read` | Read session event logs. |
| `browser.sessions.media.read` | Read web/video recordings and download URLs. |
| `browser.sessions.uploads.write` | Upload files into active browser sessions. |
| `browser.sessions.snapshots.create` | Capture browser session snapshots. |

#### 4. Sandboxes and VM Resources (`sandboxes`)

| Feature | Scopes | Access |
| - | - | - |
| Sandboxes | `sandboxes.create`, `sandboxes.read`, `sandboxes.stop` | Create, inspect, list, and stop sandboxes. |
| Persistent Mac disks | `disks.create`, `disks.read`, `disks.delete` | Create, list, and delete persistent macOS disks. |
| Ports & networking | `sandboxes.ports.manage`, `sandboxes.network.manage` | Expose/unexpose ports and update outbound network policies. |
| Sandbox snapshots & auth | `sandboxes.snapshots.create`, `sandboxes.runtime-auth.create` | Capture memory snapshots and issue sandbox runtime browser auth. |
| Volumes | `volumes.create`, `volumes.read`, `volumes.delete` | Create, inspect, and delete persistent volumes. |
| Secrets & vaults | `secrets.read`, `secrets.manage`, `secrets.use` | List metadata (`read`), create/update/delete secrets and vaults (`manage`), or expose secret values to sandbox processes and browser autofill (`use`). |
| Sandbox images | `firecracker.images.read`, `firecracker.images.delete`, `firecracker.image-builds.manage` | List/delete custom images and manage image builds. |
| Sandbox snapshots | `firecracker.snapshots.read`, `firecracker.snapshots.delete` | List, read, and delete sandbox snapshots. |

> [!WARNING]
>
> Treat `secrets.use` as high-privilege: any API key that can execute commands in a sandbox attached to secrets—or call browser credential fill—can access those secret values at runtime. See [Security](https://hyperbrowser.ai/docs/platform/security.md) for details.

#### 5. Reusable Browser Resources (`resources`)

| Feature | Scopes | Access |
| - | - | - |
| Profiles | `profiles.create`, `profiles.read`, `profiles.update`, `profiles.delete`, `profiles.fork` | Manage and fork persistent browser profiles. |
| Extensions | `extensions.create`, `extensions.read`, `extensions.delete` | Upload, inspect, and delete browser extensions. |

#### 6. Network and Usage (`network-and-usage`)

| Feature | Scopes | Access |
| - | - | - |
| Static IPs | `static-ips.read`, `static-ips.allocate`, `static-ips.update`, `static-ips.delete` | Manage dedicated static IP allocations and regions. |
| Usage & history | `usage.read` | Read team credit balance (`GET /api/team/credit-info`), job usage (`GET /api/usage/job/:id`), and aggregate job history. |

***

## OAuth 2.0 (Hosted MCP)

When connecting coding agents or desktop clients to Hyperbrowser's hosted MCP server, clients authenticate via OAuth 2.0 instead of pasting a static API key:

* **Web tools (recommended):** `https://mcp.hyperbrowser.ai/mcp/web`
* **Full hosted MCP (includes admin and usage tools):** `https://mcp.hyperbrowser.ai/mcp`

OAuth access tokens are sent as `Authorization: Bearer <token>` and scoped to the MCP resource. Requests outside the token's granted MCP scopes return `403 Forbidden` with `{"error": "MCP_SCOPE_DENIED"}`. See the [MCP Server guide](https://hyperbrowser.ai/docs/mcp/overview.md) for client setup.

***

## X402 Payment & Session Tokens

Agents can pay per request with USDC on supported EVM or Solana networks—with no Hyperbrowser account or API key—via the `/x402/*` endpoints:

* `POST /x402/web/fetch` — Pay per page fetch.
* `POST /x402/web/search` — Pay per web search.
* `POST /x402/session` — Purchase a 5–60 minute browser session upfront.

Purchasing a session via `POST /x402/session` returns two distinct tokens:

1. **Browser connection credentials** (`wsEndpoint`, `liveUrl`, `computerActionEndpoint`, and `token` for WebDriver via `x-hyperbrowser-token`) — Used only to connect to that browser.
2. **`managementToken`** — A scoped Bearer JWT sent in `Authorization: Bearer <managementToken>` to inspect (`GET /x402/session/{id}`) or stop (`PUT /x402/session/{id}/stop`) that single purchased session without paying again. It remains valid for 24 hours and cannot access regular `/api/*` endpoints.

See the [X402 Overview](https://hyperbrowser.ai/docs/integrations/x402/overview.md) and [Sessions with X402](https://hyperbrowser.ai/docs/integrations/x402/sessions.md) for working examples.

***

## Next Steps

> [card] [Rate Limits & Errors](https://hyperbrowser.ai/docs/platform/rate-limits-and-errors.md)
>
> Status codes, rate limits, retries, and pagination.

> [card] [Usage & Credits](https://hyperbrowser.ai/docs/platform/usage-and-credits.md)
>
> Query team credit balances and per-job usage.

> [card] [Security](https://hyperbrowser.ai/docs/platform/security.md)
>
> Secrets, vaults, and egress policies.


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