exa-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExa Search
Exa Search
Requires API key: Get one at https://dashboard.exa.ai/api-keysHeader:x-api-key: $EXA_API_KEY
Use for semantic web retrieval, ranked results, and optional result-level extraction in one raw HTTP call. Start with for general retrieval. Add only when the caller needs page text, highlights, summaries, freshness-controlled crawling, subpages, or extracted links.
POST https://api.exa.ai/searchtype: "auto"contents需要API密钥:前往https://dashboard.exa.ai/api-keys获取请求头:x-api-key: $EXA_API_KEY
使用通过一次原生HTTP调用实现语义网页检索、结果排序以及可选的结果级提取。通用检索请从开始。仅当调用方需要页面文本、高亮内容、摘要、时效性控制爬取、子页面或提取链接时,才添加参数。
POST https://api.exa.ai/searchtype: "auto"contentsQuick Start (cURL)
快速开始(cURL)
Basic search
基础搜索
bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "latest developments in LLMs",
"type": "auto",
"numResults": 10
}'bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "latest developments in LLMs",
"type": "auto",
"numResults": 10
}'Search with highlights
带高亮的搜索
bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "latest developments in LLMs",
"type": "auto",
"numResults": 5,
"contents": {
"highlights": true
}
}'bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "latest developments in LLMs",
"type": "auto",
"numResults": 5,
"contents": {
"highlights": true
}
}'With filters and freshness
带筛选和时效性控制的搜索
bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "AI regulation policy updates",
"type": "auto",
"category": "news",
"numResults": 10,
"includeDomains": ["reuters.com", "bbc.com"],
"startPublishedDate": "2025-01-01",
"contents": {
"text": {
"maxCharacters": 2000
},
"maxAgeHours": 24,
"livecrawlTimeout": 12000
}
}'bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "AI regulation policy updates",
"type": "auto",
"category": "news",
"numResults": 10,
"includeDomains": ["reuters.com", "bbc.com"],
"startPublishedDate": "2025-01-01",
"contents": {
"text": {
"maxCharacters": 2000
},
"maxAgeHours": 24,
"livecrawlTimeout": 12000
}
}'Deep search
深度搜索
bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "map the major technical and commercial tradeoffs in sodium-ion batteries for grid storage",
"type": "deep",
"numResults": 8
}'bash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "map the major technical and commercial tradeoffs in sodium-ion batteries for grid storage",
"type": "deep",
"numResults": 8
}'Endpoint
接口地址
text
POST https://api.exa.ai/searchAuthentication: 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 when the agent needs search results. If the agent already has URLs and only needs extraction, use instead.
POST /contentstext
POST https://api.exa.ai/search认证方式:通过请求头。Exa也支持,但为保持一致性,cURL示例中优先使用。
x-api-key: <API_KEY>Authorization: Bearer <API_KEY>x-api-key当Agent需要搜索结果时使用此接口。若Agent已拥有URL且仅需要提取内容,请使用接口。
POST /contentsParameters
参数说明
Core request parameters
核心请求参数
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Natural-language search query. Long, semantically rich descriptions work well. |
| string | No | | Search method: |
| integer | No | | Number of results to return. Use small values for agent loops; maximum is 100. |
| string | No | - | Specialized result type: |
| string[] | No | - | Only return results from these domains, paths, or wildcard patterns. Max 1200. |
| string[] | No | - | Exclude these domains, paths, or wildcard patterns. Max 1200. |
| string | No | - | ISO 8601 lower bound for result publication date. |
| string | No | - | ISO 8601 upper bound for result publication date. |
| string | No | - | Two-letter ISO country code such as |
| boolean | No | | Filter unsafe content from results. |
| string[] | No | - | Extra query variants for deep-search variants. Use alongside the main |
| string | No | - | Instructions for synthesized output and deep-search planning, such as source preferences. |
| object | No | - | JSON Schema controlling |
| boolean | No | | If |
| string | No | - | Enterprise-only compliance mode, such as |
| 参数 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 是 | - | 自然语言搜索查询。使用语义丰富的长描述效果更佳。 |
| string | 否 | | 搜索方式: |
| integer | 否 | | 返回结果数量。Agent循环中使用较小值;最大值为100。 |
| string | 否 | - | 特定结果类型: |
| string[] | 否 | - | 仅返回来自这些域名、路径或通配符模式的结果。最多支持1200个。 |
| string[] | 否 | - | 排除来自这些域名、路径或通配符模式的结果。最多支持1200个。 |
| string | 否 | - | 结果发布日期的ISO 8601格式下限。 |
| string | 否 | - | 结果发布日期的ISO 8601格式上限。 |
| string | 否 | - | 两位ISO国家代码,例如 |
| boolean | 否 | | 过滤结果中的不安全内容。 |
| string[] | 否 | - | 深度搜索变体的额外查询变体。需与主 |
| string | 否 | - | 用于合成输出和深度搜索规划的指令,例如来源偏好。 |
| object | 否 | - | 控制 |
| boolean | 否 | | 若为 |
| string | 否 | - | 企业专属合规模式,例如 |
Content parameters nested under contents
contentscontents
下的嵌套内容参数
contentsOn , , , and must be nested under .
/searchtexthighlightssummarycontents| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| boolean or object | No | - | Return full page text as markdown. Object form supports |
| boolean or object | No | - | Return query-relevant excerpts. Prefer |
| boolean or object | No | - | Return per-result LLM summaries. Use sparingly because each result adds synthesis work. |
| integer | No | - | Freshness control. |
| integer | No | | Timeout for live crawling in milliseconds. Use |
| integer | No | | Number of linked subpages to crawl per result. |
| string or string[] | No | - | Terms used to prioritize which subpages matter, such as |
| integer | No | | Number of links to extract from each result page. |
| integer | No | | Number of image URLs to extract from each result page. |
在接口中,、和必须嵌套在下。
/searchtexthighlightssummarycontents| 参数 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| boolean或object | 否 | - | 返回完整页面文本(Markdown格式)。对象形式支持 |
| boolean或object | 否 | - | 返回与查询相关的摘录。Agent工作流中优先使用 |
| boolean或object | 否 | - | 返回每个结果的LLM摘要。需谨慎使用,因为每个结果都会增加合成工作量。 |
| integer | 否 | - | 时效性控制。 |
| integer | 否 | | 实时爬取的超时时间(毫秒)。对时效性敏感的调用建议使用 |
| integer | 否 | | 每个结果爬取的链接子页面数量。 |
| string或string[] | 否 | - | 用于优先选择重要子页面的关键词,例如 |
| integer | 否 | | 从每个结果页面提取的链接数量。 |
| integer | 否 | | 从每个结果页面提取的图片URL数量。 |
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.
contents.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需要自定义焦点或预算时才使用对象形式。
contents.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-result summaries. |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| string | - | 用于生成摘要的自定义查询。 |
| object | - | 用于结构化单结果摘要的JSON Schema。 |
Search Types
搜索类型
Search controls the retrieval and synthesis mode. Pick the mode for the workflow, not just the output format. can be used with any search type; use deeper modes when the search process itself needs more planning, synthesis, or reasoning.
typeoutputSchema| Type | Best for | Tradeoff |
|---|---|---|
| General default search and most new integrations | Balances speed and quality without requiring the caller to tune retrieval strategy. |
| Low-latency agent loops and product paths | Faster than |
| Real-time UI, chat, voice, and autocomplete-style paths | Lowest latency path; use for quick retrieval rather than deep synthesis. |
| Lightweight research or synthesis | Adds more planning and synthesis than |
| Multi-step research, comparisons, and synthesis-heavy retrieval | Higher latency; better when the query needs exploration across several sources. |
| Hard research tasks with high ambiguity or complex tradeoffs | Highest latency and reasoning depth. |
Use unless latency or reasoning depth is the primary constraint. Use or for time-sensitive calls. Use , , or when the query needs multi-step source discovery, comparison, or synthesis.
autofastinstantdeepdeep-litedeep-reasoning搜索控制检索和合成模式。请根据工作流选择模式,而非仅根据输出格式。可与任何搜索类型配合使用;当搜索过程本身需要更多规划、合成或推理时,使用更深度的模式。
typeoutputSchema| 类型 | 适用场景 | 权衡点 |
|---|---|---|
| 通用默认搜索和大多数新集成 | 在速度和质量之间取得平衡,无需调用方调整检索策略。 |
| 低延迟Agent循环和产品路径 | 比 |
| 实时UI、聊天、语音和自动补全类场景 | 延迟最低的模式;用于快速检索而非深度合成。 |
| 轻量级研究或合成 | 比 |
| 多步骤研究、对比和重度合成检索 | 延迟较高;当查询需要跨多个来源探索时效果更佳。 |
| 高歧义或复杂权衡的疑难研究任务 | 延迟和推理深度最高。 |
除非延迟或推理深度是主要限制因素,否则请使用。对时间敏感的调用使用或。当查询需要多步骤来源发现、对比或合成时,使用、或。
autofastinstantdeepdeep-litedeep-reasoningMode-only examples
仅指定模式的示例
json
{
"query": "recent product launches from major AI chip companies",
"type": "fast",
"numResults": 5
}json
{
"query": "compare competing explanations for the recent rise in grid-scale battery deployments",
"type": "deep",
"numResults": 8
}json
{
"query": "recent product launches from major AI chip companies",
"type": "fast",
"numResults": 5
}json
{
"query": "compare competing explanations for the recent rise in grid-scale battery deployments",
"type": "deep",
"numResults": 8
}Structured Output
结构化输出
Use for behavior and for shape.
systemPromptoutputSchemabash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "compare the latest frontier AI model releases",
"type": "deep",
"systemPrompt": "Prefer official sources and avoid duplicate results.",
"outputSchema": {
"type": "object",
"properties": {
"models": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"notable_claims": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["name", "notable_claims"]
}
}
},
"required": ["models"]
},
"contents": {
"highlights": true
}
}'Keep schemas compact and bounded. Do not add citation fields to the schema; grounding is returned separately in .
output.grounding使用定义行为,定义输出结构。
systemPromptoutputSchemabash
curl -sS -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "compare the latest frontier AI model releases",
"type": "deep",
"systemPrompt": "Prefer official sources and avoid duplicate results.",
"outputSchema": {
"type": "object",
"properties": {
"models": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"notable_claims": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["name", "notable_claims"]
}
}
},
"required": ["models"]
},
"contents": {
"highlights": true
}
}'请保持Schema简洁且有边界。不要在Schema中添加引用字段;溯源信息会单独返回在中。
output.groundingStreaming
流式输出
Streaming applies to synthesized output, so include along with , , and . Without , the endpoint returns the normal JSON search response even when is .
outputSchema-NAccept: text/event-streamstream: trueoutputSchemastreamtruebash
curl -sS -N -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "recent grid-scale battery deployments",
"type": "deep",
"stream": true,
"outputSchema": {
"type": "object",
"properties": {
"summary": { "type": "string" }
},
"required": ["summary"]
},
"contents": {
"highlights": true
}
}'Treat streaming as SSE rather than JSON. Each frame contains an OpenAI-compatible chat completion chunk; read partial text from and handle completion or error frames defensively.
data:choices[0].delta.content流式输出适用于合成输出,因此需同时包含、、和。若未指定,即使设为,接口仍会返回常规JSON搜索响应。
outputSchema-NAccept: text/event-streamstream: trueoutputSchemastreamtruebash
curl -sS -N -X POST "https://api.exa.ai/search" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "x-api-key: $EXA_API_KEY" \
-d '{
"query": "recent grid-scale battery deployments",
"type": "deep",
"stream": true,
"outputSchema": {
"type": "object",
"properties": {
"summary": { "type": "string" }
},
"required": ["summary"]
},
"contents": {
"highlights": true
}
}'请将流式输出视为SSE而非JSON。每个帧包含兼容OpenAI的聊天补全块;从读取部分文本,并谨慎处理完成或错误帧。
data:choices[0].delta.contentResponse Fields
响应字段
| Field | Type | Description |
|---|---|---|
| string | Unique request identifier. |
| array | Ranked 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. |
| string or object | Synthesized output when |
| array | Citations and confidence labels for synthesized fields. |
| number | Total request cost when returned. |
| number | Search latency when returned. |
| 字段 | 类型 | 描述 |
|---|---|---|
| string | 唯一请求标识符。 |
| array | 排序后的结果对象数组。 |
| string | 页面标题。 |
| string | 页面URL。 |
| string或null | 可用时返回估算的发布日期。 |
| string或null | 可用时返回作者信息。 |
| string | 当请求 |
| string[] | 当请求 |
| number[] | 高亮内容的相似度得分。 |
| string | 当请求 |
| array | 子页面爬取的嵌套结果对象数组。 |
| string[] | 请求时返回提取的链接。 |
| string或object | 当提供 |
| array | 合成字段的引用和置信度标签。 |
| number | 返回时显示请求总成本。 |
| number | 返回时显示搜索延迟。 |
Critical Pitfalls
关键注意事项
- Keep ,
text, andhighlightsinsidesummaryoncontents./search - Do not send top-level ,
text, orhighlights; that shape belongs tosummary./contents - Do not send ; use
tokensNumto cap extracted text.contents.text.maxCharacters - Do not use ,
useAutoprompt, ornumSentencesin new requests.highlightsPerUrl - Use instead of
contents.maxAgeHours.livecrawl - Use documented categories only: ,
company,people,research paper,news, andpersonal site.financial report - Avoid invalid category/filter combinations. and
companydo not supportpeopleorstartPublishedDate.endPublishedDatesupportscompany;excludeDomainsdoes not, andpeopleonly accepts LinkedIn domains inpeople.includeDomains - Pick one of ,
contents.highlights, orcontents.textby default. Stack modes only when the caller truly needs multiple views of each page.contents.summary - Expect SSE only when is paired with
stream: true; otherwiseoutputSchemareturns its normal JSON response./search
- 在接口中,需将
/search、text和highlights放在summary内。contents - 不要在顶层发送、
text或highlights;该格式属于summary接口。/contents - 不要发送;请使用
tokensNum限制提取文本的长度。contents.text.maxCharacters - 新请求中不要使用、
useAutoprompt或numSentences。highlightsPerUrl - 使用替代
contents.maxAgeHours。livecrawl - 仅使用文档中列出的类别:、
company、people、research paper、news和personal site。financial report - 避免无效的类别/筛选组合。和
company不支持people或startPublishedDate。endPublishedDate支持company;excludeDomains不支持,且people仅接受LinkedIn域名在people中。includeDomains - 默认情况下,请选择、
contents.highlights或contents.text中的一个。仅当调用方确实需要每个页面的多种视图时,才同时使用多种模式。contents.summary - 仅当与
stream: true配合使用时,才会返回SSE;否则outputSchema接口返回常规JSON响应。/search