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

# Browsers (hx browser)

> Create, inspect, control, stream logs, fill credentials, and invoke WebMCP tools on browser sessions with hx

Use `hx browser` (alias: `hx browsers`) to manage cloud browser sessions directly from your terminal.

***

## Lifecycle Commands

| Command | Description |
| - | - |
| `hx browser create` | Create a new browser session (supports stealth, proxy, egress rules, profiles, credentials, WebMCP, and Web Bot Auth). |
| `hx browser list` (`ls`) | List browser sessions (`--status`, `--page`, `--limit`, `--search`, `--job-id`). |
| `hx browser get <session-id>` | Get full session details, including connection endpoints (`--reveal` to print sensitive tokens). |
| `hx browser info <session-id>` | Show session metadata and launch configuration. |
| `hx browser open <session-id>` | Open the session's Live View URL in your local browser (`--print-url-only` to print without opening). |
| `hx browser stop [<session-id> ...]` | Stop one or more sessions, or stop all active sessions (`--all`, `--force`). |

### Create & Open a Session

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Create a standard session and open Live View immediately
hx browser create --open

# Create with stealth, US proxy, CAPTCHA solving, and 1920x1080 screen
hx browser create \
  --stealth \
  --proxy \
  --proxy-country US \
  --solve-captchas \
  --screen 1920x1080 \
  --timeout 30

# Reuse a profile and block ads
hx browser create --profile-id <profile-id> --adblock --accept-cookies

# Configure outbound network rules
hx browser create --allow-internet=false --allow-out api.example.com --allow-out 1.1.1.1

# Enable Web Bot Auth or WebMCP
hx browser create --web-bot-auth --web-bot-auth-only-domain example.com
hx browser create --webmcp

# Pass a raw CreateSession JSON body
hx browser create --json-body '{"useStealth":true,"browserMemorySize":"medium"}'
```

The same limits as the API apply; see [Session Parameters](https://hyperbrowser.ai/docs/sessions/parameters.md).

### Verified `hx browser create` Flags

* **Runtime & region:** `--region`, `--timeout`, `--profile-id`, `--open`, `--json-body`
* **Stealth, proxy & network:** `--stealth`, `--ultra-stealth`, `--proxy`, `--proxy-country`, `--use-residential-proxy`, `--proxy-route`, `--allow-internet`, `--allow-out`, `--deny-out`, `--web-bot-auth`, `--web-bot-auth-only-domain`
* **Browser UX & recording:** `--adblock`, `--solve-captchas`, `--accept-cookies`, `--recording`, `--screen`, `--screen-width`, `--screen-height`, `--webmcp`
* **Credentials:** `--credential`, `--vault`, `--1password-token`

***

## Read Browser Diagnostic Logs (`hx browser logs`)

List or stream diagnostic logs from a VM-backed browser session. Omit `[type]` to list available log streams, or pass a type such as `chrome`, `captcha`, `proxy`, `window-manager`, `vnc`, `selenium`, `ffmpeg`, `port-forward`, or `xvfb`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx browser logs <session-id>
hx browser logs <session-id> chrome --tail 500
hx browser logs <session-id> captcha --follow
hx browser logs <session-id> proxy --all
```

Flags: `--tail` (default 200 lines), `--all`, `--follow`.

***

## Fill Credentials (`hx browser fill`)

Attach secrets, vaults, or a 1Password service account token at creation time and fill login inputs without exposing secret values to your terminal or agent:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Fill a vault into multiple inputs
hx browser create --vault github-login
hx browser fill <session-id> --vault github-login \
  --field USERNAME=#login_field \
  --field PASSWORD=#password

# Fill a single secret on a specific tab
hx browser create --credential github-password
hx browser fill <session-id> --credential github-password \
  --selector '#password' \
  --page-url https://github.com/login

# Fill directly from 1Password
hx browser create --1password-token op-token
hx browser fill <session-id> \
  --1password-token op-token \
  --1password-vault "Dev Vault for Testing" \
  --allowed-origin https://www.scrapingcourse.com \
  --1password-ref "scrapingcourse login/username" --selector '#email' \
  --1password-ref "scrapingcourse login/password" --selector '#password'
```

Supported targeting flags on `hx browser fill`: `--page-id`, `--page-url`, `--frame-url`. See [Credential Fill](https://hyperbrowser.ai/docs/sessions/credentials.md) for allowed-origin rules and outcomes.

***

## WebMCP Tools (`hx browser webmcp`)

Discover and invoke page-provided [WebMCP](https://hyperbrowser.ai/docs/sessions/webmcp.md) tools inside a session created with `--webmcp`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Discover tools exposed on the current page
hx browser webmcp list <session-id>

# Invoke a tool synchronously
hx browser webmcp invoke <session-id> <tool-ref> \
  --input '{"query":"shoes"}' \
  --timeout 60

# Start a long-running invocation without blocking, then poll or cancel
hx browser webmcp start <session-id> <tool-ref> \
  --input '{"query":"shoes"}' \
  --timeout 600
hx browser webmcp result <session-id> <invocation-id> --wait 30
hx browser webmcp cancel <session-id> <invocation-id>
```


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