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

# Secrets & Vaults (hx secrets / vaults)

> Create and manage encrypted secrets, vaults, and 1Password tokens and inject them into sandboxes or browser sessions

Use `hx secrets` (alias: `hx secret`) and `hx vaults` (alias: `hx vault`) to store encrypted values and attach them cleanly to sandbox processes or browser sessions. Secret values are read from files or stdin and are never returned by the API.

***

## Manage Secrets (`hx secrets`)

| Command | Flags | Description |
| - | - | - |
| `hx secrets create <name>` | `--from-file`, `--stdin`, `--type`, `--description`, `--allowed-origin` | Create a new secret (supports `--type totp` and `--type op_token`). |
| `hx secrets set <name\|id>` | `--from-file`, `--stdin` | Add a new version to an existing secret. |
| `hx secrets list` (`ls`) | `--page`, `--limit`, `--search`, `--type` | List secrets and metadata. |
| `hx secrets get <name\|id>` | — | Inspect secret metadata, versions, and allowed origins. |
| `hx secrets update <name\|id>` | `--description`, `--allowed-origin`, `--clear-allowed-origins` | Update metadata or browser allowed origins. |
| `hx secrets delete-version <name\|id> <version>` | `--force` | Delete a specific secret version. |
| `hx secrets delete <name\|id>` | `--force` | Delete a secret (must not be referenced by a vault). |

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Create a standard secret from a file or stdin
hx secrets create provider-key --from-file ./provider-key.txt --description "Upstream API key"
printf '%s' "$NEW_KEY" | hx secrets set provider-key --stdin

# Create a TOTP seed or 1Password service account token
hx secrets create ci-otp --type totp --from-file ./otp-seed.txt
printf '%s' "$OP_SERVICE_ACCOUNT_TOKEN" | hx secrets create op-token --type op_token --stdin

# Restrict a secret to specific browser origins for credential fill
hx secrets create github-password --allowed-origin https://github.com --from-file ./password.txt
hx secrets update github-password --allowed-origin https://github.com --allowed-origin https://*.github.com

# Inspect and clean up
hx secrets ls --type totp
hx secrets get provider-key
hx secrets delete-version provider-key 1
hx secrets delete provider-key --force
```

> [!NOTE]
>
> `hx secrets get` and `hx vaults get` indicate when a secret is [customer-protected](https://hyperbrowser.ai/docs/sandboxes/customer-keys.md). The CLI can list and inspect customer-protected secrets, but cannot unwrap them or add new versions—use the Node.js or Python SDK for those operations.

***

## Manage Vaults (`hx vaults`)

Group multiple secrets into a reusable vault so you can attach them together by name:

| Command | Flags | Description |
| - | - | - |
| `hx vaults create <name>` | `--entry`, `--description` | Create a vault with `ENV_NAME=secret-name[@version]` entries. |
| `hx vaults list` (`ls`) | `--page`, `--limit`, `--search` | List vaults. |
| `hx vaults get <name\|id>` | — | Inspect vault entries and metadata. |
| `hx vaults update <name\|id>` | `--entry`, `--remove`, `--description` | Add/replace entries or drop an entry with `--remove`. |
| `hx vaults delete <name\|id>` | `--force` | Delete a vault. |

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx vaults create app-env --entry DB_URL=app-db-url --entry API_KEY=provider-key@2
hx vaults ls
hx vaults get app-env
hx vaults update app-env --entry API_KEY=provider-key --remove DB_URL
hx vaults delete app-env --force
```

***

## Inject Secrets into Sandboxes

Pass individual secrets (`--secret`, `--secret-version`), vaults (`--vault`), or 1Password fields (`--1password-token`, `--1password-vault`, `--1password-field`) to `hx vm create`, `hx vm exec`, or `hx vm process start`. When both `--vault` and `--secret` are supplied, `--secret` wins on name collisions.

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# Inject individual secrets or a pinned version
hx vm exec <sandbox-id> --secret API_KEY=provider-key -- node app.js
hx vm process start <sandbox-id> --secret API_KEY=provider-key --secret-version API_KEY=2 'node worker.js'
hx vm create my-image --secret API_KEY=provider-key

# Inject a whole vault (with optional per-var override)
hx vm exec <sandbox-id> --vault app-env -- node app.js
hx vm create my-image --vault app-env --secret API_KEY=provider-key-staging

# Read fields from 1Password at process start
hx vm exec <sandbox-id> \
  --1password-token op-token \
  --1password-vault "Dev Vault for Testing" \
  --1password-field SC_USER="scrapingcourse login/username" -- node app.js
```

***

## Fill Credentials in Browser Sessions

Attach secrets, vaults, or a 1Password token when creating a browser session and fill login forms on their allowed origins with `hx browser fill`:

```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
hx vaults create github-login --entry USERNAME=github-username --entry PASSWORD=github-password
hx browser create --vault github-login
hx browser fill <session-id> --vault github-login \
  --field USERNAME=#login_field \
  --field PASSWORD=#password
```

See [Browsers (`hx browser fill`)](https://hyperbrowser.ai/docs/cli/browsers#fill-credentials-hx-browser-fill), [Secrets](https://hyperbrowser.ai/docs/sandboxes/secrets.md), [Vaults](https://hyperbrowser.ai/docs/sandboxes/vaults.md), [1Password](https://hyperbrowser.ai/docs/sandboxes/1password.md), and [Credential Fill](https://hyperbrowser.ai/docs/sessions/credentials.md) for full rules and limits.


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