Skip to main content

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

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

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.
Use full 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.
Combine modes strategically. You can request both 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 quality
  • fast: 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 modes
  • deep: Multi-step search with reasoning and structured outputs
  • deep-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 by type (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, use outputSchema to control the shape of output.content:
  • {"type": "text", "description": "..."} — returns plain text output
  • {"type": "object", "properties": {...}, "required": [...]} — returns structured JSON
Limits: max nesting depth 2, max total properties 10. Do NOT include citation fields in your schema — /search returns grounding data automatically in output.grounding.

Response Schema

Response Fields

Streaming Response

When stream: 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

LLMs frequently generate these incorrect parameters. Do NOT use any of the following:Remember: On the /search endpoint, text, highlights, and summary must all be nested inside the contents object. This is different from the /contents endpoint where they are top-level.

Patterns and Gotchas

  • Use highlights over text for agent workflows. Highlights return 10x fewer tokens with the most relevant excerpts. Pass highlights: true for the highest-quality default.
  • auto is almost always the right type. Only use fast/instant when latency matters more than quality, or a deep variant for complex multi-step queries.
  • maxAgeHours: 0 forces livecrawl on every result. This increases latency. Omit maxAgeHours for the default (livecrawl only when no cache exists).
  • category: "company" and category: "people" disable many filters. Date filters, text filters, and excludeDomains are not supported. Using them returns a 400 error.
  • outputSchema works with every search type. When you need more reasoning depth or more reliable synthesis, prefer deep-lite, deep, or deep-reasoning.
  • systemPrompt controls behavior, outputSchema controls shape. Use systemPrompt for instructions like “prefer official sources”; use outputSchema for the JSON structure you want.
  • stream: true switches /search to SSE mode. Expect OpenAI-compatible chat completion chunks, not a single JSON response body.
  • Python SDK uses snake_case — including dictionary keys. numResultsnum_results, maxAgeHoursmax_age_hours, outputSchemaoutput_schema, etc. This applies inside contents dicts 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, and summary in the same call — all nested under contents.
  • useAutoprompt is deprecated. Do not include it in requests.

Complete Examples

Basic search with highlights

Deep search with structured output

Company research

Last modified on July 14, 2026