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

Source: https://botpassword.com/keys/algolia
Last checked: 2026-10-25

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.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Admin API key | — | Yes | All operations on the application | — |
| Search-only API key | — | No | Search on all indices in the application | — |
| Secured API key | — | Yes | Inherits the base key's restrictions and can only add more | Optional, set with `validUntil` |

## How to create a Algolia key

1. Sign in to the Algolia dashboard.
2. Open [API keys](https://dashboard.algolia.com/account/api-keys/).
3. 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

1. Create a new key with the same ACL and restrictions.
2. Update your apps to use it.
3. Delete the old key.

## How to revoke a Algolia key

1. Open the API keys page and delete the key. Update your apps to a new key first so they do not break.

## If the key leaked

1. Create a replacement key and deploy it.
2. Delete the leaked key.
3. Remember that deleting a main key also removes the secured keys derived from it.

## Gotchas

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

## FAQ

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

## Sources

- https://www.algolia.com/doc/guides/security/api-keys/
- https://www.algolia.com/doc/guides/security/security-best-practices/
