Skip to main content
New to Exa? Try the Coding Agent Quickstart to get started in under a minute.
The official JavaScript SDK for Exa. Search the web, get page contents, and get answers with citations.

Get API Key

Get your API key from the dashboard

Install

Authentication

Set your API key as an environment variable:

Quick Start

new Exa() reads your key from the EXA_API_KEY environment variable. To set it explicitly instead, pass it inline: new Exa("your-api-key").
  • Start with exa.search(...).
  • Use type: "auto" unless you have a clear latency or synthesis reason to change it.
  • Prefer contents: { highlights: true } for first integrations.
  • Switch to exa.getContents(...) only when you already know the URLs.
  • Prefer maxAgeHours over older livecrawl examples when you need freshness control.
On /search, text, highlights, and summary belong inside contents. On /contents, those same fields are top-level arguments.
Search the web and get page contents in one call.
highlights is a strong default for retrieval workflows because it preserves the most relevant evidence without pulling full page text into every response.
outputSchema and systemPrompt work across all search types. Keep outputSchema focused on output.content, and use systemPrompt to guide the final returned result. For more demanding synthesis, prefer reasoning-focused search types like deep-lite, deep, or deep-reasoning. Do not include citations/confidence in your schema; Exa returns grounding automatically in output.grounding. Including citation/confidence fields in outputSchema duplicates data, reduces structure quality, and is usually less reliable.
Reasoning-focused search variants:
  • deep-lite: lowest-latency deep-search mode
  • deep: light mode
  • deep-reasoning: base reasoning mode
Need streaming structured synthesis? The raw /search endpoint supports stream: true together with outputSchema and returns OpenAI-compatible SSE chunks. See the Search API guide.

Get Contents

Get text, summaries, or highlights from URLs.

Answer

Get answers to questions with citations.

Research

The Research API (/research/v1) is legacy and deprecated. For new integrations, use exa.search(...) with type: "deep-reasoning" and outputSchema for structured research-style output.

TypeScript

Full TypeScript support with types for all methods.

Resources

  • GitHub - View source code
  • npm - View package

Continue

Search guide

Return to the main Search guide for request patterns, filters, and deeper modes.

Search reference

Jump to the full /search request and response schema.

Contents guide

Use Contents when you already know the URLs and want direct extraction.

TypeScript SDK spec

See the full JavaScript and TypeScript SDK method and type reference.
Last modified on June 26, 2026