Just want working code?
Stop reading. Use Exa’s Dashboard Onboarding to generate a perfect integration prompt for your coding agent in under one minute.
Overview
Endpoint:POST https://api.exa.ai/search
Auth: Pass your API key via the x-api-key header. Get one at https://dashboard.exa.ai/api-keys
Installation
Minimal Working Example
Request Parameters
Contents Parameters (nested under contents)
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
Token Efficiency
Choosing the right content mode can significantly reduce token usage while maintaining answer quality.
Use
highlights for agent workflows. When building multi-step agents that make repeated search calls, highlights provide the most relevant excerpts without flooding context windows. For real-time information, set contents.maxAgeHours: 0 to force livecrawl, knowing that this may increase latency.
text for deep research. When the task requires deeper understanding or when you’re unsure which parts of the page matter, request full text and cap it with maxCharacters.
highlights and text together. Use highlights for quick answers and fall back to full text only when needed.
Search Types
auto(default): Balance of speed and qualityfast: Low latency. Optimized search models. Good balance of speed and quality.instant: Lowest latency. Optimized for real-time apps (e.g., chat, voice)deep-lite: Lightweight synthesized output with lower latency than the deeper research modesdeep: Multi-step search with reasoning and structured outputsdeep-reasoning: Deep search with maximum reasoning capability for every step
If you encounter older docs or responses that mention
neural, treat that as legacy terminology rather than the recommended setting for new code. Start with auto unless you have a specific latency or synthesis requirement.Latency Characteristics
Approximate latency bytype (hardcoded ballparks — same values surfaced in the dashboard latency slider). Synthesis (outputSchema) and forced livecrawls (contents.maxAgeHours: 0) stack on top of the base type.
Modifiers that stack on top of the base
type:
If you’re optimizing a real-time path, start with
type: "fast" or "instant", omit outputSchema, omit maxAgeHours, and add them back only when the use case requires synthesis, structure, or fresh content.
Category Filters
Output Schema
For any search type, useoutputSchema to control the shape of output.content:
{"type": "text", "description": "..."}— returns plain text output{"type": "object", "properties": {...}, "required": [...]}— returns structured JSON
/search returns grounding data automatically in output.grounding.
Response Schema
Response Fields
Streaming Response
Whenstream: true, /search returns text/event-stream instead of a JSON body. Each data: frame contains an OpenAI-compatible chat.completion.chunk payload. Read partial text from choices[0].delta.content.
Example chunk shape:
Error Handling
Error response shape:
Common Mistakes
Patterns and Gotchas
- Use
highlightsovertextfor agent workflows. Highlights return 10x fewer tokens with the most relevant excerpts. Passhighlights: truefor the highest-quality default. autois almost always the righttype. Only usefast/instantwhen latency matters more than quality, or a deep variant for complex multi-step queries.maxAgeHours: 0forces livecrawl on every result. This increases latency. OmitmaxAgeHoursfor the default (livecrawl only when no cache exists).category: "company"andcategory: "people"disable many filters. Date filters, text filters, andexcludeDomainsare not supported. Using them returns a 400 error.outputSchemaworks with every search type. When you need more reasoning depth or more reliable synthesis, preferdeep-lite,deep, ordeep-reasoning.systemPromptcontrols behavior,outputSchemacontrols shape. UsesystemPromptfor instructions like “prefer official sources”; useoutputSchemafor the JSON structure you want.stream: trueswitches/searchto SSE mode. Expect OpenAI-compatible chat completion chunks, not a single JSON response body.- Python SDK uses snake_case — including dictionary keys.
numResults→num_results,maxAgeHours→max_age_hours,outputSchema→output_schema, etc. This applies insidecontentsdicts too:contents={"text": {"max_characters": 4000}}, NOT{"text": {"maxCharacters": 4000}}. JavaScript SDK and raw JSON (cURL) use camelCase:contents: { text: { maxCharacters: 4000 } }. - Combine content modes. You can request
text,highlights, andsummaryin the same call — all nested undercontents. useAutopromptis deprecated. Do not include it in requests.