Crawl API
Read a whole website as one asynchronous job: every page as Markdown or HTML, with its links and status
Overview
A crawl starts from one or more URLs, follows the links that match your rules and reads every page it finds. It runs as a job: you start it, follow its progress, and read the pages page by page (also while it runs).
Each page is read by the Ujeebu API with your own key: one /markdown call per page for the markdown format, or one /scrape call with response_type=html for the html format. So every page gets the same JavaScript rendering, proxies, block handling, billing and account limits as a direct call to those endpoints.
Quick Start
# 1. Start a crawl of a docs site's guides, as Markdown
# (at most 200 pages and 2,000 credits)
curl -X POST https://api.ujeebu.com/crawl \
-H "ApiKey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://docs.example.com/"],
"scope": {"include": ["/guides/**"], "max_depth": 3, "max_pages": 200},
"format": "markdown",
"max_credits": 2000
}'
# => 202 {"job_id": "c_...", "status": "pending"}
# 2. Follow it: status, counts, credits_used
curl https://api.ujeebu.com/crawl/JOB_ID -H "ApiKey: YOUR_API_KEY"
# 3. Read the pages in order, 50 at a time, with their Markdown
curl "https://api.ujeebu.com/crawl/JOB_ID/pages?after=0&limit=50&content=true" -H "ApiKey: YOUR_API_KEY"import os, time, requests
BASE = "https://api.ujeebu.com/crawl"
H = {"ApiKey": os.environ["UJEEBU_KEY"]}
job = requests.post(f"{BASE}", headers=H, json={
"urls": ["https://docs.example.com/"],
"scope": {"include": ["/guides/**"], "max_depth": 3, "max_pages": 200},
"format": "markdown",
"max_credits": 2000,
}).json()
job_id = job["job_id"]
# Pages can be read while the job runs; here we wait for the end.
while True:
status = requests.get(f"{BASE}/{job_id}", headers=H).json()
if status["finished"]:
break
time.sleep(10)
print(status["status"], status["stop_reason"], status["credits_used"])
after = 0
while True:
r = requests.get(f"{BASE}/{job_id}/pages", headers=H,
params={"after": after, "limit": 50, "content": "true"}).json()
for page in r["pages"]:
print(page["state"], page["url"], len(page.get("markdown") or ""))
if not r["has_more"]:
break
after = r["next_after"]const BASE = "https://api.ujeebu.com/crawl";
const H = { ApiKey: process.env.UJEEBU_KEY, "Content-Type": "application/json" };
const job = await (await fetch(`${BASE}`, {
method: "POST",
headers: H,
body: JSON.stringify({
urls: ["https://docs.example.com/"],
scope: { include: ["/guides/**"], max_depth: 3, max_pages: 200 },
format: "markdown",
max_credits: 2000,
}),
})).json();
let status;
do {
await new Promise((r) => setTimeout(r, 10000));
status = await (await fetch(`${BASE}/${job.job_id}`, { headers: H })).json();
} while (!status.finished);
for (let after = 0; ; ) {
const r = await (await fetch(`${BASE}/${job.job_id}/pages?after=${after}&limit=50&content=true`, { headers: H })).json();
r.pages.forEach((p) => console.log(p.state, p.url, (p.markdown || "").length));
if (!r.has_more) break;
after = r.next_after;
}Endpoints
Base URL: https://api.ujeebu.com. Authenticate with the ApiKey header, as on every Ujeebu API.
| Method | Path | What it does |
|---|---|---|
POST |
/crawl |
Start a crawl. Answers 202 with job_id and status. An optional Idempotency-Key header makes a retry safe: the same key returns the same job. |
POST |
/crawl/quote |
Same body as a job. Creates nothing; returns the credits per page and the most the job could cost. |
GET |
/crawl/{id} |
The job's status, stop_reason, counts, credits_used, errors by class, robots.txt status per host, and the archive link once finished. See Jobs and results. |
GET |
/crawl/{id}/pages |
The page records in a stable order, with a cursor: after, limit (1 to 50), content=true for the page content; next_after and has_more to continue. |
GET |
/crawl |
The account's 20 most recent jobs (up to 100 with limit). It also checks access: 200 means Crawl is on for your key. |
DELETE |
/crawl/{id} |
Cancel: nothing new starts, pages already in flight finish, then the job ends as cancelled. A finished job answers 409. |
Request Body
Send JSON to POST /crawl (or POST /crawl/quote). Only urls is required. An unknown field anywhere is refused with a 400, so a typo in a limit never goes unnoticed.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
urls |
array |
Yes | - |
1 to 20 start URLs (url is accepted for a single one). They are read whatever the include and exclude patterns say; robots.txt still applies. |
scope.allowed_hosts |
array |
No | the start URLs' hosts | Hosts the crawl may visit. www. counts as the same host. |
scope.include_subdomains |
boolean |
No | false |
Widen each allowed host to its subdomains. |
scope.include |
array |
No | - |
Path patterns a page must match (one of them) to be read. See Scope and rules. |
scope.exclude |
array |
No | - |
Path patterns that keep a page out, whatever the include patterns say. |
scope.max_depth |
number |
No | 3 |
Links away from the start URLs, at most 20. 0 reads the start URLs only. |
scope.max_pages |
number |
No | 100 |
Pages scheduled (failed pages included), at most 2000. |
mode |
string |
No | crawl |
crawl reads the pages; sitemap only lists the in-scope addresses of the site's sitemaps (no page calls, no credits). |
use_sitemap |
boolean |
No | false |
In crawl mode, also start from the sitemap's in-scope addresses. |
format |
string |
No | markdown |
markdown (one /markdown call per page) or html (one /scrape call with response_type=html). |
markdown.filter |
string |
No | fit |
fit (main content), raw (the whole page) or bm25 (the passages that match markdown.query). |
markdown.query |
string |
No | - |
The query for the bm25 filter. |
page.js |
boolean |
No | Render JavaScript in a headless browser. | |
page.proxy_type |
string |
No | The proxy type, as on /scrape. |
|
page.proxy_country |
string |
No | Proxy country (html format only). |
|
page.wait_for |
string |
No | A CSS selector to wait for, or a wait in milliseconds. | |
page.timeout |
number |
No | Timeout per page, in seconds. Any other page key is refused. |
|
max_credits |
number |
No | A hard cap. A page starts only while the credits already used, plus the price of every page still waiting for its answer (this one included), stay within it; otherwise the job stops with stop_reason: "max_credits". A cap equal to the quote's credits_ceiling is enough. The cap can be passed only when a page costs more than its estimate (a dearer proxy class), by at most that difference per page in flight; the estimate is then raised to the highest price seen. |
|
concurrency |
number |
No | 2 |
Pages in flight for this job, always within your account's own concurrency limit; at most 5. |
webhook.url |
string |
No | Called once when the job ends. See Jobs and results. | |
webhook.headers |
object |
No | Extra headers sent with the webhook call; deleted once the delivery has ended. |
A full body:
{
"urls": ["https://example.com/directory/"],
"scope": {
"allowed_hosts": ["example.com"],
"include_subdomains": false,
"include": ["/directory/**"],
"exclude": ["/directory/*/print"],
"max_depth": 3,
"max_pages": 100
},
"mode": "crawl",
"use_sitemap": false,
"format": "markdown",
"markdown": {"filter": "fit"},
"page": {"js": true, "proxy_type": "premium", "wait_for": "#results", "timeout": 60},
"max_credits": 1500,
"concurrency": 2,
"webhook": {"url": "https://example.com/hooks/crawl"}
}
Errors
Errors answer with a JSON body {"error": "<message>"}:
| Status | When | Example message |
|---|---|---|
400 |
The body is not valid (an unknown field, a value out of range). | invalid json body: unknown field "max_page" |
404 |
Crawl is not switched on for this account, or the job does not exist. | |
429 |
The account already runs 2 jobs. Retry after Retry-After seconds. |
too many running crawl jobs (max 2); retry when one has finished |
Credits
Each page is billed by the endpoint that read it, at the same price as a direct call with the same settings:
| Proxy | HTML | HTML with JavaScript | Markdown | Markdown with JavaScript |
|---|---|---|---|---|
Standard (no proxy_type) |
1 | 5 | 10 | 10 |
premium |
8 | 25 | 8 | 12 |
residential |
20 | 30 | 20 | 30 |
The proxy type is set once for the whole job (page.proxy_type), so every page of a premium or residential job pays that proxy's price. Failed, blocked and timed-out pages are free, as on the API, and so are pages skipped by robots.txt and the whole sitemap mode. A page found to be a duplicate after it was read was still read, so it is billed.
Before a large crawl, ask POST /crawl/quote for an estimate:
# Same body as a job; nothing is created and nothing is billed
curl -X POST https://api.ujeebu.com/crawl/quote \
-H "ApiKey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://shop.example.com/category/"], "format": "html", "page": {"js": false}, "scope": {"max_pages": 500}}'The answer gives credits_per_page, the limits it used (max_pages, max_depth, and max_credits when sent) and credits_ceiling: credits_per_page times max_pages, or max_credits when that is lower. When sitemaps are involved it also gives the number of in-scope addresses they hold (sitemap.in_scope_urls, and would_list in sitemap mode). The quote is an estimate; max_credits is the hard bound.
Limits
| Limit | Value |
|---|---|
| Pages per job | 2,000 (max_pages) |
| Pages in flight per job | 5 (concurrency), within your account's concurrency |
| Running jobs per account | 2 (a third answers 429); a job stops counting once all its pages have ended, while its archive is built |
| Depth | 20 (max_depth) |
| Start URLs | 20 |
| Job duration | 6 hours (stop_reason: "max_duration") |
| One page | 150 seconds, then timeout (not retried) |
| One page | 10 MB of content (a larger page ends failed, class error) |
| Page contents and archive | Kept 72 hours after the job completes |
| Job status and page records | Kept 7 days from the job's creation |
Example
# A shop category with pagination, as HTML without JavaScript (1 credit a page)
curl -X POST https://api.ujeebu.com/crawl \
-H "ApiKey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://books.toscrape.com/catalogue/category/books/mystery_3/index.html"],
"format": "html",
"page": {"js": false},
"scope": {"include": ["/catalogue/category/books/mystery_3/**", "/catalogue/*/index.html"], "max_depth": 2, "max_pages": 40},
"max_credits": 100
}'Next
- Scope and rules: include and exclude patterns, hosts, depth, sitemap mode and robots.txt.
- Jobs and results: status, reading pages, cancelling, webhook and archive.
- Page records: what each page returns, and why a page has no content.
Tutorials
- Find all pages on a website: the sitemap URL list for free, a link crawl capped at the quote, and orphan pages.
- Convert a website to Markdown for LLMs: a docs site to llms-full.txt and JSONL chunks, without changelogs, translations or duplicates.
- Keep a RAG knowledge base in sync: a signed webhook and a sha256 comparison to re-embed only what changed.
- Website content inventory: status, titles, canonicals and links to a CSV template, broken links and a redirect map.
- Python web crawler: a crawler with requests and a queue, then the same crawl as one job.
- Generate an llms.txt file: titles and descriptions of a site's pages, grouped by section.
Spin up an API key in 60 seconds
Free trial: 5,000 credits for 21 days, no card, every endpoint on this page (proxy country needs a paid plan or a top-up pack).