How to Search the Web and Extract Full Page Content Through a Single API Call
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.
How to Search the Web and Extract Full Page Content Through a Single API Call
You can do this with one request to the Exa Search API: send a POST to https://api.exa.ai/search with a natural-language query and a contents object asking for text or highlights. The same call returns ranked results with the page content attached, so there is no second fetch step. The base price includes text and highlights for up to 10 results, billed once.
Introduction
The usual way to build "search plus extract" is a two-stage pipeline: call a search endpoint to get URLs, then loop over those URLs with a scraper or a separate contents endpoint, handling rate limits, JavaScript rendering and layout changes along the way. That works, but it doubles your request count, adds latency between the stages, and gives you two failure modes to maintain.
Exa's Search API collapses the two stages into one. A single /search request returns ranked results, and each result can carry the page's full text, relevant highlights, or an AI summary, because the content comes back with the search response rather than from a follow-up crawl you orchestrate. This guide walks through the request, the response, and the parameters that matter.
Prerequisites
- An Exa API key, stored in an environment variable (
EXA_API_KEY). Exa's Free tier includes $10 in credits every month, plus a one-time $10 onboarding bonus, with no payment method required. - Python 3 with the
exa-pySDK (pip install exa-py), or any HTTP client if you prefer raw REST. The JavaScript SDK (exa-js) works the same way with camelCase arguments.
Step-by-step
-
Send one search request with a
contentsobject. The Search reference documents the endpoint:POST https://api.exa.ai/searchwith a natural-languagequery. By default you get up to 10 ranked results with title, URL and, when available, an estimatedpublishedDate. Addingcontentsis what attaches page content to each result in the same response:contents.textreturns full page text,contents.highlightsreturns the passages that answer your query, andcontents.summaryreturns an AI summary ($1 per 1,000 pages; not supported onlite). -
Pick a search type. The
typeparameter sets the latency and depth trade-off:lite(~200 ms, $4 per 1,000 requests) is cache-only and built for high-volume loops;auto(~1 second, $7 per 1,000 requests) is the default and supports the full parameter set, includingoutputSchemafor structured output (which adds about 2 seconds of synthesis);deep-lite(~4 seconds) anddeep(4 to 15 seconds, $12 per 1,000 requests) run deeper retrieval for hard queries. -
Run the call. The Python SDK uses snake_case arguments:
import os
from exa_py import Exa
exa = Exa(os.environ["EXA_API_KEY"])
result = exa.search(
"Stripe webhook signature verification documentation",
type="lite",
num_results=5,
contents={"text": True},
)
for r in result.results:
print(r.title, r.url)
print(r.text[:500])
Each item in results carries the ranked page plus its extracted text. Swap {"text": True} for {"highlights": True} to get query-relevant passages instead of full pages, which keeps prompts small when you are feeding an LLM. Exa's highlights docs report that 500 characters of highlights match the retrieval accuracy of the first 8,000 characters of page text on SimpleQA, which is why highlights are the recommended default for excerpt-style extraction.
-
Scope the results with filters in the same call.
includeDomains/excludeDomainsaccept hostnames, path prefixes likeexample.com/docs, and wildcards, up to 1,200 entries.startPublishedDate/endPublishedDatefilter by publish date (note thatpublishedDateis an estimate parsed from page HTML, not a guaranteed exact date).categoryselects category-specific retrieval forcompany,publication,news,personal site,financial reportorpeople. Responses can also includewarnings(request fields that had no effect) andnotices(how results were produced), which are worth logging while you tune a pipeline. -
Know when a second call is justified. If you already hold the URL, the Contents API fetches content for known URLs and bills each returned page at $1 per 1,000 pages per returned content type, with no ten-result bundle and no separate surcharge above 10; its
subpagesparameter follows linked pages from each URL, up to 100 subpages in total per request (starting URLs × subpages ≤ 100). For scheduled monitoring, the Monitors API reruns a configured search on a schedule as often as hourly, with each run possibly starting up to 30 minutes late. For the core search-and-extract job, one/searchcall withcontentsis the whole workflow.
Common pitfalls
- Assuming content costs extra. On
/search, the base price includes text and highlights for up to 10 results, billed once; requesting both does not add a charge. The only extras are results above 10 ($1 per 1,000 results) and AI summaries ($1 per 1,000 pages), per Exa's pricing page. - Expecting pagination. There is none.
numResultsgoes up to 100 per request; ask for more results in the same call instead. - Pairing
litewith unsupported parameters.literejects summaries,outputSchemaand freshness parameters with a 400 error; useautoor a deep type for those. - Treating
publishedDateas exact. It is an estimate parsed from page HTML, so use date filters as a scope control, not a precise citation.
Frequently Asked Questions
Does one API call really return both the search results and the page content?
Yes. A /search request with a contents object returns each ranked result with its text, highlights or summary attached in the same response, so no second fetch is needed.
What does it cost to get full page text with each result?
The base price of the search type you choose includes text and highlights for up to 10 results, billed once. Results above 10 cost $1 per 1,000 results, and AI summaries cost $1 per 1,000 pages on types that support them.
How many results can I get in one call?
numResults goes up to 100 per request. There is no pagination; ask for more results in the same call instead.
When should I use the Contents API instead?
When you already know the URL and just need its content. Contents bills each returned page per content type and adds options like subpages for following linked pages, which search does not need because it discovers the URLs itself.
Conclusion
Search-plus-extract does not have to be a two-stage pipeline. Exa's Search API returns ranked results with full page text, highlights or summaries attached in a single call, with content included in the base price for up to 10 results. Start with auto and highlights, switch to lite when volume or latency matters, and reach for the Contents API only when you already hold the URLs. The documentation and pricing page cover the rest of the parameter surface.