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

# Web API SDK Reference

> Node.js and Python SDK methods for Web API v2 (fetch, batchFetch, crawl, search) and legacy scraping endpoints

Use `client.web` for all new web extraction, crawling, and search integrations.

***

## Web API v2 (`client.web`)

| Operation | Node.js (`@hyperbrowser/sdk` 1.6.0) | Python (`hyperbrowser` 1.16.0) |
| - | - | - |
| Fetch single URL (sync) | `client.web.fetch(params)` | `client.web.fetch(params)` |
| Batch fetch — start | `client.web.batchFetch.start(params)` | `client.web.batch_fetch.start(params)` |
| Batch fetch — status | `client.web.batchFetch.getStatus(jobId)` | `client.web.batch_fetch.get_status(job_id)` |
| Batch fetch — get results | `client.web.batchFetch.get(jobId, params?)` | `client.web.batch_fetch.get(job_id, params=None)` |
| Batch fetch — start & wait | `client.web.batchFetch.startAndWait(params)` | `client.web.batch_fetch.start_and_wait(params)` |
| Crawl — start | `client.web.crawl.start(params)` | `client.web.crawl.start(params)` |
| Crawl — status | `client.web.crawl.getStatus(jobId)` | `client.web.crawl.get_status(job_id)` |
| Crawl — get results | `client.web.crawl.get(jobId, params?)` | `client.web.crawl.get(job_id, params=None)` |
| Crawl — start & wait | `client.web.crawl.startAndWait(params)` | `client.web.crawl.start_and_wait(params)` |
| Web Search (sync) | `client.web.search(params)` | `client.web.search(params)` |

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

const client = new Hyperbrowser({ apiKey: process.env.HYPERBROWSER_API_KEY });

const page = await client.web.fetch({
  url: "https://example.com",
  outputs: { formats: ["markdown", "links"] },
  actions: {
    mode: "bestEffort",
    steps: [{ type: "wait", until: "duration", durationMs: 500 }],
  },
});

const batch = await client.web.batchFetch.startAndWait({
  urls: ["https://example.com", "https://example.org"],
  outputs: { formats: ["markdown"] },
});

console.log(page.data?.markdown?.slice(0, 120), "Batch pages:", batch.data?.length);
```

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

client = Hyperbrowser(api_key=os.environ["HYPERBROWSER_API_KEY"])

page = client.web.fetch({
    "url": "https://example.com",
    "outputs": {"formats": ["markdown", "links"]},
    "actions": {
        "mode": "bestEffort",
        "steps": [{"type": "wait", "until": "duration", "duration_ms": 500}],
    },
})

batch = client.web.batch_fetch.start_and_wait({
    "urls": ["https://example.com", "https://example.org"],
    "outputs": {"formats": ["markdown"]},
})

print((page.data.markdown or "")[:120], "Batch pages:", len(batch.data or []))
```

***

## Legacy Scraping (Maintenance)

Existing integrations continue to work via `client.scrape` and `client.crawl` (each providing `start`, `getStatus`/`get_status`, `get`, and `startAndWait`/`start_and_wait`). For new workloads, use `client.web.fetch`, `client.web.batchFetch` (`batch_fetch`), and `client.web.crawl`. `client.extract` provides the same methods for the [Extract API](https://hyperbrowser.ai/docs/web-scraping/extract.md).


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