Algolia keys are managed on the dashboard API keys page at dashboard.algolia.com/account/api-keys. The Search-only key is safe for frontend code, while the Admin API key must stay confidential and never be used in an app.
Algolia key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| Admin API key Never use it in a client app. | — | Yes | All operations on the application | — |
| Search-only API key Predefined; safe for production frontend code. | — | No | Search on all indices in the application | — |
| Secured API key Generated with generateSecuredApiKey; virtual and not stored or shown in the dashboard. | — | Yes | Inherits the base key's restrictions and can only add more | Optional, set with `validUntil` |
How to create a Algolia key
- Sign in to the Algolia dashboard.
- Open API keys.
- Create a key, set its ACL (permissions) and optional restrictions, and save it.
Limiting what the key can do
Each key has an ACL (search, add or delete records, settings, analytics, logs and more). Optional restrictions are accessible indices, rate limit per hour, records retrieved, expiration, HTTP referrers and enforced query parameters.
How to rotate a Algolia key
- Create a new key with the same ACL and restrictions.
- Update your apps to use it.
- Delete the old key.
Algolia recommends regenerating keys at least once a year and limiting each key's validity to one year. Deleting a main key also deletes its secured keys. Deleted keys can be restored with their restrictions, up to 1,000 are kept.
How to revoke a Algolia key
- Open the API keys page and delete the key. Update your apps to a new key first so they do not break.
If your Algolia key leaked
- Create a replacement key and deploy it.
- Delete the leaked key.
- Remember that deleting a main key also removes the secured keys derived from it.
Things that catch people out
- Never put the Admin key or any write-access key in frontend or mobile code.
- Secured API keys do not appear in the dashboard; revoke the base key to revoke them.
Using your Algolia 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 Algolia key, these intents fit:
| Intent | What BotPassword does |
|---|---|
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. |
rotate | Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet. |
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
Where do I find my Algolia API key?
On the dashboard API keys page, dashboard.algolia.com/account/api-keys.
What is the difference between the Admin and Search-only key?
The Admin key can do everything and must stay secret. The Search-only key can only search and is safe for frontend code.
How often should I rotate Algolia keys?
Algolia recommends at least once a year.
Can an AI agent use my Algolia 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.