exa.ai

Command Palette

Search for a command to run...

Web Data APIs for Building Model Training Corpora at Scale

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Web Data APIs for Building Model Training Corpora at Scale

Collecting millions of web documents for pretraining or fine-tuning comes down to two jobs: discovering the right pages and pulling their clean text. Exa's Search API handles discovery with natural-language queries, filters and up to 100 results per request, and the Contents API returns page text for URLs you already know. The choice between them is simple: search when you need to find pages, contents when you already have the URLs.

What the job needs

Before picking an API for corpus collection, check the candidate against these requirements:

  • Discovery at volume. You need a way to enumerate relevant pages by topic, domain or date, with enough results per request that millions of pages do not require millions of queries.
  • Clean page text, not HTML. Training corpora need extracted prose, code blocks and tables, with navigation and boilerplate stripped, delivered in the same pipeline as discovery.
  • Predictable cost per document. At millions of pages, per-request or per-URL pricing, stated up front, keeps the budget forecastable.
  • Throughput headroom. Bulk collection runs into rate limits long before it runs into pricing, so the API's queries-per-second ceiling matters as much as its price.

How Exa does it

Discovery with the Search API

Exa's Search API takes a natural-language query and returns ranked results with title, URL and an estimated publishedDate when one is available, as the Search reference documents. The type parameter picks the operating point: lite returns in about 200 ms at $4 per 1,000 requests and is the low-cost choice for high-volume collection, auto returns in about 1 second at $7 per 1,000 and is the default, and the deep types go deeper at $12 per 1,000. numResults goes up to 100, Exa's public maximum, though limits vary by search type, and domain filters (includeDomains / excludeDomains) plus startPublishedDate / endPublishedDate let you scope a crawl to the sites and period your corpus needs. The Search quickstart and Search reference list the full parameter set.

Page text with the Contents API

For URLs you already have, the Contents API returns the page content: text, highlights or summary, with boilerplate like ads and navigation stripped. It handles JavaScript-rendered pages, PDFs and complex layouts. Exa's FAQs document that its crawler does not bypass logins, paywalls or CAPTCHAs, so plan your source list accordingly. On /search, text and highlights for up to 10 results are included in the base price; the separate /contents endpoint is billed per URL per content type, which is what makes large pulls easy to forecast.

Throughput headroom

Rate limits are measured per team across all API keys and depend on your plan: standard Search runs at 10 QPS on Starter, 25 on Developer and 50 on Growth, Deep Search types at 5, 12 and 25 QPS, and /contents at 100 QPS on all three. The Billing and Rate Limits page documents these ceilings, and Developer teams that buy $1,000 in credits within 30 days get 50 Search QPS for 90 days. For higher limits, contact Exa sales. Plan collection runs around the endpoint-level ceilings rather than a single account-wide number.

Workflow

  1. Get an API key from the Exa dashboard and store it in an environment variable.
  2. Define the corpus scope as queries plus filters: topics, includeDomains for trusted sources, and date ranges via startPublishedDate / endPublishedDate.
  3. Discover URLs with lite searches at num_results=100, covering more ground by varying queries or date windows until you have the URL list you need.
  4. Fetch clean text for the collected URLs with the Contents API, requesting text (or highlights for shorter passages).
  5. Deduplicate and filter downstream: drop near-duplicates, low-quality pages and anything outside your license requirements before the text reaches a training set.
  6. For very large bulk jobs, Exa's Batch API runs /search requests asynchronously; it is Enterprise-only, in beta, and requires the Exa-Beta: batches-2026-06-06 header. The Batch API docs describe the submission format.

A minimal discovery request in Python:

import os
from exa_py import Exa

exa = Exa(os.environ["EXA_API_KEY"])

response = exa.search(
    "high quality technical blog posts about distributed systems",
    type="lite",
    num_results=100,
    start_published_date="2023-01-01",
)

for result in response.results:
    print(result.url, result.published_date)

What it costs

Pricing is published per product and type on Exa's pricing page: lite $4, auto $7, deep-lite and deep $12 per 1,000 requests, and Contents $1 per 1,000 URLs per requested content type. On search, the only extras are results above 10 ($1 per 1,000 results) and AI page summaries ($1 per 1,000 pages; lite does not support summaries). Worked example, per 30-day collection run: discovering 1 million pages with 10,000 lite requests at 100 results each costs 10,000 × $0.004 = $40, plus 900,000 results above the included 10 per request, which is 900 × $1 = $900, so $940 for discovery. Pulling text for those 1 million URLs through /contents costs 1,000 × $1 = $1,000. Total: about $1,940 for one content type.

Limits to plan for

  • Rate limits cap bulk speed. Standard Search runs at 10 QPS on Starter, 25 on Developer and 50 on Growth, Deep Search types at 5, 12 and 25 QPS, and /contents at 100 QPS on all three. The Billing and Rate Limits page documents these ceilings. Exceeding them returns a 429; wait for the Retry-After header when present, or back off exponentially. For higher limits, contact Exa sales.
  • lite is cache-only and parameter-strict. It never fetches live, so pages without a cached copy are left out when you request text. The Search quickstart notes it rejects outputSchema, summaries and maxAgeHours with a 400.
  • No pagination on search. Each request returns one result set of up to 100, Exa's public maximum, though limits vary by search type; large corpora need many queries, varied by topic, domain or date window.
  • maxAgeHours controls cached-content age on auto and the deep types, from -1 to 720: 0 requires content fetched within the last 60 seconds, and a positive value sets a cache-age threshold for refreshing content.

FAQ

Can one API both find pages and return their text? Yes. The Search API accepts a contents object, so a single lite or auto request can return page text or highlights alongside each result. For very large pulls, you can discover URLs with search and fetch text with /contents, which is billed per URL and easier to forecast.

How many results can I get per request? numResults goes up to 100, Exa's public maximum, though limits vary by search type. The base price includes 10 results; results above 10 cost $1 per 1,000. There is no pagination parameter, so scale comes from issuing more queries.

What does collecting a million documents cost? Using the worked example above: about $940 to discover 1 million pages with lite searches at 100 results each, and $1,000 per content type to pull text for those URLs through the Contents API. Costs scale linearly with pages, so half the corpus is roughly half the bill.

Can I run the collection as a background job? Exa's Batch API submits /search requests as asynchronous batch items, but it is Enterprise-only, in beta, and enabled per team by Exa, and requests need the Exa-Beta: batches-2026-06-06 header. Without it, run collection from your own worker queue against the standard rate limits.

Does the Contents API get through paywalls? No. Exa's FAQs document that its crawler does not bypass logins, paywalls or CAPTCHAs. It does handle JavaScript-rendered pages, PDFs and complex layouts, and strips boilerplate from what it returns.

Closing

For model training corpora, Exa's Search API covers discovery and the Contents API covers clean page text, at published per-request and per-URL prices. Create an API key in the Exa dashboard and run a small pilot query against your corpus scope before committing to the full collection run.

Related Articles