Skip to main content

Overview

Endpoint: POST https://api.exa.ai/search. Code search is integrated into the main search endpoint. No category parameter needed. What it searches: Billions of GitHub repositories, documentation pages, Stack Overflow posts, and developer blogs. Semantic search matches natural language queries to real, working code examples ranked by relevance. Reduces hallucinated imports and outdated syntax.

Minimal Working Example

Supported Parameters

Code search is integrated into the main search endpoint. All standard search parameters are supported:

Query Patterns

Library usage:
API syntax:
Development setup:
Framework-specific:

Common Mistakes

Patterns and Gotchas

  • Code search is integrated into the main search endpoint. No category parameter needed. Just use descriptive code-related queries with type: "fast".
  • Be specific about language and framework. “how to stream responses with Vercel AI SDK in Next.js” returns much better results than “streaming API”.
  • Use highlights to extract code snippets. Highlights pull the most relevant code blocks from pages, avoiding boilerplate and navigation text.
  • includeDomains is useful for source quality. Restrict to ["github.com"] for raw code, ["stackoverflow.com"] for Q&A, or official docs domains.
  • Date filters work for code. Use startPublishedDate to get recent examples, useful for fast-moving frameworks.
  • Python SDK uses snake_case. numResultsnum_results, maxCharactersmax_characters.
  • Use text with maxCharacters for full context. When you need the complete code file or tutorial, request text with a character cap rather than just highlights.
Last modified on June 26, 2026