Menu

Crawl

Crawl guides

The jobs Crawl is built for, each as the requests that do it.

Copy as MarkdownOpen in ChatGPT (opens in a new tab)Open in Claude (opens in a new tab)

One section of a site

Start at the section's first page and keep the crawl inside it with include:

Example
Shell
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": 200,
    "max_depth": 4,
    "include": ["^/docs/"],
    "exclude": ["^/docs/archive/", "\\.pdf$"]
  }'

Poll, and page through the results

A poll returns up to 50 results and a next cursor. Wait for the crawl to end, then follow next until it is null:

Example
Python
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=200, include=["^/docs/"])
while job.status in ("queued", "running"):
    time.sleep(5)
    job = client.get_crawl(job.id)

pages = []
while True:
    for page in job.results:
        if page["status"] == "ok":
            pages.append(page)
    if not job.next:
        break
    job = client.get_crawl(job.id, cursor=job.next)

print(len(pages), "pages,", job.credits_used, "credits,", job.stop_reason)

You can read results while the crawl runs too: a poll returns up to 50 of the pages finished so far, and while the crawl is running, next is where to carry on from once any page has been read, even when no more pages are there yet (before the first page finishes it is null: poll again without a cursor). Poll again with it and you get only the pages that finished since, or none yet; you never read a page twice. Pages come in the order they finished, so a cursor stays good. next is null once the crawl has ended and you have read its last page. Polling is free. Keep it to one poll every few seconds: the limit is 120 a minute for your team.

Be told when it ends

Register a webhook endpoint once, verify it, and name it on the crawl:

Example
Shell
curl https://api.millionshort.com/v1/crawl \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: docs-2026-11-20" \
  -d '{
    "url": "https://example.org/docs",
    "max_pages": 200,
    "webhook_id": "wh_01jd3v9x7k2m4n6p8q0r2s4t6v"
  }'

When the crawl ends, the endpoint receives crawl.completed, or crawl.failed for a crawl that failed, with the crawl's id, status, stop_reason and counts. The event does not carry the pages. Fetch them with GET /v1/crawl/{id} and page through them as above.

The Idempotency-Key makes a retry safe: sending the same request again within 24 hours returns the crawl that was started, and starts no second one.

A crawl of stored copies

With mode: "cached", the pages come from the copies we already hold. The site is asked for its robots.txt and its sitemaps (with sitemap: "skip", its robots.txt alone), and for no page at all:

Example
Shell
curl https://api.millionshort.com/v1/crawl \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.org/", "mode": "cached", "max_pages": 100 }'

cached is switched off for now, as it is for Extract, and may not ship.

Use the labels

Every page that comes back says what it is, at no charge: topic, page_type and source_hint, each with a confidence. Two ways to use them:

Example
Shell
curl https://api.millionshort.com/v1/crawl \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.org/",
    "max_pages": 300,
    "page_types": ["documentation", "tutorials", "faqs"]
  }'

A filtered page was fetched to be labelled, so it is charged. When the unwanted pages live under their own paths, exclude is cheaper: a path that is excluded is never fetched.

Staying polite

A crawl follows the rules every fetch of ours follows, and you cannot switch them off:

By default a crawl stays on the host you named. "include_subdomains": true widens it to the site's other hosts. "same_domain": false lets it follow links to other sites:

Example
Shell
curl https://api.millionshort.com/v1/crawl \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.org/links",
    "max_pages": 100,
    "max_depth": 1,
    "same_domain": false,
    "remove_top_sites": 10000
  }'

This reads a page of links and the pages it points at. remove_top_sites leaves out links to the 10,000 most popular sites, the same cut Search has, so the crawl spends its pages on the primary sources and not on the large platforms every page links to. Keep max_depth small: off the site, the number of links grows fast, and max_pages is what stops it.

Cancel, and what is charged

Example
Shell
curl -X DELETE https://api.millionshort.com/v1/crawl/$CRAWL_ID \
  -H "Authorization: Bearer $MILLIONSHORT_API_KEY"

From an agent, over MCP

The MCP server has four tools for this: map, crawl, crawl_status and crawl_cancel. crawl takes the scope and mode fields of a crawl request (not formats, max_chars, json or webhook_id: pages come back as Markdown) and returns the job:

JSON
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "crawl",
    "arguments": { "url": "https://example.org/docs", "max_pages": 30, "include": ["^/docs/"] }
  }
}

A line for your agent's instructions: "To read a section of a site, call crawl with a small max_pages, then call crawl_status with the crawl's id as crawl_id every few seconds until its status is no longer queued or running. Each page costs a credit, so ask for no more pages than you will read."

This page as Markdown · llms.txt