Web Crawling API
Crawl a whole site and get every page as Markdown.
The Web Crawling API starts at one page, follows its links across the same site and returns every page it reaches as Markdown. Use it to load a documentation site into a search index, or to read a whole site at once.
Call it
curl https://data.upscrape.com/crawl \ -H "Authorization: Bearer $UPSCRAPE_API_KEY" \ -H "Content-Type: application/json" \ -H "Prefer: wait=30" \ -d '{"url": "https://docs.stripe.com/payments", "max_pages": 10}'
import osimport requestsjob = requests.post( "https://data.upscrape.com/crawl", headers={"Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Prefer": "wait=30"}, json={"url": "https://docs.stripe.com/payments", "max_pages": 10},).json()for page in job["results"][0]["data"]["pages"]: print(page["url"], page["title"])
const res = await fetch("https://data.upscrape.com/crawl", { method: "POST", headers: { Authorization: `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", Prefer: "wait=30", }, body: JSON.stringify({ url: "https://docs.stripe.com/payments", max_pages: 10 }),});const job = await res.json();for (const page of job.results[0].data.pages) console.log(page.url, page.title);
Each page in results[0].data.pages has its url, title, depth and full markdown. From a run on staging on 16 October 2026:
https://docs.stripe.com/payments Payments | Stripe Documentationhttps://docs.stripe.com/ Stripe Documentationhttps://docs.stripe.com/get-started Get started | Stripe Documentationhttps://docs.stripe.com/revenue Revenue | Stripe Documentationhttps://docs.stripe.com/risk Risk | Stripe Documentation…
A crawl of many pages can take more than 30 seconds. The call then answers 202 and you fetch the job when it's done; Long-running calls has a loop that uses this same crawl.
Shape the crawl
| Input | What it does |
|---|---|
max_pages | Pages to fetch in this call, up to 100. 10 by default. |
max_depth | How many links away from the start page to go, up to 10. 2 by default. |
include_patterns, exclude_patterns | Only follow, or never follow, URLs that match, such as "path:/docs/*". |
include_subdomains | Also crawl other subdomains of the same site, such as docs. and blog.. |
respect_robots | On by default: follow the site's robots.txt. |
delay_ms | A pause between requests to the site, up to 5 seconds. |
Crawl in parts
completion_reason says why it stopped: every page reached, or the max_pages you set. When there is more, the response includes a continuation_token: send it back with the same options and the crawl carries on where it stopped, without repeating pages.
A very large crawl
delivery: "hosted" returns the pages as a file to download, instead of inside the JSON, when there is too much for one response. auto, the default, chooses for you.
Input
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
url |
string | yes | The page to start from. | https://docs.stripe.com/payments |
accept_statuses |
array<integer> | no | Error statuses you still want returned, such as [404], to inspect the page. | |
ai |
string | no | Rank the documents found by how relevant they are to your instructions. Nothing is removed. | never · auto · always |
allow_browser_fallback |
boolean | no | Open the page in a real browser when it needs JavaScript or blocks a plain request. On by default. | |
allow_truncated |
boolean | no | Return what was read when a page is larger than the size limit, instead of failing. | |
concurrency |
integer | no | How many pages to fetch at once. | |
continuation_token |
string | no | Pass the token from the last response, with the same options, to continue a crawl. | |
delay_ms |
integer | no | A pause between requests, in milliseconds, to go easy on the site. | |
delivery |
string | no | How large results come back: auto, inline, or as a download link for very large crawls. | auto · inline · hosted |
detail |
string | no | summary for titles and counts only; standard or full for each page's text and Markdown. | summary · standard · full |
document |
object | no | Options for PDFs and other files found on the way. | |
exclude_patterns |
array<string> | no | Leave out URLs matching these patterns. | |
include_patterns |
array<string> | no | Only URLs matching these patterns, such as path:/blog/* or contains:pricing. | |
include_subdomains |
boolean | no | Also follow other subdomains of the same site, such as docs. and blog. | |
instructions |
string | no | With ai, which documents you care about. | |
max_body_bytes |
integer | no | The largest page or file to read, in bytes. | |
max_depth |
integer | no | How many links away from the start page to go. | |
max_pages |
integer | no | The most pages to fetch in this call. | 10 |
max_total_bytes |
integer | no | The most bytes to read in all, redirects included. | |
respect_robots |
boolean | no | Follow the site's robots.txt rules. On by default. |
Response
A finished call answers with HTTP 200; the data is in results[0].data, and billing.credits_charged is what it cost. A call still running after the wait answers 202: see jobs and results.
This is results[0].data from a real run:
{ "completion_reason": "page_limit", "final_url": "https://docs.stripe.com/payments", "traversal_complete": false, "pages": [ { "title": "Payments | Stripe Documentation", "content_type": "text/html; charset=utf-8", "depth": 0, "description": "Use Stripe to start accepting payments.", "final_url": "https://docs.stripe.com/payments", "language": "en-US", "markdown": "# Payments | Stripe Documentation\n\nPayments\n\n## Use Stripe to start accepting payments.\n\nGet started\n\nIntegrate with Stripe to start accept…", "rendered": false, "status_code": 200, "url": "https://docs.stripe.com/payments" }, { "title": "Stripe Documentation", "content_type": "text/html; charset=utf-8", "depth": 1, "description": "Explore our guides and examples to integrate Stripe.", "final_url": "https://docs.stripe.com/", "language": "en-US", "markdown": "# Stripe Documentation\n\n\n\n[Sign in](https://dashb…", "parent_url": "https://docs.stripe.com/payments", "rendered": false, "status_code": 200, "url": "https://docs.stripe.com/" } ]}
Fields
| Field | Type | What it is | Example |
|---|---|---|---|
pages[].title |
string | The page's title. | Payments | Stripe Documentation |
pages[].url |
string | The page's address. | https://docs.stripe.com/payments |
pages[].depth |
integer | How many links away from the start page this page is. | 0 |
pages[].description |
string | The page's description for search engines. | Use Stripe to start accepting payments. |
pages[].language |
string | The page's language. | en-US |
pages[].content_type |
string | The kind of content the page is. | text/html; charset=utf-8 |
pages[].final_url |
string | The address the page ended at, after any redirects. | https://docs.stripe.com/payments |
pages[].markdown |
string | The page's text as Markdown. | # Payments | Stripe Documentation Payments ## Use Stripe to sta… |
pages[].rendered |
boolean | Whether the page was opened in a browser before reading. | false |
pages[].status_code |
integer | The site's HTTP status for the page, such as 200. | 200 |
completion_reason |
string | Why the crawl stopped, such as reaching the page limit. | page_limit |
final_url |
string | The address the page ended at, after any redirects. | https://docs.stripe.com/payments |
pages |
array | The pages found. | 10 records |
traversal_complete |
boolean | Whether every reachable page was visited. | false |
What to know
- It stays on the site you start from and follows its robots.txt.
- Each page comes back with its Markdown, so one call gives you the text of up to max_pages pages.
- completion_reason says why it stopped: every page reached, or the page limit you set.
- A crawl of many pages can take longer than 30 seconds; fetch the job when it finishes.
If a call fails
A failed call costs nothing. The response carries an error.code you can branch on; Errors and retries lists every code and which ones to retry.
Something missing or unclear? Ask the team that builds the endpoints.