Skip to main content
Every request to the Andi AI Search API must include an API key in the x-api-key header. The same key authenticates every access path: REST requests, the Andi CLI, and the MCP server.

Getting an API key

  1. Sign in to the API Console
  2. Go to API Keys
  3. Click Create Key
  4. Copy the key — it’s only shown once

Setting up your environment

Store your API key as an environment variable rather than hardcoding it in your code.
Create a .env file in your project root:
Load it in your code:
Or export directly in your shell:
Pass the key as an environment variable:
Or use an env file:
Add ANDI_API_KEY as a repository secret, then reference it in your workflow:
Add ANDI_API_KEY in your project’s environment variables settings. These are automatically available as process.env.ANDI_API_KEY in your server-side code.

Managing keys

The API Console lets you:
  • Create multiple keys for different applications or environments
  • Rename keys to identify their purpose
  • Enable/disable keys without deleting them
  • Revoke keys that are no longer needed
Each key tracks its own usage. You can monitor request counts and credit consumption per key in the console.
Use separate API keys for development and production. This makes it easy to rotate keys, track usage per environment, and revoke a compromised key without affecting other environments.

Security practices

Treat API keys like passwords. Never commit them to version control or expose them in client-side code.
  • Store keys in environment variables or a secrets manager
  • Use separate keys for development and production
  • Rotate keys periodically
  • Revoke keys immediately if compromised
  • Restrict key access to team members who need it
  • Add .env to your .gitignore

Next steps

Search modes

Automatic effort by default, manual control when you want it.

Build with AI agents

Use your key with the MCP server and agent tools.

API Console

Manage your API keys, monitor usage, and configure rate limits.

Error handling

Handle authentication errors and other failures.