Skip to content
Databases & keys · Secret guide

Leaked Algolia Admin API Key: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

An Algolia Admin API key gives full control of an Algolia application: it can read, add, change and delete records in every index, change settings and ranking rules, and create or delete other API keys. The main danger is write access to your search data. An attacker can erase indices, inject records or links that your site then shows to visitors, or read everything that is indexed. Delete the key first, then investigate.

Check your GitHub account for leaked secrets — free

Provider
Algolia
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What an Algolia Admin API key looks like

An Algolia API key is 32 lowercase hexadecimal characters, sent together with the application ID, which is a separate short identifier:

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   32 characters (a-f, 0-9)
X-Algolia-Application-Id: XXXXXXXXXX
X-Algolia-API-Key: XXXXXXXX…

Algolia has several key types, and the difference is the whole point:

  • Search-only API key. Meant to be public and placed in frontend code. It can only run searches. Finding one in a repository is normal, and it does not need an emergency rotation unless it was configured loosely.
  • Admin API key. Full access to the application. It must never reach a browser, a mobile app or a public repository.
  • Other API keys. Keys that you create with chosen permissions, indices, rate limits and restrictions. Their risk depends on what you granted, such as writing records or deleting indices.
  • Secured API keys. Keys derived from a parent key. Deleting the parent also removes them.

Because every key has the same 32-character form, you tell them apart by the variable name (ALGOLIA_ADMIN_KEY, ALGOLIA_API_KEY, ALGOLIA_SEARCH_KEY) and by the permissions shown for the key in the Algolia dashboard.

How Algolia Admin API keys get leaked

  • Frontend code and bundles. A developer initialises the search client in the browser with the admin key instead of the search-only key.
  • Indexing scripts. A script that pushes records to Algolia, committed with the admin key inline.
  • Static site generators and plugins. Documentation or e-commerce site configuration where the admin key sits in a config file next to the public one.
  • Committed environment files. ALGOLIA_ADMIN_API_KEY in a .env, a compose file or a deployment manifest.
  • CI pipelines. An indexing step on every deploy, with the key printed in a log or stored in a public pipeline file.

What to do in the first hour

  1. Identify the key. In the Algolia dashboard, open the API keys section for the application and match the exposed value. Check its permissions: an admin key, or a custom key with write rights.
  2. Create a replacement. For a backend job, create a new key with only the permissions and indices it needs, rather than reusing the admin key. Deploy it to the application or secret store.
  3. Delete the exposed key. Remove it from the dashboard or through the API. Note that deleting a main key also deletes the secured keys generated from it, and those cannot be restored, so regenerate them from the new key.
  4. Verify that indexing still works. Run your indexing job and check that search still returns results.
  5. Audit the data. Compare the record counts of your indices with what you expect, and look for records, synonyms, rules or redirects you did not create. Injected records are the usual sign of abuse.
  6. Check the settings and keys. Review index settings, query rules and the list of API keys for entries you do not recognize, since an admin key can create new keys that survive your rotation.
  7. Check usage. Look at the usage and logs views of the application for spikes in operations or searches from unfamiliar sources.
  8. Clean up the code and search for other secrets next to the key. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same repository? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at Algolia

API keys are managed from the API keys section of your Algolia dashboard, after you sign in as a user who can manage the application. Algolia documents a list of all keys with the option to delete them, and its support guidance for compromised keys is to delete the exposed key and replace it with a new one that has only the permissions it needs. A person has not confirmed the exact menu wording for this guide, and the dashboard can change, so look for the section where API keys are listed and select the exposed one. If the Admin key itself is the one exposed, revoke it and update every backend service that relied on it. Algolia can restore a deleted key, so deletion is not a way to lose data, but never restore one that leaked.

How LeakWatch detects it

The rule is called Algolia API Key. It needs the word algolia in any letter case, then up to 20 characters of label, an assignment sign such as =, : or =>, optional quotes, and a value of exactly 32 lowercase letters and digits followed by a delimiter or the end of the line. Prose like “powered by algolia search”, or a 32-character value with no Algolia wording before it, is not reported. The rule cannot tell an Admin key from a search-only key, since both have the same form, so a hit may be a public key. The severity is high. This type is not checked live: LeakWatch does not send any request to Algolia with the key it found.

LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

FAQ

Is a search-only key in my frontend a leak?

No, it is designed to be public. It can only search the indices it allows. What matters is making sure the key found is really search-only, and not the Admin key.

Does deleting the Admin key break my site?

Anything that uses it for indexing or settings will fail until you deploy the new key. Search from the browser keeps working if it uses a separate search-only key.

Could the attacker have changed my search results?

With a write-capable key, yes. They could add records or rules that promote their content. Review the indices, rules and synonyms, and re-index from your source of truth if in doubt.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with Algolia.