@browserbasehq/cli
v0.5.7
Published
Browserbase CLI for platform APIs, functions, and browse passthrough.
Keywords
Readme
Browserbase CLI
The official CLI for Browserbase. Manage sessions, deploy serverless functions, browse the web, and interact with the full Browserbase platform from your terminal.
Installation
npm install -g @browserbasehq/cliRequires Node.js 18+.
Quick Start
# Set your API key
export BROWSERBASE_API_KEY=bb_live_...
# Fetch a webpage
bb fetch https://example.com
# Search the web
bb search "browserbase documentation"
# Browse interactively
bb browse https://example.com
# List your sessions
bb sessions listCommands
bb fetch <url>
Retrieve webpage content without a full browser session.
bb fetch https://example.com
bb fetch https://example.com --output page.json
bb fetch https://example.com --proxies --allow-redirects| Flag | Description |
|------|-------------|
| --output <path> | Write response to file |
| --proxies | Enable Browserbase proxy support |
| --allow-redirects | Follow HTTP redirects |
| --allow-insecure-ssl | Bypass TLS certificate verification |
bb search <query>
Search the web using the Browserbase Search API.
bb search "web automation tools"
bb search "browserbase" --num-results 5| Flag | Description |
|------|-------------|
| --num-results <n> | Number of results (1-25, default 10) |
| --output <path> | Write results to file |
bb browse [args...]
Launch a browser session. Forwards to the @browserbasehq/browse-cli package (auto-installs on first use).
bb browse https://example.com
bb browse --yes # skip install promptbb sessions
Manage remote browser sessions.
bb sessions list # List all sessions
bb sessions list --q "status=RUNNING" # Filter by metadata
bb sessions get <session-id> # Get session details
bb sessions create --body '{"projectId":"..."}'
bb sessions update <id> --status REQUEST_RELEASE
bb sessions debug <id> # Get debugger connection URLs
bb sessions logs <id> # View session logs
bb sessions recording <id> # Get rrweb recording events
bb sessions downloads get <id> # Download session artifacts (ZIP)
bb sessions uploads create <id> <file> # Upload a file to a sessionbb functions
Write and deploy serverless browser automation to the cloud.
# Scaffold a new project
bb functions init my-function
# Run locally
bb functions dev handler.ts --port 3000
# Deploy to Browserbase
bb functions publish handler.ts
bb functions publish handler.ts --dry-run # preview without deploying
# Invoke a deployed function
bb functions invoke <function-id> --params '{"url":"https://example.com"}'
bb functions invoke --check-status <invocation-id>| Subcommand | Description |
|------------|-------------|
| init [name] | Scaffold a Functions project (--package-manager npm\|pnpm) |
| dev <entry> | Start local dev server (--port, --host, --verbose) |
| publish <entry> | Deploy function (--dry-run) |
| invoke [id] | Invoke a function (--params, --no-wait, --check-status) |
bb projects
Manage Browserbase projects.
bb projects list
bb projects get <project-id>
bb projects usage <project-id>bb contexts
Persist browser state (cookies, localStorage) across sessions.
bb contexts create --body '{"projectId":"..."}'
bb contexts get <context-id>
bb contexts update <context-id> # Refresh upload URL
bb contexts delete <context-id>bb extensions
Manage Chrome extensions for remote sessions.
bb extensions upload extension.zip
bb extensions get <extension-id>
bb extensions delete <extension-id>bb skills
Install Browserbase agent skills for Claude Code.
bb skills # Interactive install
bb skills install # Non-interactive install
bb skills --yes # Auto-accept promptsConfiguration
| Environment Variable | Description |
|---------------------|-------------|
| BROWSERBASE_API_KEY | Your Browserbase API key (required) |
| BROWSERBASE_PROJECT_ID | Default project ID for Functions |
| BROWSERBASE_BASE_URL | Custom API base URL |
All environment variables can be overridden per-command with --api-key, --project-id, or --base-url flags.
Development
bun install
bun run cli -- --help # Run locally
bun run check # Type-check
bun run build # Build to dist/
bun run test # Build + run testsLicense
This project is licensed under the MIT License — see the LICENSE file for details.
