# Batch scraping API

> One call. Up to 10 URLs. Billed only for the ones that land.

- Endpoint: `POST https://scrapenest.dev/v1/scrape/batch`
- Price: Tiered · per URL
- Category: Utilities
- Reference: https://scrapenest.dev/docs#ep-batch
- Web page: https://scrapenest.dev/catalog/scrape-batch
- Updated: 2026-11-04

Hand us a list of up to 10 URLs and get back one array of results, fetched concurrently. Each URL carries its own status, cleaned text, proxy tier, and credit line, so a slow or blocked page never holds up — or fails — the rest. The render options you set apply to every URL in the batch.

## The hard part

Fanning out a list of URLs yourself means juggling a concurrency pool, per-URL retries, partial failures, and a rate limiter so you don't trip the target. Then you still have to stitch the results back together and reason about which ones to bill. We fan out concurrently, isolate each failure, and hand back one array with a per-URL bill.

## Batch scraping API: what you get

- Up to 10 URLs per call, fetched concurrently.
- Each URL gets its own row: `status_code`, `method`, `proxy_used`, `text`, and `credits_charged`.
- One URL failing never fails the batch — undeliverable URLs return an `error` and bill 0; a delivered 404 bills 1 credit.
- Shared options apply to every URL: `render`, `force_proxy`, `country`, `return_markdown`, `include_html`, `block_ads`.
- `succeeded` plus a per-URL `credits_charged` make the bill obvious.
- Same anti-bot escalation and tier-aware pricing as Any URL.

## Batch scraping API use cases

- **Refresh a list of pages**: Re-read a set of product, pricing or docs pages in one request and compare the `text` each one returns.
- **Read search results in bulk**: Take the URLs from a search and fetch their text together, one row per URL.
- **Link checks**: Read each row's `status_code`, `final_url` and `error` to find dead or redirected links.

## Batch scraping API quickstart

Install an SDK with `pip install scrapenest` or `npm install scrapenest`, or call the HTTP API directly with your key in the `Authorization: Bearer` header. No key yet? Sign up free at https://scrapenest.dev/signup, verify your email, then create a key in your dashboard.

### Python SDK

```python
import os
from scrapenest import Client

client = Client(os.environ["SCRAPENEST_API_KEY"], timeout=120)
batch = client.scrape_batch(["https://example.com", "https://example.org"], render="auto")
print(batch.succeeded, "/", batch.requested, "-", batch.credits_charged, "credits")
for item in batch.results:
    print(item.url, item.success, item.status_code, item.error)
```

### Node SDK

```javascript
import { ScrapeNest } from "scrapenest";

const client = new ScrapeNest({ apiKey: process.env.SCRAPENEST_API_KEY, timeout: 120_000 });
const batch = await client.scrapeBatch({
  urls: ["https://example.com", "https://example.org"],
  render: "auto",
});
console.log(`${batch.succeeded}/${batch.requested} - ${batch.credits_charged} credits`);
for (const item of batch.results) console.log(item.url, item.success, item.status_code, item.error);
```

### curl

```bash
curl -X POST https://scrapenest.dev/v1/scrape/batch \
  -H "Authorization: Bearer sn_••••" \
  -H "Content-Type: application/json" \
  -d '{ "urls": ["https://example.com", "https://example.org"], "render": "auto" }'
```

### Python (httpx)

```python
import httpx

r = httpx.post(
    "https://scrapenest.dev/v1/scrape/batch",
    headers={"Authorization": "Bearer sn_••••"},
    json={
        "urls": [
            "https://example.com",
            "https://example.org",
        ],
        "render": "auto",
    },
    timeout=120,
)
data = r.json()
print(data["succeeded"], "/", data["requested"], "ok")
for row in data["results"]:
    print(row["status_code"], row["url"])
```

### JavaScript (fetch)

```javascript
const r = await fetch("https://scrapenest.dev/v1/scrape/batch", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sn_••••",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    urls: ["https://example.com", "https://example.org"],
    render: "auto",
  }),
});
const data = await r.json();
console.log(`${data.succeeded}/${data.requested} ok`);
```

### Go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    body, _ := json.Marshal(map[string]any{
        "urls":   []string{"https://example.com", "https://example.org"},
        "render": "auto",
    })
    req, _ := http.NewRequest("POST",
        "https://scrapenest.dev/v1/scrape/batch", bytes.NewReader(body))
    req.Header.Set("Authorization", "Bearer sn_••••")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    var out struct {
        Requested int `json:"requested"`
        Succeeded int `json:"succeeded"`
    }
    json.NewDecoder(resp.Body).Decode(&out)
    fmt.Printf("%d/%d ok\n", out.Succeeded, out.Requested)
}
```

## Batch scraping API request and response

### Request body

```json
{
  "urls": [
    "https://example.com",
    "https://example.org"
  ],
  "render": "auto"
}
```

### Response

```json
{
  "results": [
    {
      "url": "https://example.com",
      "final_url": "https://example.com/",
      "status_code": 200,
      "method": "fetch",
      "proxy_used": "datacenter",
      "elapsed_ms": 412,
      "title": "Example Domain",
      "text": "Example Domain. This domain is for use in examples …",
      "cache_hit": false,
      "escalated": false,
      "ok": true,
      "credits_charged": 1,
      "success": true
    },
    {
      "url": "https://example.org",
      "elapsed_ms": 88,
      "cache_hit": false,
      "escalated": false,
      "ok": false,
      "credits_charged": 0,
      "error": "upstream_failed",
      "success": false
    }
  ],
  "requested": 2,
  "succeeded": 1,
  "credits_charged": 1
}
```

Fields with no value are left out of the JSON rather than sent as `null`, so read optional fields defensively.

## Batch scraping API pricing

Each URL is billed exactly like Any URL — at the tier that actually rendered it (1 credit for a plain fetch, up to 40 for a full stealth render). Undeliverable URLs don't bill; a delivered 404 'not found' bills 1 credit. Your total is the sum of the per-URL charges.

- For a single URL, use Any URL (/v1/scrape/url) — same engine, simpler response.
- Need AI extraction or extract_rules per URL? Call Any URL individually; batch is built for bulk fetch.

## Batch scraping API limits

- 1 to 10 URLs per call, fetched five at a time, so a full batch runs in about two waves.
- One budget of about 100 s from the start of the batch. Each URL's retries get at most 45 s, and a stealth retry only starts while 20 s of the budget remain.
- No `timeout_seconds`, `cache_ttl_seconds`, `ai_query` or `extract_rules`: use the single-URL endpoint for those.
- Shared options apply to every URL: `render`, `auto_escalate`, `force_proxy`, `country`, `return_markdown`, `markdown_mode`, `include_html`, `block_ads`, `block_assets` and `extract`.
- A batch whose worst case would push the account past the 5,000-credit overage floor is refused before anything is fetched.

## Batch scraping API error codes

| HTTP | Code | Meaning |
| --- | --- | --- |
| 402 | `insufficient_credits` | The batch's worst-case cost would pass the overage floor. Nothing is fetched. |
| 422 | `validation_error` | No URLs, more than 10, or an invalid option. |
| 200 (per URL) | `anti_bot_block, empty_response, rate_limited` | Set on the failed row's `error_code`. That row bills 0; the rest are unaffected. |
| 200 (per URL) | `connection_failed, country_unavailable, bandwidth_cap_exceeded, upstream_failed` | Also set per row and not billed. Here `upstream_failed` means the target answered a bare 503. |
| 200 (per URL) | `no error_code` | Timeouts, delivered 404s, unsafe URLs and fetch-service errors set only `error`, such as `http_404`, `fetch_failed`, `unsafe_url: …` or `upstream_failed`. Read `status_code` and `error` for those. |

Every endpoint can also return `401 unauthorized` (missing or wrong key), `402 insufficient_credits` (balance used up), `403 email_not_verified` (an email signup must verify its address before its key works) and `429 rate_limited` or `concurrency_limit_exceeded`. All errors share one JSON envelope; see the [error reference](https://scrapenest.dev/docs#errors).

## Batch scraping API FAQ

### How many URLs can one batch call take?

Up to 10. They are fetched concurrently, five at a time, and every URL gets its own row with `success`, `status_code`, `text` and `credits_charged`.

### Does one failed URL fail the whole batch?

No. A blocked, slow or malformed URL fails only its own row, which bills 0 credits. The other rows come back normally, and `succeeded` counts the ones that delivered.

### How is a batch billed?

Each URL is billed like a single scrape, at the tier that delivered it (1 to 40 credits), and the top-level `credits_charged` is the sum. A delivered 404 bills 1; undeliverable URLs bill 0.

### When should I scrape URLs one at a time instead?

When you need `ai_query`, `extract_rules`, custom `headers` or `cookies`, a `timeout_seconds` you control, or the full `error_code` vocabulary. Batch is built for bulk fetches that share one set of options.

## Related endpoints

- [Web scraping API for any URL](https://scrapenest.dev/catalog/scrape-url.md): `POST /v1/scrape/url`. Point us at a page. We get past the wall and hand back the rendered HTML and clean text.
- [Deep Search API for RAG](https://scrapenest.dev/catalog/search-deep.md): `POST /v1/search/deep`. Search plus auto-fetch the top N pages with extracted text. One round-trip for RAG.
- [Website screenshot API](https://scrapenest.dev/catalog/screenshot.md): `POST /v1/scrape/screenshot`. Capture a screenshot of any public URL and get back base64-encoded PNG or JPEG. Viewport or full-page, with auto-fallback for hostile sites.

## Get 1,000 free credits

Every account starts on the Free plan: 1,000 credits a month, no card. Verify your email, then mint an API key and make this call. Sign up at https://scrapenest.dev/signup.
