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

# Hyperbrowser CLI (hx)

> Unified command-line interface for Browser Sessions, Web API, Sandboxes, Secrets, and Vaults

The **`hx`** CLI is Hyperbrowser's unified terminal interface across all core surfaces: **Browser Sessions** (`hx browser`), **Web API** (`hx web`), **Linux & macOS Sandboxes** (`hx vm`), and **Secrets & Vaults** (`hx secrets`, `hx vaults`).

> [card] [Browsers (hx browser)](https://hyperbrowser.ai/docs/cli/browsers.md)
>
> Create, inspect, open, stop, read logs, fill credentials, and invoke WebMCP tools on browser sessions.

> [card] [Web API (hx web)](https://hyperbrowser.ai/docs/cli/web.md)
>
> Run sync or async Fetch, Crawl, and Search jobs, and inspect unified web job history.

> [card] [Sandboxes (hx vm)](https://hyperbrowser.ai/docs/cli/sandboxes.md)
>
> Manage Linux and macOS sandboxes, filesystems, logs, processes, terminals, volumes, images, snapshots, and disks.

> [card] [Secrets & Vaults (hx secrets / vaults)](https://hyperbrowser.ai/docs/cli/secrets.md)
>
> Store encrypted secrets, manage vaults, inject env vars into sandboxes, and fill credentials into browsers.

***

## Install

Install on macOS and Linux via Homebrew or the official install script:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
brew install hyperbrowserai/tap/hx
# or
curl -fsSL https://www.hyperbrowser.ai/cli/install.sh | sh
```

See [Install](https://hyperbrowser.ai/docs/sandboxes/install.md) for Windows PowerShell, version pinning, and direct binary download instructions. Check your installed version or self-update at any time:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx version
hx update
hx update --dry-run
```

`hx update` also accepts `--base-url`, `--allow-downgrade`, and `--no-verify`.

***

## Authentication & Profiles (`hx auth`, `hx configure`, `hx profile`)

Sign in interactively with your Hyperbrowser account, or save an API key directly:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Browser OAuth sign-in (saves to the default profile)
hx auth login

# Headless / SSH device-code flow
hx auth login --device --no-browser

# Save credentials to a named profile
hx auth login --profile dev

# Check current auth status or sign out
hx auth status
hx auth logout
```

To configure a profile directly with an API key (stored in `~/.hx_config/config`):

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx configure
hx configure --api-key "$HYPERBROWSER_API_KEY"
hx configure --print-path
```

List saved profiles and switch per command with `--profile`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx profile list
hx --profile dev vm list
```

`hx auth` also supports `--force` on login, and `hx configure` accepts `--base-url` when pointing at a custom endpoint.

***

## Global Flags

Global flags can be placed before any subcommand:

| Flag | Description |
| - | - |
| `--api-key <key>` | Override the API key for this invocation. |
| `--base-url <url>` | Override the Hyperbrowser API base URL. |
| `--profile <name>` | Use a named profile from `~/.hx_config/config` (defaults to `default`). |
| `--json` | Emit machine-readable JSON output for scripting and `jq` pipelines. |
| `--help-json` | Output command help metadata as JSON. |
| `--no-color` | Disable ANSI colors in terminal output. |
| `--debug` | Print verbose HTTP/diagnostic logging. |
| `--run-as <target>` | Override execution identity where supported. |

***

## Interactive Dashboard & Shell Completion

Launch the terminal UI dashboard (requires an interactive TTY):

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx dash
```

Generate shell completions for `bash`, `zsh`, `fish`, or `powershell`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx completion zsh > "${fpath[1]}/_hx"
hx completion bash > /etc/bash_completion.d/hx
hx completion fish > ~/.config/fish/completions/hx.fish
```


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