# Exa API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/exa
Last checked: 2026-11-08

Exa API keys are created on the API keys page of the Exa dashboard (`dashboard.exa.ai/api-keys`) and sent as `x-api-key` or `Authorization: Bearer` to the Exa API. The official `exa-py` and `exa-js` SDKs read `EXA_API_KEY` automatically. Exa's hosted MCP server at `https://mcp.exa.ai/mcp` works for search and fetch without a key at a free rate limit, and takes an Exa key or OAuth for higher limits and the Exa Agent tool.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Exa API key | — | Yes | The Exa endpoints the team's plan allows, spending the team's credits; can carry its own lower rate limit and spending budget | — |
| Service key | — | Yes | The Team Management API at `https://admin-api.exa.ai/team-management`, for creating, listing and deleting the team's API keys | — |

## How to create a Exa key

1. Sign in to the Exa dashboard at `dashboard.exa.ai`.
2. Open the **API keys** page (`dashboard.exa.ai/api-keys`) and create a key.
3. Optionally give the key a lower rate limit than the team's.
4. Copy the Exa key and store it in `EXA_API_KEY`, which the Exa SDKs read without extra code.

## Limiting what the key can do

Exa keys do not have per-endpoint permissions; endpoints and search types are governed by the team's plan, and a key asking for something the plan lacks gets `403 FEATURE_DISABLED`. The controls on a key are money and speed. A team administrator can give a key a spending budget, after which it returns `402 API_KEY_BUDGET_EXCEEDED`, and a rate limit lower than the team's. Team rate limits are counted in queries per second across all keys: by default 10 QPS for `/search`, `/answer` and `/chat/completions`, and 100 QPS for `/contents`.

## How to rotate a Exa key

1. Create a new Exa key on the API keys page, with the same budget and rate limit as the old one.
2. Replace `EXA_API_KEY` wherever the old key is deployed, including MCP client configs that send it as `x-api-key`.
3. Confirm requests succeed, then delete the old key, for example with `DELETE https://admin-api.exa.ai/team-management/api-keys/{id}` and a service key.

## How to revoke a Exa key

1. Delete the Exa key through the Team Management API with `DELETE https://admin-api.exa.ai/team-management/api-keys/{id}`, using the key's `publicId`.
2. Only keys belonging to the authenticated team can be deleted, so use a service key from the same team.

## If the key leaked

1. Delete the exposed Exa key.
2. Create a replacement with a spending budget so a future leak is capped.
3. Check per-key usage (the Team Management API's Get API Key Usage endpoint) for spend you did not expect.
4. Update `EXA_API_KEY` in every environment and MCP configuration.

## Environment variables

- `EXA_API_KEY`

## Gotchas

- A 402 can come from the account (`NO_MORE_CREDITS`), the key (`API_KEY_BUDGET_EXCEEDED`) or the team (`TEAM_BUDGET_EXCEEDED`); read the tag before replacing a working key.
- Per-key rate limits only lower a key's share; every key still counts toward the team's QPS limit.
- Keyless MCP access needs a direct IPv4 connection to `mcp.exa.ai` and does not include the Exa Agent tool.

## Using this key with AI agents (BotPassword)

- `run_with`: Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
- `http_request`: Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.

## FAQ

### Where do I get an Exa API key?

Create one on the API keys page of the Exa dashboard at `dashboard.exa.ai/api-keys`.

### What is the Exa API key environment variable?

`EXA_API_KEY`. The Python (`exa-py`) and JavaScript (`exa-js`) SDKs read it automatically, so `Exa()` needs no arguments.

### Do I need an Exa API key for the Exa MCP server?

Not for basic search and fetch, which run keyless at a free rate limit. Add an `x-api-key` header, or sign in with OAuth, for higher limits and the Exa Agent tool; the local `exa-mcp-server` package reads `EXA_API_KEY`.

### How do I cap what an AI agent can spend through Exa?

Give the agent its own Exa key with a spending budget and a low rate limit. When the budget is reached the key returns `402 API_KEY_BUDGET_EXCEEDED` instead of drawing more credits.

### Which header does Exa use for API keys?

Exa accepts `x-api-key: <key>` or `Authorization: Bearer <key>` on API requests.

### Can an AI agent use my Exa key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a `.env` file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with `run_with`, `http_request`, so the agent gets the result and never the value.

## Sources

- https://docs.exa.ai/reference/getting-started
- https://docs.exa.ai/reference/exa-mcp
- https://docs.exa.ai/reference/error-codes
- https://docs.exa.ai/reference/rate-limits
- https://docs.exa.ai/reference/team-management/create-api-key
- https://docs.exa.ai/reference/team-management/delete-api-key
