Crawl
Crawl quickstart
Start a crawl, poll it, read the pages, and cancel one you no longer need.
Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)
1. Start a crawl
curl https://api.millionshort.com/v1/crawl \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.org/docs",
"max_pages": 50,
"include": ["^/docs/"]
}'The same call with the Python SDK:
import os
from millionshort import MillionShort
client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])
job = client.crawl(url="https://example.org/docs", max_pages=50, include=["^/docs/"])
print(job.id, job.status)The same call with the TypeScript SDK:
import { MillionShort } from 'millionshort';
const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });
const job = await client.crawl('https://example.org/docs', { maxPages: 50, include: ['^/docs/'] });
console.log(job.id, job.status);The answer is 202 with the job. Nothing has been fetched yet:
{
"data": {
"id": "crawl_01jd3v9x7k2m4n6p8q0r2s4t6v",
"status": "queued",
"url": "https://example.org/docs",
"mode": "live",
"max_pages": 50,
"max_depth": 3,
"total": 1,
"completed": 0,
"failed": 0,
"skipped": 0,
"credits_held": 50,
"credits_used": 0,
"stop_reason": null,
"webhook_id": null,
"created_at": "2026-11-20T10:00:00Z",
"finished_at": null,
"expires_at": null
},
"usage": null,
"warnings": [],
"request_id": "req_..."
}credits_held is the price of max_pages pages in the mode you chose. A team that cannot cover it gets 429 INSUFFICIENT_CREDITS and nothing starts. What the crawl does not use is handed back when it ends.
2. Poll it
curl https://api.millionshort.com/v1/crawl/$CRAWL_ID \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY"With the SDKs:
import os
import time
from millionshort import MillionShort
client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"])
job = client.crawl(url="https://example.org/docs", max_pages=50)
while job.status in ("queued", "running"):
time.sleep(5)
job = client.get_crawl(job.id)
print(job.status, job.completed, "pages,", job.credits_used, "credits")import { MillionShort } from 'millionshort';
const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY });
let job = await client.crawl('https://example.org/docs', { maxPages: 50 });
while (job.status === 'queued' || job.status === 'running') {
await new Promise((resolve) => setTimeout(resolve, 5000));
job = await client.getCrawl(job.id);
}
console.log(job.status, job.completed, 'pages,', job.credits_used, 'credits');Polling is free and does not count against your plan's requests a minute. status goes from queued to running to completed, cancelled or failed. completed counts the pages that came back, failed the URLs that were tried and gave no page, and total the URLs found so far.
A crawl of one site takes its time on purpose: about one page every two seconds for one account. Fifty pages take about two minutes, and a large crawl takes hours. The SDKs have a waiter that polls for you, every 5 seconds: wait_crawl in Python and waitCrawl in TypeScript.
3. Read the pages
The poll carries the pages finished so far in results, up to 50 at a time, nearest the start first. Each one is an Extract result with a depth. Two of this crawl's 14 results are shown here:
{
"data": {
"id": "crawl_01jd3v9x7k2m4n6p8q0r2s4t6v",
"status": "completed",
"url": "https://example.org/docs",
"mode": "live",
"max_pages": 50,
"max_depth": 3,
"total": 14,
"completed": 12,
"failed": 2,
"skipped": 0,
"credits_held": 50,
"credits_used": 12,
"stop_reason": "no_more_pages",
"webhook_id": null,
"created_at": "2026-11-20T10:00:00Z",
"finished_at": "2026-11-20T10:00:41Z",
"expires_at": "2026-11-27T10:00:41Z",
"results": [
{
"depth": 0,
"url": "https://example.org/docs",
"final_url": "https://example.org/docs",
"status": "ok",
"mode_used": "live",
"fetched_at": "2026-11-20T10:00:03Z",
"age_seconds": 0,
"format": "markdown",
"title": "Documentation",
"markdown": "# Documentation\n\nStart here...",
"truncated": false,
"topic": "software",
"page_type": "documentation",
"source_hint": "web",
"label_confidence": { "topic": 0.81, "page_type": 0.9, "source_hint": 0.9 },
"site": "example.org",
"popularity": { "rank": null, "bucket": "long-tail" },
"risk": null
},
{
"depth": 1,
"url": "https://example.org/docs/internal",
"status": "error",
"error": {
"code": "ROBOTS_DISALLOWED",
"message": "This site's robots.txt does not allow our bot to fetch this page."
}
}
],
"next": null
},
"usage": { "credits": 12, "cost_usd": 0.012, "breakdown": {} },
"request_id": "req_..."
}- A page that worked has
status: "ok", itstitle, its content inmarkdown, and its labels. - A URL that failed has
status: "error"and anerrorof its own. It costs nothing, with one exception: inrenderedandunblock, a page the browser found missing is charged and sayscharged: true. - When
nextis notnull, pass it as?cursor=to get the next page. While the crawl runs, it is where to carry on from once any page has been read, even when no more pages are there yet. It isnullbefore the first page has finished, and once the crawl has ended and you have read every page. stop_reasonsays why the crawl ended. Errors lists the reasons.
Results are kept for 7 days after the crawl ended. expires_at says until when.
4. Cancel
curl -X DELETE https://api.millionshort.com/v1/crawl/$CRAWL_ID \
-H "Authorization: Bearer $MILLIONSHORT_API_KEY"import os
import requests
r = requests.delete(
f"https://api.millionshort.com/v1/crawl/{os.environ['CRAWL_ID']}",
headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]},
timeout=30,
)
r.raise_for_status()
print(r.json()["data"])const res = await fetch(`https://api.millionshort.com/v1/crawl/${process.env.CRAWL_ID}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` },
});
if (!res.ok) throw new Error(`DELETE /v1/crawl/… failed: ${res.status}`);
const { data } = (await res.json()) as { data: unknown };
console.log(data);The pages that came back are kept and stay charged. The rest of the hold is handed back. The SDK methods are cancel_crawl in Python and cancelCrawl in TypeScript.
Next
- Parameters: every field, the job and the results.
- Guides: one section of a site, paging, the completion webhook, stored copies.
- Pricing and limits: what a page costs in each mode.