#131Case study1 min

An exposed API key: why is it dangerous?

What a third party can do with a secret key found on a public site.

Hackaiz team · updated 18/11/2026

Illustration: a creator films a short video on a phone.
Illustration: a creator films a short video on a phone. Illustrative photo, not a screenshot.

01What a secret key allows

A secret API key proves to a service that a request comes from you. Anyone who holds it can act on your behalf: read or change data, send messages or use a paid service billed to your account. A key placed in the code of a public website can be read by any visitor, even if it is never shown on screen.

02Public key or secret key

Some keys are designed to be public, such as a publishable key meant for the browser: their safety relies on server-side access rules. Others must stay secret, such as a service key or a private payment key. The risk comes from an exposed secret key, or from a public key used with access rules that are too broad.

03What to do if a secret key was exposed

Removing the key from the code is not enough: it may have been copied in the meantime.

  1. 1Revoke the key with the provider and create a new one.
  2. 2Store the new key as a server-side secret, never in code sent to the browser.
  3. 3Check the provider’s usage history for unusual activity.
  4. 4Run a new analysis to confirm the key no longer appears.

Tip: In Hackaiz reports, secret values that are found are masked: only part stays visible to help you recognize the key.

Frequently asked questions

Take the next step

Was this article helpful?

Related articles