Overview
Endpoint:POST https://api.exa.ai/contents
Auth: Pass your API key via the x-api-key header. Get one at https://dashboard.exa.ai/api-keys
The Contents API extracts clean, LLM-ready content from any URL. It handles JavaScript-rendered pages, PDFs, and complex layouts. Returns full text, highlights, summaries, or any combination.
Installation
Minimal Working Example
Request Parameters
Text Object Options
Highlights Object Options
Preferhighlights: true for the highest-quality default. Only supply this object when you specifically need to guide selection with a custom query or cap output size.
Summary Object Options
Content Modes
Text — Full page content as clean markdown. Best for deep analysis.Content Freshness
When using
maxAgeHours, pair with livecrawlTimeout (10000-15000ms recommended).
Subpage Crawling
Automatically discover and extract content from linked pages within a site.subpages: Max subpages to crawl per URL.subpageTarget: Keywords to prioritize when selecting which subpages to crawl.- Start small (5-10) and increase if needed.
Response Schema
Response Fields
Error Handling
The endpoint returns HTTP 200 even when individual URLs fail. Per-URL errors appear in thestatuses array.
Per-URL Error Tags
Request-Level Errors
Always check
statuses to handle per-URL failures:
Common Mistakes
Patterns and Gotchas
- Always check
statuses. The endpoint returns 200 even when individual URLs fail. Unchecked, you’ll silently miss failed URLs. - Use
highlightsovertextfor agent workflows. Highlights are 10x more token-efficient and return the most relevant excerpts. - Set
livecrawlTimeoutwhen usingmaxAgeHours. Default is 10000ms. For slow sites, use 12000-15000ms. subpageTargetfocuses crawling. Without it, subpage selection is best-effort. Use specific terms like["api", "docs"].- Python SDK uses snake_case.
subpageTarget→subpage_target,maxAgeHours→max_age_hours,maxCharacters→max_characters. urlsandidsare interchangeable. Both accept URL strings.idsexists for backward compatibility with document IDs from search results.- Combine modes freely. Request
text,highlights, andsummaryin the same call for different views of the same content.