exa-contents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExa Contents
Exa Contents
Requires API key: Get one at https://dashboard.exa.ai/api-keysHeader:x-api-key: $EXA_API_KEY
Use when the agent already knows the URLs and needs clean, LLM-ready extraction without running a new search. Start with one content mode: for compact agent context, for broad page context, or for Exa-side compression.
POST https://api.exa.ai/contentshighlightstextsummary需要API密钥:前往https://dashboard.exa.ai/api-keys获取请求头:x-api-key: $EXA_API_KEY
当Agent已知目标URL,且无需执行新搜索即可获取适合LLM处理的干净提取内容时,可调用接口。初始可选择一种内容模式:(用于紧凑的Agent上下文)、(用于全面的页面上下文)或(由Exa端进行内容压缩)。
POST https://api.exa.ai/contentshighlightstextsummaryQuick Start (cURL)
快速开始(cURL)
Basic text extraction
基础文本提取
bash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://example.com"],
"text": true
}'bash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://example.com"],
"text": true
}'Highlights with freshness control
带时效性控制的高亮内容提取
bash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://arxiv.org/abs/2307.06435"],
"highlights": {
"query": "methodology and results"
},
"maxAgeHours": 24,
"livecrawlTimeout": 12000
}'bash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://arxiv.org/abs/2307.06435"],
"highlights": {
"query": "methodology and results"
},
"maxAgeHours": 24,
"livecrawlTimeout": 12000
}'Endpoint
接口地址
text
POST https://api.exa.ai/contentsAuthentication: header. Exa also accepts , but prefer in cURL examples for consistency.
x-api-key: <API_KEY>Authorization: Bearer <API_KEY>x-api-keyUse this endpoint for known-URL extraction. If the agent needs discovery or ranking first, use .
POST /searchtext
POST https://api.exa.ai/contents认证方式:使用请求头。Exa也支持,但为保持一致性,cURL示例中优先使用。
x-api-key: <API_KEY>Authorization: Bearer <API_KEY>x-api-key此接口适用于已知URL的内容提取。若Agent需要先进行内容发现或排序,请使用接口。
POST /searchParameters
参数
Core request parameters
核心请求参数
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string[] | Yes | - | URLs to extract content from. Use this for known URLs. |
| boolean or object | No | - | Return full page text as markdown. Object form supports |
| boolean or object | No | - | Return key excerpts. Prefer |
| boolean or object | No | - | Return per-page LLM summaries. Use when the caller wants Exa-side compression or structured extraction. |
| integer | No | - | Freshness control. |
| integer | No | | Timeout for live crawling in milliseconds. Use |
| integer | No | | Number of linked subpages to crawl from each URL. |
| string or string[] | No | - | Terms used to prioritize which subpages matter, such as |
| integer | No | | Number of links to extract from each page. |
| integer | No | | Number of image URLs to extract from each page. |
| string | No | - | Enterprise-only compliance mode, such as |
| 参数 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string[] | 是 | - | 要提取内容的URL列表。适用于已知URL的场景。 |
| boolean 或 object | 否 | - | 返回完整页面文本(Markdown格式)。对象形式支持 |
| boolean 或 object | 否 | - | 返回关键摘录内容。Agent工作流中优先使用 |
| boolean 或 object | 否 | - | 返回单页面LLM摘要。当调用方需要Exa端进行内容压缩或结构化提取时使用。 |
| integer | 否 | - | 时效性控制参数。 |
| integer | 否 | | 实时爬取的超时时间(毫秒)。对于对时效性敏感的请求,建议设置为 |
| integer | 否 | | 从每个URL爬取的关联子页面数量。 |
| string 或 string[] | 否 | - | 用于优先筛选子页面的关键词,例如 |
| integer | 否 | | 从每个页面提取的链接数量。 |
| integer | 否 | | 从每个页面提取的图片URL数量。 |
| string | 否 | - | 企业专属合规模式,例如 |
Text object options
Text对象选项
| Parameter | Type | Default | Description |
|---|---|---|---|
| integer | - | Character limit for returned text. Use this instead of |
| boolean | | Preserve HTML tags in output. |
| string | | |
| string[] | - | Only include selected sections: |
| string[] | - | Exclude selected sections from the same section list. |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| integer | - | 返回文本的字符限制。请使用此参数替代 |
| boolean | | 在输出中保留HTML标签。 |
| string | | 可选值: |
| string[] | - | 仅包含指定页面区域: |
| string[] | - | 排除指定页面区域(可选区域列表同上)。 |
Highlights object options
Highlights对象选项
Prefer for the highest-quality default. Only use object form when the agent needs a custom focus or budget.
highlights: true| Parameter | Type | Default | Description |
|---|---|---|---|
| string | - | Custom query guiding which excerpts are returned. |
| integer | - | Cap highlight characters per URL. Omit unless the caller has a strict budget. |
优先使用以获取最优默认效果。仅当Agent需要自定义聚焦方向或控制成本时,才使用对象形式。
highlights: true| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| string | - | 指导摘录内容返回的自定义查询语句。 |
| integer | - | 限制每个URL返回的高亮内容字符数。仅当调用方有严格成本控制需求时使用。 |
Summary object options
Summary对象选项
| Parameter | Type | Default | Description |
|---|---|---|---|
| string | - | Custom query for the summary. |
| object | - | JSON Schema for structured per-page summaries. |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| string | - | 用于生成摘要的自定义查询语句。 |
| object | - | 用于结构化单页面摘要的JSON Schema。 |
Content Modes
内容模式
On , , , and are top-level request fields.
/contentstexthighlightssummary| Mode | Best for | Notes |
|---|---|---|
| Deep analysis and broad page context | Use |
| Agent workflows and factual lookups | Most token-efficient default. Excerpts are grounded in the source page. |
| Compression or structured per-page extraction | Adds Exa-side synthesis per page. |
Avoid requesting multiple modes unless the caller truly needs multiple views of the same page.
在接口中,、和为顶层请求字段。
/contentstexthighlightssummary| 模式 | 适用场景 | 注意事项 |
|---|---|---|
| 深度分析与全面页面上下文 | 使用 |
| Agent工作流与事实查询 | 最节省Token的默认模式。摘录内容均源自原页面。 |
| 内容压缩或结构化单页面提取 | 由Exa端对每个页面进行内容合成。 |
除非调用方确实需要同一页面的多种视图,否则避免同时请求多种模式。
Freshness and Crawling
时效性与爬取
Use as the normative freshness control.
maxAgeHours| Value | Behavior |
|---|---|
| omitted | Use default cache-first behavior with crawl fallback when needed. |
| positive integer | Use cache if it is less than N hours old, otherwise live crawl. |
| Always live crawl. Highest freshness, higher latency. |
| Cache only. Fastest, but fails if no cached content exists. |
Set when live crawling should not block past a fixed budget.
livecrawlTimeout使用作为标准时效性控制参数。
maxAgeHours| 值 | 行为 |
|---|---|
| 省略 | 使用默认的"优先缓存,缓存失效时回退到爬取"策略。 |
| 正整数 | 若缓存内容的生成时间小于N小时则使用缓存,否则实时爬取。 |
| 始终实时爬取。时效性最高,但延迟也更高。 |
| 仅使用缓存内容。速度最快,但如果没有缓存内容则请求失败。 |
当实时爬取不能超过固定时间限制时,请设置参数。
livecrawlTimeoutSubpages and extras
子页面与额外内容
Use and when linked pages matter.
subpagessubpageTargetbash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://docs.example.com"],
"text": {
"maxCharacters": 5000
},
"subpages": 10,
"subpageTarget": ["api", "reference", "guide"],
"extras": {
"links": 10,
"imageLinks": 5
}
}'Start with around to , then increase only when the caller needs broader site coverage.
subpages510当关联页面重要时,可使用和参数。
subpagessubpageTargetbash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://docs.example.com"],
"text": {
"maxCharacters": 5000
},
"subpages": 10,
"subpageTarget": ["api", "reference", "guide"],
"extras": {
"links": 10,
"imageLinks": 5
}
}'初始建议将设置为至,仅当调用方需要更广泛的站点覆盖时再增加数值。
subpages510Response Fields and Statuses
响应字段与状态
Inspect even when the HTTP status is 200. The endpoint can succeed for one URL and fail for another in the same request.
statusesbash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://example.com", "https://failed-url.example.com"],
"highlights": true
}' | jq '{results, statuses}'| Field | Type | Description |
|---|---|---|
| string | Unique request identifier. |
| array | Extracted content result objects. |
| string | Page title. |
| string | Page URL. |
| string or null | Estimated publication date when available. |
| string or null | Author when available. |
| string | Returned when |
| string[] | Returned when |
| number[] | Similarity scores for highlights. |
| string | Returned when |
| array | Nested result objects from subpage crawling. |
| string[] | Extracted links when requested. |
| array | Per-URL success or error states. Always inspect this field. |
| string | Requested URL. |
| string | |
| string | Error type for failed URLs. |
| integer or null | HTTP code associated with a per-URL failure. |
| number | Total request cost when returned. |
Common per-URL error tags include , , , , , and .
CRAWL_NOT_FOUNDCRAWL_TIMEOUTCRAWL_LIVECRAWL_TIMEOUTSOURCE_NOT_AVAILABLEUNSUPPORTED_URLCRAWL_UNKNOWN_ERROR即使HTTP状态码为200,也需检查字段。同一请求中,可能部分URL处理成功,部分失败。
statusesbash
curl -sS -X POST "https://api.exa.ai/contents" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"urls": ["https://example.com", "https://failed-url.example.com"],
"highlights": true
}' | jq '{results, statuses}'| 字段 | 类型 | 描述 |
|---|---|---|
| string | 唯一请求标识符。 |
| array | 提取内容的结果对象数组。 |
| string | 页面标题。 |
| string | 页面URL。 |
| string 或 null | 可用时返回估计的发布日期。 |
| string 或 null | 可用时返回作者信息。 |
| string | 当请求 |
| string[] | 当请求 |
| number[] | 高亮内容的相似度分数。 |
| string | 当请求 |
| array | 子页面爬取的嵌套结果对象。 |
| string[] | 请求时返回提取的链接。 |
| array | 每个URL的成功或错误状态。务必检查此字段。 |
| string | 请求的URL。 |
| string | |
| string | 失败URL的错误类型。 |
| integer 或 null | 与单URL失败相关的HTTP状态码。 |
| number | 返回时显示请求的总成本。 |
常见的单URL错误标签包括、、、、和。
CRAWL_NOT_FOUNDCRAWL_TIMEOUTCRAWL_LIVECRAWL_TIMEOUTSOURCE_NOT_AVAILABLEUNSUPPORTED_URLCRAWL_UNKNOWN_ERRORCritical Pitfalls
关键注意事项
- Keep ,
text, andhighlightsat the top level onsummary./contents - Do not wrap extraction options in a object; that nesting belongs to
contents./search - Do not assume HTTP 200 means every URL succeeded; inspect .
statuses - Do not send ;
stream: trueis not a streaming endpoint./contents - Do not send ; use
tokensNumto cap extracted text.text.maxCharacters - Do not use ,
useAutoprompt,numSentences, or olderhighlightsPerUrlstring values in new requests.livecrawl - Prefer for freshness and pair it with
maxAgeHourswhen crawl latency matters.livecrawlTimeout - Use with
subpageTarget; otherwise subpage selection is best effort.subpages - Pick one of ,
highlights, ortextby default. Stack modes only when the caller truly needs multiple views of each page.summary
- 在接口中,
/contents、text和highlights需放在顶层。summary - 不要将提取选项包裹在对象中;该嵌套结构属于
contents接口。/search - 不要认为HTTP 200意味着所有URL都处理成功;请检查字段。
statuses - 不要发送参数;
stream: true并非流式接口。/contents - 不要发送参数;请使用
tokensNum限制提取文本的长度。text.maxCharacters - 新请求中不要使用、
useAutoprompt、numSentences或旧版highlightsPerUrl字符串值。livecrawl - 优先使用控制时效性,当爬取延迟重要时搭配
maxAgeHours使用。livecrawlTimeout - 使用时请搭配
subpages;否则子页面选择仅为尽力而为。subpageTarget - 默认选择、
highlights或text中的一种模式。仅当调用方确实需要每个页面的多种视图时,才同时使用多种模式。summary