Crawl API
The Crawl API is currently in beta. Parameters and response shapes may change in future releases.
The Crawl API is only available for Cloud plans. Contact us for more information here.
Asynchronously crawl a website and scrape every discovered page. Submit a starting URL and receive a crawl ID you can poll for status and results. Configure crawl depth, link-following rules, path filters, scrape output formats, and optional webhook notifications. Each scraped page is returned as structured, LLM-ready data.
Endpoints
- Start a crawl:
POST /crawl - Get crawl status and results: GET /crawl/{id}
- List all crawl jobs:
GET /crawl - Cancel a crawl: DELETE /crawl/{id}
- Auth:
tokenquery parameter (?token=) - Content-Type:
application/json - Response:
application/json
- A Browserless API token from your account dashboard
Visual learner? Check out this video Crawl, Search & Map the Web with Browserless REST APIs for a step-by-step tutorial.
Quickstart
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.browserless.io"
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://www.browserless.io"
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://www.browserless.io"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Response
{
"success": true,
"id": "crawl_abc123def456",
"url": "https://production-sfo.browserless.io/crawl/crawl_abc123def456"
}
The url field is a status-check URL. Use it to poll for results via GET /crawl/{id}. It doesn't include your API token, so add ?token=YOUR_API_TOKEN_HERE when you call it.
Polling for results
Once you have a crawl ID, poll GET /crawl/{id} to check progress and retrieve scraped pages. Results are paginated: each response holds up to 1,000 pages or about 10 MB of page entries, whichever comes first. Use the next URL to fetch the rest. Like url, it doesn't include your API token, so append &token=YOUR_API_TOKEN_HERE when you request it.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
token | string | — | Your API token (required). |
skip | number | 0 | Number of pages to skip for pagination (non-negative integer). |
- cURL
- Javascript
- Python
curl --request GET \
--url 'https://production-sfo.browserless.io/crawl/crawl_abc123def456?token=YOUR_API_TOKEN_HERE'
const TOKEN = "YOUR_API_TOKEN_HERE";
const crawlId = "crawl_abc123def456";
const url = `https://production-sfo.browserless.io/crawl/${crawlId}?token=${TOKEN}`;
const getCrawlStatus = async () => {
const response = await fetch(url);
const result = await response.json();
console.log(result);
};
getCrawlStatus();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
crawl_id = "crawl_abc123def456"
url = f"https://production-sfo.browserless.io/crawl/{crawl_id}?token={TOKEN}"
response = requests.get(url)
result = response.json()
print(result)
Response
{
"status": "completed",
"total": 15,
"completed": 15,
"failed": 0,
"expiresAt": "2025-07-01T12:00:00.000Z",
"next": null,
"data": [
{
"status": "completed",
"contentUrl": "https://crawl-artifacts.s3.us-east-1.amazonaws.com/crawls/crawl_abc123def456/page_0a1b2c3d4e5f.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
"metadata": {
"title": "Browserless - Headless Browser Automation",
"description": "Headless browser automation, without the hosting headaches.",
"language": "en",
"scrapedAt": "2025-06-30T10:00:00.000Z",
"sourceURL": "https://www.browserless.io/",
"statusCode": 200,
"error": null
}
}
// ...more pages
]
}
Result retention
Crawl results stay available for your plan's retention period, counted from when the crawl finishes (completed, failed, or cancelled):
| Plan | Results kept for |
|---|---|
| Free | 1 day |
| Prototyping | 7 days |
| Starter | 30 days |
| Scale and larger plans | 90 days |
expiresAt in the status response gives the exact time for your crawl. After it passes, GET /crawl/{id} returns 410 Gone and the crawl no longer appears in GET /crawl. Each contentUrl is a separate, shorter-lived link: it expires 1 hour after the status response that returned it, so poll again for a fresh link instead of storing it.
Depth and link control
Control how deep the crawler follows links and whether it stays within the original domain.
allowSubdomains follows links to hosts that end in a dot plus the start URL's host. Starting from https://browserless.io covers www.browserless.io and docs.browserless.io. Starting from https://www.browserless.io only covers hosts under www.browserless.io, so docs.browserless.io isn't followed. To include every subdomain, start from the bare domain.
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://browserless.io",
"maxDepth": 3,
"limit": 50,
"allowSubdomains": true,
"allowExternalLinks": false
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://browserless.io",
maxDepth: 3,
limit: 50,
allowSubdomains: true,
allowExternalLinks: false
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://browserless.io",
"maxDepth": 3,
"limit": 50,
"allowSubdomains": True,
"allowExternalLinks": False
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Sitemap control
The sitemap parameter controls whether the crawler reads the site's XML sitemap. Only the start page reads it: the sitemap adds up to limit URLs, which are crawled at depth 1. Sitemap URLs go through the same host and path filters as links found on pages. Every page after the start page discovers links from its own content, whatever the mode.
| Mode | Description |
|---|---|
"auto" | (default) The start page queues its sitemap URLs plus the links found on it. If the site has no sitemap, the crawler uses only the on-page links. |
"force" | The start page queues only its sitemap URLs, not its on-page links. If no sitemap is found, the start page fails with No sitemap found (sitemap mode: force) and the crawl ends failed. Pages below the start page still follow their on-page links up to maxDepth, so set "maxDepth": 1 to crawl only the start page and its sitemap URLs. |
"skip" | Ignores the sitemap entirely. Only discovers URLs by following on-page links. |
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.browserless.io",
"sitemap": "force"
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://www.browserless.io",
sitemap: "force"
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://www.browserless.io",
"sitemap": "force"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Path filtering
Use includePaths and excludePaths to control which discovered URLs the crawler visits. Both take arrays of JavaScript regular expressions, tested against the URL's path only, without the host or query string and with a single trailing slash removed, so ^/blog$ matches both /blog and /blog/. A URL that matches any excludePaths pattern is skipped. When you provide includePaths patterns, a URL must match at least one of them. The crawler always visits the start URL and filters sitemap URLs the same way as on-page links. Each pattern can be up to 200 characters. The API rejects patterns with nested quantifiers such as (a+)+ with 400.
Patterns are regular expressions, not glob patterns. To skip PDF links, use "excludePaths": ["\\.pdf$"] in the JSON request body, not *.pdf. A pattern with invalid regex syntax returns 400 Bad Request naming the field and its position. Patterns longer than 200 characters or flagged as unsafe because of nested quantifiers also return 400 Bad Request with the reason. These rejected requests aren't billed.
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.browserless.io",
"includePaths": ["^/blog"],
"excludePaths": ["^/blog/draft"]
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://www.browserless.io",
includePaths: ["^/blog"],
excludePaths: ["^/blog/draft"]
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://www.browserless.io",
"includePaths": ["^/blog"],
"excludePaths": ["^/blog/draft"]
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Scrape options
Control how each crawled page is scraped with the scrapeOptions object. Choose output formats, filter content, and set per-page timeouts.
Content filters (onlyMainContent, includeTags, excludeTags) only shape the content you get back. Links are still discovered from the full page, so use includePaths and excludePaths to control which pages are crawled.
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.browserless.io",
"limit": 10,
"scrapeOptions": {
"formats": ["markdown", "html"],
"onlyMainContent": true,
"excludeTags": ["nav", "footer"]
}
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://www.browserless.io",
limit: 10,
scrapeOptions: {
formats: ["markdown", "html"],
onlyMainContent: true,
excludeTags: ["nav", "footer"]
}
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://www.browserless.io",
"limit": 10,
"scrapeOptions": {
"formats": ["markdown", "html"],
"onlyMainContent": True,
"excludeTags": ["nav", "footer"]
}
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Webhook notifications
Receive real-time notifications as pages are scraped or when the crawl completes or fails. Provide an HTTPS URL and choose which events to subscribe to.
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://www.browserless.io",
"webhook": {
"url": "https://your-server.com/webhook",
"events": ["page", "completed", "failed"]
}
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://www.browserless.io",
webhook: {
url: "https://your-server.com/webhook",
events: ["page", "completed", "failed"]
}
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://www.browserless.io",
"webhook": {
"url": "https://your-server.com/webhook",
"events": ["page", "completed", "failed"]
}
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Each event is sent as a JSON POST to your webhook URL:
| Event | type | data |
|---|---|---|
page | crawl.page | pageId, url, statusCode, and a 1-hour contentUrl for the scraped page. Sent only for pages that were scraped successfully. |
completed | crawl.completed | url, status, total, completed, and failed. A completed crawl can still have failed pages. |
failed | crawl.failed | Same fields as completed. success is false and error says why. If every page failed, error is "Every page failed to scrape" and each page's own error is in the crawl results. If something stopped the whole crawl (for example, the profile was deleted), error is that message. To receive a webhook when you cancel with DELETE, include failed in webhook.events; the default is only completed. The cancellation event has data.status: "cancelled" and error: "Cancelled by user". |
{
"success": false,
"type": "crawl.failed",
"id": "crawl_abc123",
"data": {
"url": "https://example.com",
"status": "failed",
"total": 3,
"completed": 0,
"failed": 3
},
"error": "Every page failed to scrape"
}
The webhook URL must use HTTPS and must not point to a private or internal network address. Browserless doesn't follow redirects from your receiver, so a 3xx response counts as a failed delivery. Respond with a 2xx status at the final URL.
Using a profile
Crawl authenticated pages by passing a saved profile via the ?profile= query parameter. The browser loads the profile's cookies, localStorage, and IndexedDB before navigating, so every crawled page is accessed as the logged-in user.
- cURL
- Javascript
- Python
curl --request POST \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE&profile=acme-prod' \
--header 'Content-Type: application/json' \
--data '{
"url": "https://app.example.com/docs",
"limit": 20,
"maxDepth": 2
}'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}&profile=acme-prod`;
const headers = {
"Content-Type": "application/json"
};
const data = {
url: "https://app.example.com/docs",
limit: 20,
maxDepth: 2
};
const startCrawl = async () => {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
console.log(result);
};
startCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}&profile=acme-prod"
headers = {
"Content-Type": "application/json"
}
data = {
"url": "https://app.example.com/docs",
"limit": 20,
"maxDepth": 2
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
Create and manage profiles via the Authenticated Profiles workflow. The profile name is scoped to your API token. Other tokens cannot access your profiles.
Cancelling a crawl
Cancel a running crawl by sending a DELETE request with the crawl ID. Pages already scraped remain available.
If the crawl is already in a terminal state (completed, failed, or cancelled), the API returns a 409 Conflict:
{
"success": false,
"error": "Crawl is already completed (requestId: req_abc123)",
"message": "Crawl is already completed (requestId: req_abc123)",
"id": "crawl_abc123def456",
"status": "completed"
}
Success response (200):
{
"status": "cancelled"
}
- cURL
- Javascript
- Python
curl --request DELETE \
--url 'https://production-sfo.browserless.io/crawl/crawl_abc123def456?token=YOUR_API_TOKEN_HERE'
const TOKEN = "YOUR_API_TOKEN_HERE";
const crawlId = "crawl_abc123def456";
const url = `https://production-sfo.browserless.io/crawl/${crawlId}?token=${TOKEN}`;
const cancelCrawl = async () => {
const response = await fetch(url, {
method: 'DELETE'
});
const result = await response.json();
console.log(result);
};
cancelCrawl();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
crawl_id = "crawl_abc123def456"
url = f"https://production-sfo.browserless.io/crawl/{crawl_id}?token={TOKEN}"
response = requests.delete(url)
result = response.json()
print(result)
Listing all crawls
List all crawl jobs for your account. Results are paginated. Use nextCursor to fetch the next page. Crawls whose results have expired aren't listed.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
token | string | — | Your API token (required). |
limit | number | 20 | Results per page (1–100). |
cursor | string | — | Omit cursor or pass cursor= for the first page. For the next page, pass nextCursor from the previous response unchanged. A non-empty cursor that cannot be decoded returns HTTP 400 with an error starting cursor is invalid. |
status | string | — | Filter by status: "in-progress", "completed", "failed", or "cancelled". |
- cURL
- Javascript
- Python
curl --request GET \
--url 'https://production-sfo.browserless.io/crawl?token=YOUR_API_TOKEN_HERE'
const TOKEN = "YOUR_API_TOKEN_HERE";
const url = `https://production-sfo.browserless.io/crawl?token=${TOKEN}`;
const listCrawls = async () => {
const response = await fetch(url);
const result = await response.json();
console.log(result);
};
listCrawls();
import requests
TOKEN = "YOUR_API_TOKEN_HERE"
url = f"https://production-sfo.browserless.io/crawl?token={TOKEN}"
response = requests.get(url)
result = response.json()
print(result)
Response
{
"crawls": [
{
"id": "crawl_def456abc789",
"url": "https://docs.browserless.io",
"status": "in-progress",
"total": 50,
"completed": 23,
"createdAt": "2025-06-30T10:00:00.000Z",
"completedAt": null
},
{
"id": "crawl_abc123def456",
"url": "https://www.browserless.io",
"status": "completed",
"total": 15,
"completed": 15,
"createdAt": "2025-06-30T09:00:00.000Z",
"completedAt": "2025-06-30T09:05:00.000Z"
}
],
"nextCursor": "eyJpZCI6ImNyYXdsX2FiYzEyM2RlZjQ1NiIsImNyZWF0ZWRBdCI6MTc1MTI3NDAwMDAwMH0"
}
Request body
POST /crawl
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | — | The URL to crawl. Must be http:// or https://. |
limit | number | No | 100 | Maximum number of pages to crawl (min 1, clamped to your plan's limit). |
maxDepth | number | No | 5 | Maximum link-follow depth from the root URL (0–20). |
maxRetries | number | No | 1 | Number of retry attempts per failed page (0–5). |
allowExternalLinks | boolean | No | false | Whether to follow links to external domains. |
allowSubdomains | boolean | No | false | Whether to follow links to subdomains of the start URL's host (hosts ending in .<host>). Start from the bare domain, for example https://browserless.io, to include www. and other subdomains. |
sitemap | string | No | "auto" | Sitemap handling strategy: "auto", "force", or "skip". |
includePaths | string[] | No | [] | Regular expressions (not globs) matched against the URL path to include. Invalid patterns return 400 Bad Request. |
excludePaths | string[] | No | [] | Regular expressions (not globs) matched against the URL path to exclude. Invalid patterns return 400 Bad Request. |
delay | number | No | 200 | Delay between requests in milliseconds (0–10,000). |
scrapeOptions | object | No | — | Options controlling how each page is scraped. See below. |
webhook | object | No | — | Webhook configuration for crawl event notifications. See below. |
scrapeOptions
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
formats | string[] | No | ["markdown"] | Output formats: "markdown", "html", "rawText" |
onlyMainContent | boolean | No | true | Whether to extract only the main content of the page. |
includeTags | string[] | No | [] | HTML tag selectors to include. |
excludeTags | string[] | No | [] | HTML tag selectors to exclude. |
waitFor | number | No | 0 | Time in milliseconds to wait after page load before scraping (0–30,000). |
headers | object | No | — | Custom HTTP headers to send with each page request. host, authorization, proxy-authorization, cookie, set-cookie, x-forwarded-for, x-real-ip, and forwarded are removed before the request is sent. A header with an invalid name, or a value that isn't a string or contains a line break or NUL character, returns 400. |
timeout | number | No | 150000 | Navigation timeout per page in milliseconds. Must be between 1,000 and 180,000; values outside that range return 400. |
proxy | string | No | "residential" | Proxy network to route page fetches through: "residential" (6 units/MB) or "datacenter" (2 units/MB). |
webhook
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | — | The HTTPS URL to send webhook events to. |
events | string[] | No | ["completed"] | Which events to send: "page", "completed", "failed". Defaults to ["completed"] when omitted. |
Response fields
POST /crawl (start)
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the crawl was started successfully. |
id | string | The unique crawl job ID. Use this to poll for status and results. |
url | string | Status-check URL for polling results via GET /crawl/{id}. |
GET /crawl/{id} (status and results)
| Field | Type | Description |
|---|---|---|
status | string | Crawl status: "in-progress", "completed", "failed", or "cancelled". |
total | number | Total number of pages discovered. |
completed | number | Number of pages successfully scraped. |
failed | number | Number of pages that failed to scrape. |
expiresAt | string | null | ISO 8601 timestamp when the crawl's results expire: when the crawl finished plus your plan's retention period (see Result retention). null while the crawl is still in progress. |
next | string | null | URL to fetch the next page of results (uses skip offset parameter). null when all results have been returned. |
data | CrawlPageResponse[] | Array of scraped page results. See below. |
CrawlPageResponse
| Field | Type | Description |
|---|---|---|
status | string | Page status: "queued", "in-progress", "completed", "failed", or "cancelled". |
contentUrl | string | null | Pre-signed S3 URL to fetch the full scraped content for this page. Expires after 1 hour. null if the page has not yet completed. |
metadata.title | string | null | Page title. null if not extracted. |
metadata.description | string | null | Page meta description. null if not extracted. |
metadata.language | string | null | Detected page language. null if not detected. |
metadata.scrapedAt | string | null | ISO 8601 timestamp when the page was scraped. null if not yet scraped. |
metadata.sourceURL | string | The original URL that was scraped. |
metadata.statusCode | number | null | HTTP status code for a completed page. A failed scrape attempt can still report the site's response code (for example, 404). null if the page hasn't been scraped yet, the failed attempt got no response, or the fetch succeeded but billing or storage failed afterward. |
metadata.error | string | null | Error message if the page failed to scrape. null on success. |
GET /crawl (list all)
| Field | Type | Description |
|---|---|---|
crawls | CrawlListItem[] | Array of crawl jobs. |
nextCursor | string | null | Cursor for fetching the next page of results. null when there are no more results. |
CrawlListItem
| Field | Type | Description |
|---|---|---|
id | string | The crawl job ID. |
url | string | The root URL being crawled. |
status | string | Crawl status: "in-progress", "completed", "failed", or "cancelled". |
total | number | Total pages discovered. |
completed | number | Pages successfully scraped. |
createdAt | string | ISO 8601 timestamp when the crawl was created. |
completedAt | string | null | ISO 8601 timestamp when the crawl finished. null if still running. |
Error responses
Errors returned by the crawl handlers are JSON with success: false and an error string that includes the request ID. For compatibility, message contains the same string. Only 409 Conflict responses include the crawl id and status.
Example 404 Not Found response:
{
"success": false,
"error": "Crawl not found (requestId: req_abc123)",
"message": "Crawl not found (requestId: req_abc123)"
}
Requests rejected before they reach a crawl handler, such as for a missing or invalid API key, malformed JSON, or schema validation errors, return plain text instead.
All crawl endpoints may return the following error responses:
| Status | Description |
|---|---|
400 Bad Request | Invalid parameters, unrecognized query params, an invalid regular expression in includePaths/excludePaths (they are regular expressions, not globs), or an invalid header name or value in scrapeOptions.headers. |
401 Unauthorized | Missing or invalid API token. |
404 Not Found | Crawl ID does not exist or belongs to another token. |
409 Conflict | (DELETE only) The crawl is already in a terminal state (completed, failed, or cancelled). |
410 Gone | (GET /crawl/{id} only) The crawl's results have expired. See Result retention. |
429 Too Many Requests | Concurrent crawl limit reached for your plan (POST /crawl), or the worker is briefly at capacity for status requests (GET /crawl/{id}). Retry shortly. |
503 Service Unavailable | Crawl service is unavailable or temporarily degraded, or crawl creation is briefly busy for your token. Retry shortly, after the Retry-After header's delay when it's present. |
FAQ & Troubleshooting
Why am I getting a 401 Unauthorized error?
Your API token is missing or invalid. Include it as a ?token= query parameter or in the Authorization header. Verify the token in your account dashboard.
Crawled pages come back empty or missing content
Set scrapeOptions.waitFor to wait longer after each page loads (up to 30,000 ms) if the page renders its content after the initial load. For slow pages, raise scrapeOptions.timeout (up to 180,000 ms). /crawl doesn't accept other REST API options such as waitForTimeout or waitForSelector, and returns 400 for fields it doesn't recognize.