Web crawling API

# Web crawling API: pages, whole sites and search, with one key.

A web crawling API fetches web pages for you over HTTP, so you do not run browsers, proxies or retries. Crawl4AI Cloud answers at `https://api.crawl4ai.com` from three regions (EU, Singapore, US). One key covers one page (`/scrape`), many pages (`/scrape/batch`, `/scrape/jobs`), a whole site (`/scan`, `/site`), fields as JSON (`/extract`) and search (`/search`, `/serp`). A plain page costs 0.1 credit ($0.0001). A failed call costs nothing.

Last checked 23 November 2026 · prices from [GET /v1/prices](https://api.crawl4ai.com/v1/prices)

Do it now with your agent

## One prompt, and your agent crawls a site

Copy this, paste it into your coding agent (Claude Code, Cursor, Codex), add your API key, run it.

```text
Crawl one website with Crawl4AI Cloud and save every page as Markdown.

CRAWL4AI CLOUD
- Read the API reference for agents first: https://crawl4ai.com/llms.txt
- Base URL: https://api.crawl4ai.com
- Header on every call: Authorization: Bearer $CRAWL4AI_KEY
- My API key: YOUR_CRAWL4AI_API_KEY
  (no key yet: get a free key at https://crawl4ai.com/signin/)
- Put the key in the environment variable CRAWL4AI_KEY. Never write it into a file in the repository.

INPUTS (ask me for any that are missing)
- SITE: the start URL, for example https://docs.example.com/
- INCLUDE: follow only paths that start with this, for example /docs (empty = all)
- MAX_PAGES: default 50 for the first run

STEPS
1. Plan: POST /scan {"domain": host of SITE, "include": INCLUDE, "max_urls": 1000}.
   Show me how many URLs it found, and the count per source from meta.warnings.
2. Crawl: POST /site {"url": SITE, "depth": 2, "max_pages": MAX_PAGES, "include": INCLUDE}.
   Read job_id from the 202 answer.
3. Wait: GET /site/jobs/{job_id} every 5 seconds until status is "done" or "paused".
4. Read: GET /site/jobs/{job_id}/results?after=N (NDJSON, 500 rows a page).
   Each row has url, level, title, status, markdown, error.
5. Save one .md file per page under out/, named from the URL path, and a pages.csv with
   url, level, title, status, error.
6. Print a summary: pages saved, pages failed (with error), and the job's usage from step 3.

Run the first test with MAX_PAGES=50, show me the summary, and ask me before a larger run.
```

## How does a call work?

Every call goes to `https://api.crawl4ai.com` with the header `Authorization: Bearer <key>`. The request goes to the nearest of our three regions: the EU, Singapore or the US. Bodies and answers are JSON. Each answer carries the headers `x-c4-cost` (what the call cost, in credits) and `x-c4-balance` (what is left).

A page that needs a real browser can take up to 90 seconds. Set your HTTP client timeout to 120 seconds. If your client must stop sooner, send `timeout` a little below its limit, and you get a clear answer in time.

These answers are never charged:

| Status | Reason | What to do |
|---|---|---|
| 403 | `blocked` | Every step got the site's block page. Log the URL and skip it. |
| 403 | `login-wall` | The page asks for a login or a payment. Skip it. |
| 502 | `no-answer` | The site did not answer, or gave an empty page. A retry rarely helps. |
| 503 | `busy` | No browser was free for a moment. Send the same request again after a few seconds. |
| 504 | `timeout` | Your `timeout` ran out before any step served the page. |

## Fetch one page: /scrape

The service tries the cheapest engine that works for the site: our archive, a plain fetch, then a browser. Ask for `md`, `html` or `both`. Add `country` to fetch the page from one country.

```bash
curl https://api.crawl4ai.com/scrape \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","format":"both","country":"gb","timeout":25,
       "parse":{"links":true,"metadata":true}}'
```

The answer carries `markdown`, `html`, a `content_hash`, the `engine` that served the page, and `ladder`: the steps tried, in order. See [the /scrape docs](https://crawl4ai.com/docs/scrape/).

## Fetch many pages: /scrape/batch and /scrape/jobs

`/scrape/batch` takes up to 50 URLs and streams the answers back as NDJSON, one line per URL as it finishes, then one summary line with the total cost.

```bash
curl -N https://api.crawl4ai.com/scrape/batch \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com","https://example.org"],"format":"md"}'
```

`/scrape/jobs` takes up to 10,000 URLs and runs in the background, so nothing waits on a slow page. Poll `GET /scrape/jobs/{id}`, then read `GET /scrape/jobs/{id}/results`. URLs that never got an answer are refunded at the end. Results are kept 3 days. Use a new `Idempotency-Key` for each new job; send the same key again only to retry the same submit, and you get the first job back, billed once.

```bash
curl https://api.crawl4ai.com/scrape/jobs \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"urls":["https://example.com","https://example.org"]}'
```

## Crawl a whole site: /scan, then /site

`/scan` lists a site's URLs from the sources that already know them: its sitemaps and its home page links. Most sites answer in 1 to 3 seconds. Add `"extended":true` to also ask Common Crawl and the Wayback Machine.

```bash
curl https://api.crawl4ai.com/scan \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"domain":"docs.crawl4ai.com","include":"*/blog/*"}'
```

`/site` crawls from a start URL, level by level: the start page, the pages it links to, and so on, only inside the site. Up to 5 levels and 500 pages; a job runs for at most one hour. Set `content` to `none` to get only the URL list with titles and status codes.

```bash
curl https://api.crawl4ai.com/site \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://docs.crawl4ai.com/","depth":3,"max_pages":200,"exclude":"/blog"}'
```

The answer is `202` with a `job_id`. Then `GET /site/jobs/{id}` for the status and `GET /site/jobs/{id}/results` for the rows. See [the /scan docs](https://crawl4ai.com/docs/scan/) and [the /site docs](https://crawl4ai.com/docs/site/).

## Get fields as JSON: /extract

Give a URL or your own content, and an instruction, a JSON schema, or both. A language model reads the page and returns records that match the schema.

```bash
curl https://api.crawl4ai.com/extract \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://crawl4ai.com/pricing/",
       "instruction":"each plan with its monthly price and credits",
       "schema":{"type":"array","items":{"type":"object","properties":{
         "plan":{"type":"string"},"usd_month":{"type":"number"},"credits":{"type":"integer"}}}}}'
```

You pay for the page and the model's tokens. See [the /extract docs](https://crawl4ai.com/docs/extract/).

## Search the web: /search, /serp and /answer

`GET /search` returns ranked results with title, URL and snippet, for 1 credit. `GET /serp` (beta) returns Google's results page as data, with true ranks, for rank tracking. `GET /answer` (experimental) returns a direct answer with its sources.

```bash
curl "https://api.crawl4ai.com/search?q=web+crawling+api&rich=1" \
  -H "Authorization: Bearer $CRAWL4AI_KEY"

curl "https://api.crawl4ai.com/serp?q=web+crawler&country=gb&language=en" \
  -H "Authorization: Bearer $CRAWL4AI_KEY"

curl "https://api.crawl4ai.com/answer?q=what+is+a+sitemap" \
  -H "Authorization: Bearer $CRAWL4AI_KEY"
```

See [/search](https://crawl4ai.com/docs/search/), [/serp](https://crawl4ai.com/docs/serp/) and [/answer](https://crawl4ai.com/docs/answer/).

## Ready-made scrapers: recipes

For sites like Amazon, Zillow, Booking, Yelp, YouTube and GitHub, a recipe returns rows with fixed, named columns. It is tested for that site, so you do not write a parser.

```bash
curl https://api.crawl4ai.com/recipes/amazon-product \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"product":"B0F5HSNDXF","country":"us"}'
```

The answer is `{"recipe":"amazon-product","rows":[...],"usage":{...}}`. `GET /recipes` (free) lists every recipe with its inputs and columns. See [the recipes](https://crawl4ai.com/recipes/).

## Get told when a page changes: Watch

Watch (in beta) checks a page as often as it really changes, at least once a day, or at a fixed interval of 4 minutes or more. It calls your webhook when the page changes in the way you describe.

```bash
curl https://api.crawl4ai.com/monitors \
  -H "Authorization: Bearer $CRAWL4AI_KEY" -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/changelog","watch":"a new release is listed",
       "every":"1h","notify":{"webhook":"https://you.example/hook"}}'
```

A check costs 1 credit; with a fixed interval under 1 hour it costs 2 (the `1h` above costs 1). A confirmed change that matched costs 3. Up to 100 monitors per account. See [the Watch docs](https://crawl4ai.com/docs/watch/).

## Limits and prices

Every plan uses the same credits on every endpoint. One credit is $0.001 at list price. Extra credits on a plan never expire.

| Plan | Price a month | Credits a month | Requests a minute | At once |
|---|---|---|---|---|
| Free | $0 | 1,000 | 10 | 2 |
| Starter | $10 | 10,000 | 120 | 10 |
| Builder | $99 | 125,000 | 600 | 20 |
| Scale | $499 | 750,000 | 1,500 | 50 |

| Page or call | Credits | Per 1,000 |
|---|---|---|
| A page already in our archive | 0.05 | $0.05 |
| A plain page | 0.1 | $0.10 |
| A real browser page | 0.5 | $0.50 |
| A hard site (the site fought back) | 2 | $2.00 |
| A search | 1 | $1.00 |
| A failed call | 0 | $0 |

From GET /v1/prices (plans and by_level.scrape), read 23 November 2026. /scan and /site add 1 unit for the call, then each page they read, priced like /scrape.

Example, not a measurement: crawling 10,000 pages a month, 80% plain and 20% in a browser, is 8,000 × 0.1 + 2,000 × 0.5 = 1,800 credits, inside the Starter plan. See [pricing](https://crawl4ai.com/pricing/), and [build vs buy](https://crawl4ai.com/build-vs-buy/) for what the same crawl costs when you run it yourself.

## Questions

### What is a web crawling API?

An HTTP API that fetches web pages for you. You send a URL, or a start URL for a whole site, and get the content back. The service runs the browsers, the proxies and the retries, so you do not.

### Can it crawl a whole website?

Yes. `POST /scan` lists a site's URLs from its sitemaps and home page links in one call. `POST /site` crawls a site level by level from a start URL, up to 5 levels and 500 pages, and returns each page as Markdown. For your own list of up to 10,000 URLs, use `POST /scrape/jobs`.

### Is there a free plan?

Yes. The free plan costs $0 and needs no card. It gives 1,000 credits every month, 10 requests a minute and 2 at a time. A plain page costs 0.1 credit.

### What are the rate limits?

Free: 10 requests a minute, 2 at a time. Starter: 120 a minute, 10 at a time. Builder: 600 a minute, 20 at a time. Scale: 1,500 a minute, 50 at a time. A call over the limit gets a 429 with `X-RateLimit-*` headers.

### What happens when a site blocks the request?

You get a 403 with the reason `blocked` or `login-wall`, or a 502 when the site did not answer. None of these is charged. A 503 `busy` means no browser was free for a moment: send the same request again after a few seconds.

### Where are my requests processed?

In three regions: the EU, Singapore and the US. `https://api.crawl4ai.com` routes each request to the nearest one. The pages you fetch are used only to answer your request. See the [security page](https://crawl4ai.com/security/).

Next: [AI web crawler](https://crawl4ai.com/ai-web-crawler/) · [compare](https://crawl4ai.com/compare/) · [build vs buy](https://crawl4ai.com/build-vs-buy/) · [API docs](https://crawl4ai.com/docs/) · [llms.txt](https://crawl4ai.com/llms.txt)
