# Older addresses (still supported)

Built on `/scrape`, `/search` or `/recipes/...`? Nothing breaks. Each one is the same tool under `/tools/{id}`, at the same price. Use `/tools` for new code.

## Each older address and its tool

| Older address | The tool | Run it now with |
|---|---|---|
| `POST /scrape` | [scrape](https://crawl4ai.com/tools/scrape) | `POST /tools/scrape` |
| `POST /extract` | [extract](https://crawl4ai.com/tools/extract) | `POST /tools/extract` |
| `POST /site` | [site](https://crawl4ai.com/tools/site) | `POST /tools/site` |
| `POST /scan` | [scan](https://crawl4ai.com/tools/scan) | `POST /tools/scan` |
| `GET /search` | [search](https://crawl4ai.com/tools/search) | `POST /tools/search` |
| `GET /serp` | [serp](https://crawl4ai.com/tools/serp) | `POST /tools/serp` |
| `GET /answer` | [answer](https://crawl4ai.com/tools/answer) | `POST /tools/answer` |
| `POST /price` | [price](https://crawl4ai.com/tools/price) | `POST /tools/price` |
| `POST /monitors` | [watch](https://crawl4ai.com/tools/watch) | `POST /tools/watch` |
| `POST /lead/people/search and the other /lead addresses` | [lead](https://crawl4ai.com/tools/lead) | `POST /tools/lead` |
| `GET /verify, POST /verify, GET /verify/domain` | [verify](https://crawl4ai.com/tools/verify) | `POST /tools/verify` |
| `POST /recipes/{id}` | [every data tool](https://crawl4ai.com/tools?group=data) | `POST /tools/{id}` |

## What differs

- **Request:** `search`, `serp` and `answer` are `GET` with a query string (`1`/`0` for booleans); through `/tools` they are `POST` with a JSON body (`true`/`false`). `lead` and `verify` have one address per kind; through `/tools` one tool picks with `find` or `check`.
- **Reply:** an older address answers its own body with no envelope (for example `markdown` at the top level, not `data.markdown`); the cost is in the `x-c4-cost` header.
- **Jobs:** an older job is read at its own address (`/scrape/jobs/{id}`, `/site/jobs/{id}`, `/recipes/jobs/{id}`, `/verify/jobs/{id}`); every one of them also reads at `/tools/jobs/{id}`.
- **Kept only at the older address:** reading or changing a watch (`/monitors/...`), price history (`/price/history`), forgetting a verify answer.

Both are counted as the same tool in Usage.

## Scrape many pages in one call

### Request

curl:

```bash
# -N streams each result line as it lands
curl -N https://api.crawl4ai.com/scrape/batch \
  -H "Authorization: Bearer $CRAWL4AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://a.com", "https://b.com"], "format": "md"}'
```

Python:

```python
import json, os, requests

with requests.post(
    "https://api.crawl4ai.com/scrape/batch",
    headers={"Authorization": f"Bearer {os.environ['CRAWL4AI_API_KEY']}"},
    json={"urls": ["https://a.com", "https://b.com"], "format": "md"},
    stream=True,
) as r:
    for line in r.iter_lines():
        if line:
            row = json.loads(line)
            print(row["url"], "ok" if row["ok"] else row["error"])
```

Node:

```javascript
const res = await fetch("https://api.crawl4ai.com/scrape/batch", {
  method: "POST",
  headers: { "Authorization": `Bearer ${process.env.CRAWL4AI_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ urls: ["https://a.com", "https://b.com"], format: "md" }),
});

// read the NDJSON stream line by line
const reader = res.body.getReader(), dec = new TextDecoder();
let buf = "";
for (;;) {
  const { value, done } = await reader.read();
  if (done) break;
  buf += dec.decode(value, { stream: true });
  let nl;
  while ((nl = buf.indexOf("\n")) >= 0) {
    const line = buf.slice(0, nl); buf = buf.slice(nl + 1);
    if (line.trim()) {
      const row = JSON.parse(line);
      console.log(row.url, row.ok ? "ok" : row.error);
    }
  }
}
```

### Body

| Name | Type | Default | Description |
|---|---|---|---|
| urls* | string[] | - | The URLs to scrape (max 50 per call). |
| timeout | number | - | Seconds, 5 to 120: the limit of the WHOLE batch. Set it a little below your HTTP client timeout. Each URL gets the time left; a URL not done in time ends with `{"ok":false,"error":"sync_window_exceeded"}`, free. |
| … | - | - | Any [scrape](https://crawl4ai.com/tools/scrape) input (`format`, `proxy`, `country`, `parse`) applies to every URL. |



> **Note**
>
> Response is `application/x-ndjson`: one JSON line per URL as it completes. Each line carries its `cost` (credits) and `effort` at the top level, next to `result`; the stream ends with `{"summary":{"cost":"…","priced":N,"urls":N}}`, the whole batch's cost.



**Try it with your key**

Run it in the Toolkit and see the answer, the time and the credits.
[Open scrape in the Toolkit](https://crawl4ai.com/app/#toolkit/scrape)

## Bulk jobs

You can read a job from any region: `api.crawl4ai.com` finds it wherever it runs.

### Request

curl:

```bash
# 1. submit -> job id
JOB=$(curl -s https://api.crawl4ai.com/scrape/jobs \
  -H "Authorization: Bearer $CRAWL4AI_API_KEY" -H "Content-Type: application/json" \
  -d '{"urls": ["https://a.com", "https://b.com"]}' | jq -r .job_id)

# 2. poll until the job is done, or paused (stopped, or out of credit)
while :; do
  S=$(curl -s https://api.crawl4ai.com/scrape/jobs/$JOB \
       -H "Authorization: Bearer $CRAWL4AI_API_KEY" | jq -r .status)
  case "$S" in done|paused) break;; esac; sleep 2
done

# 3. fetch results (NDJSON, one line per URL)
curl -s https://api.crawl4ai.com/scrape/jobs/$JOB/results \
  -H "Authorization: Bearer $CRAWL4AI_API_KEY"
```

Python:

```python
import json, os, time, requests

H = {"Authorization": f"Bearer {os.environ['CRAWL4AI_API_KEY']}"}
base = "https://api.crawl4ai.com"

# 1. submit
job = requests.post(f"{base}/scrape/jobs", headers=H,
                    json={"urls": ["https://a.com", "https://b.com"]}).json()["job_id"]

# 2. poll until the job is done, or paused (stopped, or out of credit)
while requests.get(f"{base}/scrape/jobs/{job}", headers=H).json()["status"] not in ("done", "paused"):
    time.sleep(2)

# 3. page through the results
after = 0
while True:
    lines = requests.get(f"{base}/scrape/jobs/{job}/results?after={after}",
                         headers=H).text.splitlines()
    if not lines: break
    for line in lines: print(json.loads(line)["url"])
    after += len(lines)
```

Node:

```javascript
const H = { "Authorization": `Bearer ${process.env.CRAWL4AI_API_KEY}`, "Content-Type": "application/json" };
const base = "https://api.crawl4ai.com";

// 1. submit
const { job_id } = await (await fetch(`${base}/scrape/jobs`, {
  method: "POST", headers: H,
  body: JSON.stringify({ urls: ["https://a.com", "https://b.com"] }),
})).json();

// 2. poll until the job is done, or paused (stopped, or out of credit)
let status;
do {
  await new Promise(r => setTimeout(r, 2000));
  ({ status } = await (await fetch(`${base}/scrape/jobs/${job_id}`, { headers: H })).json());
} while (status !== "done" && status !== "paused");

// 3. fetch results (NDJSON)
const out = await (await fetch(`${base}/scrape/jobs/${job_id}/results`, { headers: H })).text();
console.log(out);
```

### Routes

| Route | Does |
|---|---|
| `POST /scrape/jobs` | Submit `urls` (max 10,000) + any /scrape field. Returns a `job_id`. An optional `Idempotency-Key` header makes a retry safe (below). |
| `GET /scrape/jobs/{id}` | Status + counts (pending / done / error). Add `?full=1` for per-URL detail. |
| `GET /scrape/jobs/{id}/results` | Streamed results, paged with `?after=N` (500 per page; add `&limit=N` for fewer, 1 to 500). Kept 3 days after the job ends, then the job id answers 404. |
| `POST /scrape/jobs/{id}/retry` | Re-run just the failed URLs. |

The same job also reads at `/tools/jobs/{id}`, `/tools/jobs/{id}/results`, `POST /tools/jobs/{id}/retry` and `DELETE /tools/jobs/{id}`.

### Retry a submit safely

A job is billed when it is accepted. If the answer to your submit is lost, send the same request again with
the same `Idempotency-Key` header: you get the first job back (`"duplicate": true`) and pay once.

- The key is 1 to 128 printable ASCII characters, with no space and none of `/ \ ? # %`. A UUID works.
- Use one new key per job. The key belongs to your account, so any of your API keys finds the job.
- A key outside this rule answers `400` with `{"error": "bad_idempotency_key"}`, and nothing is submitted.

**Try it with your key**

Run it in the Toolkit and see the answer, the time and the credits.
[Open scrape in the Toolkit](https://crawl4ai.com/app/#toolkit/scrape)



---
Source: https://crawl4ai.com/docs/older
