Skip to main content
POST
Start a crawl

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.
1

Submit

POST /crawl returns 202 with a crawl id.
2

Poll

GET /crawl/{id} returns progress plus a page of results. Follow next until it is null.
3

Stop early (optional)

DELETE /crawl/{id} cancels a running crawl. Pages already fetched stay readable.

Example request

Example response

The status is 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. Patterns are matched against the path and query, not the whole URL — so ^/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

With use_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:
This crawls exactly what the sitemap lists and follows nothing else.

Politeness

Crawls obey robots.txt by default — both Disallow rules and Crawl-delay. Set respect_robots_txt: false to ignore the rules.
Turning the rules off never stops 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.
Formats are charged per page. Requesting summary or json on a 500-page crawl means 500 LLM calls. Start with a small limit to check the output before scaling up.

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 limit you 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}

Poll for progress and read the crawled pages.

DELETE /crawl/{id}

Stop a running crawl. Free.

Authorizations

X-API-Key
string
header
required

Your Prefetch API key. Obtain one from the dashboard.

Body

application/json
url
string
required

Where the crawl starts.

Example:

"https://docs.stripe.com"

limit
integer
default:25

Maximum pages to crawl.

Required range: 1 <= x <= 500
max_depth
integer
default:2

How 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.

Required range: 0 <= x <= 5
include_paths
string[]

Regular expressions matched against a URL's path and query. A URL must match at least one to be crawled.

Example:
exclude_paths
string[]

Regular expressions. A URL matching any of them is skipped. Exclusions win over inclusions.

Example:
allow_subdomains
boolean
default:false

Follow links onto subdomains of the start URL.

Follow links onto other sites.

ignore_query_params
boolean
default:true

Treat URLs that differ only by query string as one page.

respect_robots_txt
boolean
default:true

Obey the rules in robots.txt — Disallow and Crawl-delay. Sitemap discovery happens either way.

use_sitemap
boolean
default:true

Seed the crawl from the site's sitemap as well as from links.

delay_ms
integer
default:0

Politeness delay between pages. A larger Crawl-delay in robots.txt wins.

Required range: 0 <= x <= 30000
concurrency
integer
default:2

Pages fetched in parallel.

Required range: 1 <= x <= 5
scrape_options
object

How each crawled page is rendered. The same options GET /scrape takes.

Response

Crawl accepted and queued.

success
enum<boolean>
required
Available options:
true
data
object
required
meta
object
required