Databases, search and data

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

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.

Exa key types

TypePrefixSecret?ScopeExpiry
Exa API key
Exa does not document a key prefix. Traffic from every key counts toward the team-wide rate limit.
—YesThe Exa endpoints the team's plan allows, spending the team's credits; can carry its own lower rate limit and spending budget—
Service key
Created from the Service keys tab on the API keys page once Exa enables the feature for the team (request it from support@exa.ai).
—YesThe 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.

Open Exa's key settings

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.

Exa has no in-place regenerate; rotation is create, deploy, delete. The Team Management API can script it with a service key, and its usage endpoint reports cost per key over the last 100 days, which shows when the old key has gone quiet.

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 your Exa 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 and CLI

Exa's SDKs and docs read the key from EXA_API_KEY.

Things that catch people out

  • 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.

Common Exa authentication errors

401 INVALID_API_KEY

The Exa API key is missing, empty or invalid.

402 NO_MORE_CREDITS

The account has no remaining credits.

402 API_KEY_BUDGET_EXCEEDED

This key reached its spending budget for the current billing period.

Using your Exa key with AI agents

A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.

BotPassword works this way. For a Exa key, these intents fit:

IntentWhat BotPassword does
run_withRuns 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_requestMakes 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.

Exa also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.

Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents

Frequently asked questions

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.

Stop pasting Exa keys into agents

BotPassword is in early access. Request an invite and we'll email you when your spot opens.