A web dataset is only as useful as what you can say about it later. A year from now, someone will ask where row 48,201 came from, when it was fetched, and whether the site said anything about AI use at the time. If the answer lives in a log file that has since rotated, nobody can give it.
This guide builds a small, accountable training corpus with the DataForGAIO Crawl API. Every row keeps its receipt, so those questions have answers. The steps are:
- List the URLs you want with
POST /v1/map. - Queue them as a batch, with a webhook for completion.
- Read the receipt on every task.
- Keep only real content, and apply your AI-use policy.
- Write the dataset and a dataset card.
You need an API key (it starts with dg_) and a funded wallet. A page fetched at the Standard level costs $0.00011. If a page needs a higher fetch level, it bills at that level's price and the receipt says why. A request where no level gets the page costs $0.
1. List the URLs
Most sites that want to be read publish a sitemap. Start there rather than following links blindly: it's the list the site owner chose to expose, and it's usually tagged with lastmod dates.
POST /v1/map reads the site's robots.txt and sitemaps and returns the URLs it finds, each tagged with where it came from and whether our crawler may fetch it.
curl -X POST https://api.dataforgaio.com/v1/map \
-H "Authorization: Bearer $DATAFORGAIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://docs.example.com", "limit": 500, "search": "/guide/"}'{
"status": "ok",
"url": "https://docs.example.com/",
"urls_count": 2,
"urls": [
{"url": "https://docs.example.com/guide/install", "source": "sitemap", "lastmod": "2026-10-21", "crawler_allowed": true},
{"url": "https://docs.example.com/guide/configure", "source": "sitemap", "lastmod": "2026-10-04", "crawler_allowed": true}
],
"pages_fetched": 3,
"pages_billed": 3,
"billed_usd": 0.00036
}The map is billed like any crawl: each robots.txt, sitemap or start page that returns real content costs one page at $0.00011, and anything no level could fetch costs $0. Drop any URL where crawler_allowed is false before you queue it.
Filter here for the sections you actually want. A training corpus of documentation doesn't need the careers page.
2. Queue a batch with a webhook
POST /v1/crawls/batch accepts up to 100 targets per call and returns 202 straight away with a job_id. Ask for markdown output, which keeps headings, lists, tables, and code blocks and is the easiest format to chunk.
curl -X POST https://api.dataforgaio.com/v1/crawls/batch \
-H "Authorization: Bearer $DATAFORGAIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"targets": [
{"url": "https://docs.example.com/guide/install"},
{"url": "https://docs.example.com/guide/configure"}
],
"output_format": "markdown",
"include_receipt": true,
"webhook_url": "https://hooks.yourcompany.com/dataforgaio"
}'{ "job_id": "job_5f0c2a9e1b7d4c3a8e6f1d2b3c4a5e6f", "tasks_count": 2, "status": "pending" }Before queueing, the API checks that your wallet covers the whole batch at the page rate. You're only debited for pages that come back as real content.
The webhook_url must use https and resolve to a public host. When every task is done, we send one POST with event crawl.batch.completed and the same envelope you'd get from polling. If you'd rather poll, call GET /v1/crawls/{job_id}.
For a sitemap with 2,000 URLs, send 20 batches. Each one gets its own job_id and its own webhook call.
3. Read the receipts
Each task in the envelope carries its content and a receipt. Here is one task, trimmed:
{
"id": "cr_8a1f3e2d4c5b6a7980f1e2d3c4b5a697",
"status": "completed",
"status_code": 200,
"status_message": "Ok.",
"cost": 0.00011,
"content": {
"title": "Install the CLI",
"markdown": "# Install the CLI\n\nThe CLI runs on macOS, Linux and Windows..."
},
"receipt": {
"receipt_id": "rc_8a1f3e2d4c5b6a7980f1e2d3c4b5a697",
"source_url": "https://docs.example.com/guide/install",
"fetched_at": "2026-11-16T09:42:11Z",
"http_status": 200,
"content_sha256": "3b8f0c...e91a",
"content_check": "substantive",
"content_check_reasons": [],
"robots_txt": "allowed",
"ai_use_signal": "none_declared",
"ai_use_details": {
"robots_txt": { "status": "none_declared", "found": true, "disallowed_agents": [] },
"tdmrep": { "status": "none_declared" },
"ai_txt": { "status": "none_declared", "found": false },
"robots_meta": { "status": "none_declared", "directives": [] }
},
"fetch_level": "standard",
"upgraded": false,
"billed_usd": 0.00011,
"billed_pages": 1,
"currency": "USD"
}
}If you only need the receipts, for an audit or to rebuild a manifest, call GET /v1/crawls/{job_id}/receipt. It returns one receipt per task and no content.
Three fields drive the filtering in the next step:
content_checksays whether the response is real page content. Ablockedorempty_shellresult triggers Auto-upgrade to the next fetch level, and you're billed only for the level that returnedsubstantivecontent. The other verdicts areblocked,login_wall,error_page, andempty_shell, andcontent_check_reasonsexplains each one with codes such asstatus:429orvisible_text_chars:84.robots_txtrecords what the site's robots.txt said for this path under RFC 9309:allowed,disallowed,not_found, orunchecked. We record it rather than enforce it, so if your policy is to respect it, dropdisallowedrows here.ai_use_signalcombines four machine-readable sources (robots.txt rules for AI crawlers, TDMRep,ai.txt, andnoaimeta directives) into one value:reserved,partially_reserved,none_declared, orunknown.ai_use_detailskeeps each source separately.
4. Filter on content and AI-use signals
Your policy is yours to set. A conservative training policy looks like this:
KEEP_SIGNALS = {"none_declared"} # add "partially_reserved" only after review
def keep(task: dict) -> bool:
r = task.get("receipt") or {}
return (
task["status"] == "completed"
and r.get("content_check") == "substantive"
and r.get("robots_txt") in ("allowed", "not_found")
and r.get("ai_use_signal") in KEEP_SIGNALS
)
rows, held = [], []
for task in envelope["tasks"]:
(rows if keep(task) else held).append(task)Keep the held tasks and their receipts. They're your record of what you chose to leave out and why, and that list matters as much as the rows you kept.
unknown means nothing was reserved but at least one source couldn't be checked, for example because /.well-known/tdmrep.json timed out. Re-crawl those later instead of treating them as clear.
partially_reserved usually means some AI agents are disallowed and others aren't, or that ai.txt reserves certain file types. Read ai_use_details.robots_txt.disallowed_agents before deciding. A site that blocks GPTBot but not CCBot has made a choice about specific operators, and your policy may want to honor the strictest reading.
These signals are evidence for review. They aren't a legal determination or a license, and the receipt says so.
5. Write the dataset and its card
Store each row with its receipt rather than in a separate table. JSON Lines works well:
import json
with open("corpus.jsonl", "w") as f:
for task in rows:
r = task["receipt"]
f.write(json.dumps({
"text": task["content"]["markdown"],
"title": task["content"]["title"],
"source_url": r["source_url"],
"fetched_at": r["fetched_at"],
"content_sha256": r["content_sha256"],
"ai_use_signal": r["ai_use_signal"],
"receipt_id": r["receipt_id"],
}) + "\n")content_sha256 lets anyone confirm later that the text in the dataset is the text that was fetched. receipt_id points back to the full record.
Then write a dataset card. Every number in it can come straight from the receipts:
# docs-example-2026-11
- Source: https://docs.example.com/sitemap.xml (2,000 URLs listed)
- Fetched: 2026-11-16 09:40 to 10:05 UTC
- Rows kept: [KEPT] (content_check = substantive, ai_use_signal = none_declared)
- Held: [HELD] (by reason: blocked, empty_shell, reserved, unknown)
- robots.txt: our crawler allowed on all kept rows
- Cost: $[TOTAL] from summed billed_usd; non-substantive fetches billed $0
- Receipts: receipts.jsonl (one per URL, including held rows)What this gets you
The pipeline is short, but it changes what you can say about the data. Each row has a source, a fetch time, a content hash, and the site's AI-use signals as they were at fetch time. The cost of the whole corpus is the sum of billed_usd, so finance and engineering read the same number. When a question comes up later, the answer is a lookup.
We think training data should carry this by default. Read the receipt fields, check the rate card, or start with a single URL from the API docs.