Scrape many pages
POST
https://api.crawl4ai.com/scrape/batchScrape many URLs in one call — up to 50 — and stream a result per line as each finishes.
Request
# -N streams each result line as it lands curl -N https://api.crawl4ai.com/scrape/batch \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{"urls": ["https://a.com", "https://b.com"], "format": "md"}'
import json, requests with requests.post( "https://api.crawl4ai.com/scrape/batch", headers={"Authorization": "Bearer sk_live_..."}, 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"])
const res = await fetch("https://api.crawl4ai.com/scrape/batch", { method: "POST", headers: { "Authorization": "Bearer sk_live_...", "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
urlsrequiredstring[] | The URLs to scrape (max 50 per call). |
…— | Any /scrape field ( |
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
Open the playgroundRun this call in the playground and see the real answer, the time and the units.
Next
Scrape a pagePOST /scrape
Fetch a page and return clean Markdown (and/or HTML).
Bulk jobsPOST /scrape/jobsFor big lists — up to 10,000 URLs — or when your code cannot hold a connection open for slow pages.
Something unclear or wrong on this page? Tell us.