POST /crawl
Crawl a whole site and get every page back as clean markdown. Costs 3 credits to submit, plus 3 per page returned.
Overview
/crawl walks a site breadth-first from a start URL and renders every page it finds, exactly the way GET /scrape would render it.
Crawls run for minutes, so this is the one asynchronous endpoint in the API. You submit a crawl, get an id back straight away, then poll GET /crawl/{id} for progress and results.
Submit
POST /crawl returns 202 with a crawl id.Poll
GET /crawl/{id} returns progress plus a page of results. Follow next until it is null.Stop early (optional)
DELETE /crawl/{id} cancels a running crawl. Pages already fetched stay readable.Example request
Example response
202 Accepted, not 200 — the crawl has been queued, not completed.
Controlling scope
A crawl stays inside the boundary you draw. By default that means the site you pointed it at, two links deep, at most 25 pages.^/docs/ means the docs section, and a pattern containing the hostname will never match. Exclusions win over inclusions. An invalid regular expression is rejected at submission with a 400, not silently ignored halfway through a crawl.
Sitemap seeding and depth
Withuse_sitemap on (the default), the crawl seeds itself from the site’s sitemap as well as following links.
Sitemap-seeded pages sit at depth 0 — the site handed them over, you did not follow a link to reach them. That makes one particularly useful combination:
Politeness
Crawls obeyrobots.txt by default — both Disallow rules and Crawl-delay. Set respect_robots_txt: false to ignore the rules.
robots.txt being read. Its Sitemap: entries always seed the crawl, because a sitemap tells you where a site’s pages are whether or not you are honouring its restrictions. Use use_sitemap: false to skip seeding.delay_ms adds a pause between pages, and concurrency (1–5, default 2) sets how many are fetched in parallel. A Crawl-delay in robots.txt wins whenever it asks for more space than delay_ms.
Rendering each page
scrape_options takes the same options as GET /scrape, so a crawled page and a scraped page are the same object.
Credits
You are charged 3 credits to submit, plus 3 credits per page the crawl returns. Pages are billed as they complete, on the status endpoint, so:- You pay for pages actually fetched, never for the
limityou asked for. - Pages that failed (
ok: false) are not charged. - Polling repeatedly never charges twice for the same page.
- A cancelled crawl is charged only for what it fetched before stopping.
Next
GET /crawl/{id}
DELETE /crawl/{id}
Authorizations
Your Prefetch API key. Obtain one from the dashboard.
Body
Where the crawl starts.
"https://docs.stripe.com"
Maximum pages to crawl.
1 <= x <= 500How many links deep to follow from the start URL. Sitemap-seeded pages sit at depth 0, so max_depth: 0 with use_sitemap: true crawls exactly what the sitemap lists and follows nothing.
0 <= x <= 5Regular expressions matched against a URL's path and query. A URL must match at least one to be crawled.
Regular expressions. A URL matching any of them is skipped. Exclusions win over inclusions.
Follow links onto subdomains of the start URL.
Follow links onto other sites.
Treat URLs that differ only by query string as one page.
Obey the rules in robots.txt — Disallow and Crawl-delay. Sitemap discovery happens either way.
Seed the crawl from the site's sitemap as well as from links.
Politeness delay between pages. A larger Crawl-delay in robots.txt wins.
0 <= x <= 30000Pages fetched in parallel.
1 <= x <= 5How each crawled page is rendered. The same options GET /scrape takes.