Skip to main content

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

Prefer highlights: 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.
Highlights — Extractive key excerpts from the page. Best for agent workflows (10x fewer tokens). These are pulled directly from the source, not generated.
Summary — LLM-generated abstract. Supports JSON schema for structured extraction.
You can combine all three in a single request.

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 the statuses array.

Per-URL Error Tags

Request-Level Errors

Always check statuses to handle per-URL failures:

Common Mistakes

LLMs frequently generate these incorrect parameters. Do NOT use any of the following:Remember: On the /contents endpoint, text, highlights, and summary are top-level parameters. Do NOT nest them inside a contents object (that nesting is only for the /search endpoint).

Patterns and Gotchas

  • Always check statuses. The endpoint returns 200 even when individual URLs fail. Unchecked, you’ll silently miss failed URLs.
  • Use highlights over text for agent workflows. Highlights are 10x more token-efficient and return the most relevant excerpts.
  • Set livecrawlTimeout when using maxAgeHours. Default is 10000ms. For slow sites, use 12000-15000ms.
  • subpageTarget focuses crawling. Without it, subpage selection is best-effort. Use specific terms like ["api", "docs"].
  • Python SDK uses snake_case. subpageTargetsubpage_target, maxAgeHoursmax_age_hours, maxCharactersmax_characters.
  • urls and ids are interchangeable. Both accept URL strings. ids exists for backward compatibility with document IDs from search results.
  • Combine modes freely. Request text, highlights, and summary in the same call for different views of the same content.

Complete Examples

Basic text extraction

Highlights with custom query

Documentation crawling

Structured company extraction

Last modified on June 26, 2026