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

# Batch Fetch

> Fetch multiple URLs concurrently in a single asynchronous job

Batch Fetch loads an array of URLs concurrently in cloud browsers and returns the outputs you choose—markdown, HTML, links, screenshots, structured JSON, or a branding profile—for each URL. It shares the same output, browser, navigation, and caching controls as [Fetch](https://hyperbrowser.ai/docs/web/fetch.md).

> [!NOTE]
>
> Batch Fetch jobs require a **Scale**, **Ultra**, or **Custom** plan (requests on lower plans return HTTP `402`). The maximum number of URLs per job and concurrent batch-fetch jobs depend on your plan.

***

## Quick Start

**1. Install the SDK**

```bash npm theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
npm install @hyperbrowser/sdk
```

```bash yarn theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
yarn add @hyperbrowser/sdk
```

```bash pip theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
pip install hyperbrowser
```

```bash uv theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
uv add hyperbrowser
```

**2. Start a batch fetch job and wait for results**

```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 result = await client.web.batchFetch.startAndWait({
  urls: [
    "https://example.com",
    "https://example.org",
    "https://example.net",
  ],
  outputs: {
    formats: ["markdown", "links"],
  },
});

for (const page of result.data ?? []) {
  console.log(page.url, page.status, page.statusCode);
}
```

```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"])

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

for page in result.data or []:
    print(page.url, page.status, page.status_code)
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
# 1. Start a batch fetch job
curl -X POST https://api.hyperbrowser.ai/api/web/batch-fetch \
  -H 'Content-Type: application/json' \
  -H "x-api-key: $HYPERBROWSER_API_KEY" \
  -d '{
    "urls": [
      "https://example.com",
      "https://example.org"
    ],
    "outputs": {
      "formats": ["markdown", "links"]
    }
  }'

# 2. Poll job status
curl https://api.hyperbrowser.ai/api/web/batch-fetch/<JOB_ID>/status \
  -H "x-api-key: $HYPERBROWSER_API_KEY"

# 3. Fetch paginated results once completed
curl "https://api.hyperbrowser.ai/api/web/batch-fetch/<JOB_ID>?page=1&batchSize=20" \
  -H "x-api-key: $HYPERBROWSER_API_KEY"
```

***

## Endpoints & SDK Methods

Batch Fetch is asynchronous. Start a job, poll status until `completed` or `failed`, and retrieve paginated results (or use `startAndWait` / `start_and_wait` in the SDKs).

| Operation | REST Endpoint | Required Scope | Node SDK | Python SDK |
| - | - | - | - | - |
| Start job | `POST /api/web/batch-fetch` | `web.batch-fetch.run` | `client.web.batchFetch.start(params)` | `client.web.batch_fetch.start(params)` |
| Check status | `GET /api/web/batch-fetch/{id}/status` | `web.batch-fetch.read` | `client.web.batchFetch.getStatus(id)` | `client.web.batch_fetch.get_status(job_id)` |
| Get results | `GET /api/web/batch-fetch/{id}` | `web.batch-fetch.read` | `client.web.batchFetch.get(id, params)` | `client.web.batch_fetch.get(job_id, params)` |
| Start & poll | — | `web.batch-fetch.run`, `web.batch-fetch.read` | `client.web.batchFetch.startAndWait(params, returnAllPages)` | `client.web.batch_fetch.start_and_wait(params, return_all_pages)` |
| List jobs | `GET /api/web/batch-fetch` | `web.batch-fetch.read` | — | — |

### Non-blocking Polling Pattern

Use `start`, `getStatus`, and `get` directly when you want to persist `jobId` in your own queue or process results page by page:

```typescript TypeScript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const { jobId } = await client.web.batchFetch.start({
  urls: ["https://example.com", "https://example.org"],
  outputs: { formats: ["markdown"] },
});

const { status } = await client.web.batchFetch.getStatus(jobId);
if (status === "completed") {
  const page1 = await client.web.batchFetch.get(jobId, {
    page: 1,
    batchSize: 50,
  });
  console.log(page1.data);
}
```

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
job = client.web.batch_fetch.start(
    {
        "urls": ["https://example.com", "https://example.org"],
        "outputs": {"formats": ["markdown"]},
    }
)

status = client.web.batch_fetch.get_status(job.job_id)
if status.status == "completed":
    page1 = client.web.batch_fetch.get(
        job.job_id, {"page": 1, "batch_size": 50}
    )
    print(page1.data)
```

***

## Response

Starting a job returns:

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "jobId": "962372c4-a140-400b-8c26-4ffe21d9fb9c"
}
```

Once complete, `GET /api/web/batch-fetch/{jobId}` returns per-URL results in `data` along with pagination metadata:

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "jobId": "962372c4-a140-400b-8c26-4ffe21d9fb9c",
  "status": "completed",
  "totalPages": 2,
  "totalPageBatches": 1,
  "currentPageBatch": 1,
  "batchSize": 20,
  "data": [
    {
      "url": "https://example.com/",
      "status": "completed",
      "statusCode": 200,
      "finalUrl": "https://example.com/",
      "metadata": {
        "title": "Example Domain",
        "sourceURL": "https://example.com/"
      },
      "markdown": "# Example Domain\n\n..."
    },
    {
      "url": "https://example.org/",
      "status": "completed",
      "statusCode": 200,
      "finalUrl": "https://example.org/",
      "markdown": "# Example Domain\n\n..."
    }
  ]
}
```

The job-level `status` can be `pending`, `running`, `completed`, or `failed`. Each item in `data` also carries its own `status`, optional `error`, `statusCode`, and `finalUrl`. Always check `page.status` and `page.statusCode` before ingesting a page's content.

***

## Parameters

| Field | Type | Required | Description |
| - | - | - | - |
| `urls` | `string[]` | Yes | Non-empty array of URLs to fetch (capped by your plan's `maxBatchScrapeUrls`). |
| `stealth` | `string` | No | Stealth mode: `"none"`, `"auto"` (default), or `"ultra"`. |
| `outputs` | `object` | No | Output formats (`markdown`, `html`, `links`, `screenshot`, `json`, `branding`), `sanitize`, `includeSelectors`, `excludeSelectors`, and `storageState`. See [Fetch outputs](https://hyperbrowser.ai/docs/web/fetch.md#outputs). |
| `browser` | `object` | No | Browser configuration: `screen`, `profileId`, `solveCaptchas`, `operatingSystem`, `disableSoftwareWebGL`, `location`, plus REST options `acceptCookies`, `region`, `solverType`. See [Fetch browser options](https://hyperbrowser.ai/docs/web/fetch.md#browser-and-stealth). |
| `navigation` | `object` | No | `waitUntil` (`"domcontentloaded"`, `"load"`, `"networkidle"`), `waitFor` (0–30000 ms), `timeoutMs` (1–60000 ms). |
| `cache` | `object` | No | `maxAgeSeconds` (0–604800). Set `0` to bypass cache reads. |

> [!NOTE]
>
> Interactive page `actions` are supported on single-page [Fetch](https://hyperbrowser.ai/docs/web/fetch.md#interactive-actions) requests, not on Batch Fetch or Crawl jobs.

***

## Pagination

When calling `GET /api/web/batch-fetch/{jobId}` directly:

| Query parameter | Type | Default | Range | Description |
| - | - | - | - | - |
| `page` | `number` | `1` | `>= 1` | 1-indexed batch page to retrieve. |
| `batchSize` | `number` | `20` | `1–100` | Number of URL results returned per batch. |

When using `startAndWait` / `start_and_wait`, `returnAllPages` / `return_all_pages` defaults to `true`, which automatically walks every page batch (`batchSize: 100`) and returns all results in `result.data`.

***

## Batch Fetch vs. Crawl

* Use **Batch Fetch** when you already have a known list of URLs to fetch in parallel (for example, product URLs from a database or top results from [Search](https://hyperbrowser.ai/docs/web/search.md)).
* Use **[Crawl](https://hyperbrowser.ai/docs/web/crawl.md)** when you start from a root URL and want Hyperbrowser to discover linked pages automatically via sitemaps and link traversal.


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