Skip to main content

Just want working code?

Stop reading. Visit contents coding agent reference and copy paste to your agent.

What it is

/contents returns clean, structured content from any URL, handling JavaScript-rendered pages, PDFs, and complex layouts automatically. You pass in URLs and get back full page text, targeted highlights, LLM-generated summaries, or all three. It can also be used to crawl linked subpages to pull content from entire site sections in a single request. All contents features are also available in /search for returned URLs, at no extra charge up to 10 results per search ($1/1000 pages afterwards). We recommend using /search in this way instead of /contents for web search tool use cases.

Key Capabilities

Content Modes

Choose how you receive content, or combine them in a single request:
ModeWhat You GetBest For
TextFull page content as clean markdownDeep analysis, full context research
HighlightsKey excerpts relevant to your queryAgent workflows, factual lookups (10x fewer tokens)
SummaryLLM-generated abstractQuick overviews, structured extraction with JSON schema

Subpage crawling

Automatically discover and extract content from linked pages within a site. Pass subpages: 10 and optionally subpageTarget: ["docs", "about"] to focus on relevant sections.

Content freshness

Control whether results come from cache or are freshly crawled with maxAgeHours:
SettingBehavior
Omit (default)Livecrawl only when no cache exists
24Use cache if < 24 hours old, otherwise livecrawl
0Always livecrawl (slowest, freshest)
-1Cache only (fastest, may be stale)

Common use cases

Get the most relevant excerpts without needing the full page.
result = exa.get_contents(
  ["https://example.com/research-paper"],
  highlights={
    "query": "methodology and results",
    "max_characters": 4000
  }
)
Extract specific fields from any page using a JSON schema.
result = exa.get_contents(
  ["https://example.com/company-page"],
  summary={
    "query": "Extract company information",
    "schema": {
      "type": "object",
      "properties": {
        "name": {"type": "string"},
        "industry": {"type": "string"},
        "founded": {"type": "number"}
      },
      "required": ["name", "industry"]
    }
  }
)
Pull content from a docs site, targeting specific sections.
result = exa.get_contents(
  ["https://docs.example.com"],
  subpages=15,
  subpage_target=["api", "models", "embeddings"],
  max_age_hours=24,
  text={"max_characters": 5000}
)

Human Quickstart

Get your API key from the Exa Dashboard.
pip install exa-py
from exa_py import Exa

exa = Exa(api_key="your-api-key")

result = exa.get_contents(
  ["https://example.com/article"],
  highlights={"max_characters": 4000}
)

Next