Step 1 of 2
Create your setup prompt
You're all set!
API setup prompt
# Exa API Setup Guide
## Your Configuration
| Setting | Value |
|---------|-------|
| Coding Tool | Not specified |
| Use Case | General |
| Search Type | Auto - Balanced relevance and speed (~1 second) |
| Content | Compact |
**Project Description:** (Not provided)
---
## API Key Setup
### Environment Variable
```bash
export EXA_API_KEY="YOUR_API_KEY"
```
### .env File
```env
EXA_API_KEY=YOUR_API_KEY
```
---
## π Exa MCP Server
Give your AI coding assistant real-time web search with Exa MCP.
**Remote MCP URL (with your API key):**
```
https://mcp.exa.ai/mcp?exaApiKey=
```
**Tool enablement (optional):**
Add a `tools=` query param to the MCP URL.
Enable specific tools:
```
https://mcp.exa.ai/mcp?exaApiKey=&tools=web_search_exa,get_code_context_exa,people_search_exa
```
Enable all tools:
```
https://mcp.exa.ai/mcp?exaApiKey=&tools=web_search_exa,web_search_advanced_exa,get_code_context_exa,crawling_exa,company_research_exa,people_search_exa,deep_researcher_start,deep_researcher_check
```
**Your API key:** ``
Manage keys at [dashboard.exa.ai/api-keys](https://dashboard.exa.ai/api-keys).
**Available tools (enabled by default):**
- `web_search_exa`
- `get_code_context_exa`
- `company_research_exa`
**Optional tools (enable via `tools=`):**
- `web_search_advanced_exa`
- `crawling_exa`
- `people_search_exa`
- `deep_researcher_start`
- `deep_researcher_check`
**Troubleshooting:** if tools donβt appear, restart your MCP client after updating the config.
**JSON config (Cursor, Windsurf, etc.):**
```json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp?exaApiKey="
}
}
}
```
**Claude Desktop (via mcp-remote):**
```json
{
"mcpServers": {
"exa": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.exa.ai/mcp?exaApiKey="]
}
}
}
```
π Full docs: [docs.exa.ai/reference/exa-mcp](https://docs.exa.ai/reference/exa-mcp)
---
## Quick Start
### cURL
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "your search query here",
"type": "auto",
"num_results": 10,
"contents": {
"highlights": {
"max_characters": 4000
}
}
}'
```
---
## Search Type Reference
| Type | Best For | Speed | Depth |
|------|----------|-------|-------|
| `fast` | Real-time apps, autocomplete, quick lookups | Fastest | Basic |
| `auto` | Most queries - balanced relevance & speed | Medium | Smart | β your selection
| `deep` | Research, enrichment, thorough results | Slow | Deep |
| `deep-reasoning` | Complex research, multi-step reasoning | Slowest | Deepest |
**Tip:** `type="auto"` works well for most queries. Use `type="deep"` when you need thorough research results or structured outputs with field-level grounding.
---
## Content Configuration
Choose ONE content type per request (not both):
| Type | Config | Best For |
|------|--------|----------|
| Text | `"text": {"max_characters": 20000}` | Full content extraction, RAG |
| Highlights | `"highlights": {"max_characters": 4000}` | Snippets, summaries, lower cost | β your selection
**β οΈ Token usage warning:** Using `text: true` (full page text) can significantly increase token count, leading to slower and more expensive LLM calls. To mitigate:
- Add `max_characters` limit: `"text": {"max_characters": 10000}`
- Use `highlights` instead if you don't need contiguous text
**When to use text vs highlights:**
- **Text** - When you need untruncated, contiguous content (e.g., code snippets, full articles, documentation)
- **Highlights** - When you need key excerpts and don't need the full context (e.g., summaries, Q&A, general research)
---
## Domain Filtering (Optional)
Usually not needed - Exa's neural search finds relevant results without domain restrictions.
**When to use:**
- Targeting specific authoritative sources
- Excluding low-quality domains from results
**Example:**
```json
{
"includeDomains": ["arxiv.org", "github.com"],
"excludeDomains": ["pinterest.com"]
}
```
**Note:** `includeDomains` and `excludeDomains` can be used together to include a broad domain while excluding specific subdomains (e.g., `"includeDomains": ["vercel.com"], "excludeDomains": ["community.vercel.com"]`).
---
## Category Examples
Use category filters to search dedicated indexes. Each category returns only that content type.
**Note:** Categories can be restrictive. If you're not getting enough results, try searching without a category first, then add one if needed.
### People Search (`category: "people"`)
Find people by role, expertise, or what they work on
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "software engineer distributed systems",
"category": "people",
"type": "auto",
"num_results": 10
}'
```
**Tips:**
- Use SINGULAR form
- Describe what they work on
- No date/text filters supported
### Company Search (`category: "company"`)
Find companies by industry, criteria, or attributes
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "AI startup healthcare",
"category": "company",
"type": "auto",
"num_results": 10
}'
```
**Tips:**
- Use SINGULAR form
- Simple entity queries
- Returns company objects, not articles
### News Search (`category: "news"`)
News articles
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "OpenAI announcements",
"category": "news",
"type": "auto",
"num_results": 10,
"contents": {
"text": {
"max_characters": 20000
}
}
}'
```
**Tips:**
- Use livecrawl: "preferred" for breaking news
- Avoid date filters unless required
### Research Papers (`category: "research paper"`)
Academic papers
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "transformer architecture improvements",
"category": "research paper",
"type": "auto",
"num_results": 10,
"contents": {
"text": {
"max_characters": 20000
}
}
}'
```
**Tips:**
- Use type: "auto" for most queries
- Includes arxiv.org, paperswithcode.com, and other academic sources
### Tweet Search (`category: "tweet"`)
Twitter/X posts
```bash
curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"query": "AI safety discussion",
"category": "tweet",
"type": "auto",
"num_results": 10,
"contents": {
"text": {
"max_characters": 20000
}
}
}'
```
**Tips:**
- Good for real-time discussions
- Captures public sentiment
---
## Content Freshness (maxAgeHours)
`maxAgeHours` sets the maximum acceptable age (in hours) for cached content. If the cached version is older than this threshold, Exa will livecrawl the page to get fresh content.
| Value | Behavior | Best For |
|-------|----------|----------|
| 24 | Use cache if less than 24 hours old, otherwise livecrawl | Daily-fresh content |
| 1 | Use cache if less than 1 hour old, otherwise livecrawl | Near real-time data |
| 0 | Always livecrawl (ignore cache entirely) | Real-time data where cached content is unusable |
| -1 | Never livecrawl (cache only) | Maximum speed, historical/static content |
| *(omit)* | Default behavior (livecrawl as fallback if no cache exists) | **Recommended** β balanced speed and freshness |
**When LiveCrawl Isn't Necessary:**
Cached data is sufficient for many queries, especially for historical topics or educational content. These subjects rarely change, so reliable cached results can provide accurate information quickly.
See [maxAgeHours docs](https://exa.ai/docs/reference/livecrawling-contents#maxAgeHours) for more details.
---
## Other Endpoints
Beyond `/search`, Exa offers these endpoints:
| Endpoint | Description | Docs |
|----------|-------------|------|
| `/contents` | Get contents for known URLs | [Docs](https://exa.ai/docs/reference/get-contents) |
| `/answer` | Q&A with citations from web search | [Docs](https://exa.ai/docs/reference/answer) |
**Example - Get contents for URLs:**
```json
POST /contents
{
"urls": ["https://example.com/article"],
"text": { "max_characters": 20000 }
}
```
---
## Troubleshooting
**Results not relevant?**
1. Try `type: "auto"` - most balanced option
2. Try `type: "deep"` - runs multiple query variations and ranks the combined results
3. Refine query - use singular form, be specific
4. Check category matches your use case
**Need structured data from search?**
1. Use `type: "deep"` or `type: "deep-reasoning"` with `outputSchema`
2. Define the fields you need in the schema β Exa returns grounded JSON with citations
**Results too slow?**
1. Use `type: "fast"`
2. Reduce `num_results`
3. Skip contents if you only need URLs
**No results?**
1. Remove filters (date, domain restrictions)
2. Simplify query
3. Try `type: "auto"` - has fallback mechanisms
---
## Resources
- Docs: https://exa.ai/docs
- Dashboard: https://dashboard.exa.ai
- API Status: https://status.exa.ai