#056Technical2 min

Detect an exposed API key

Tell public from secret keys, and what to do if a secret key leaked.

Hackaiz team · updated 20/11/2026

Illustration: a founder builds an AI app.
Illustration: a founder builds an AI app. Illustrative photo, not a screenshot.

01Public key or secret key

Some keys are meant to be visible in the browser: the Supabase public key (anon or publishable), a Stripe publishable key starting with pk_, or an analytics ID. They only grant what your rules allow. Other keys must never leave the server: an OpenAI or Anthropic key, a Stripe secret key starting with sk_, the Supabase service_role key or a crypto wallet private key. If one of them can be read in your site, any visitor can use it at your expense or bypass your rules.

02How Hackaiz spots it

The surface audit reads what a browser downloads when opening your homepage, including same-site scripts, and looks for known secret key formats. A GitHub repository analysis also looks for them in the code and the files it reads.

  1. 1Open the surface audit (homepage field or Pilot button), enter the site address and accept the public read.
  2. 2Run the surface audit (2 credits).
  3. 3Read the part of the result about secrets.

03What you see, and why

A key value is never shown in full. Without ownership proof of the site, only the key type is shown, with no fragment or location: this prevents anyone from using Hackaiz to retrieve someone else’s key. To see the exact location, prove you own the site or link the GitHub repository.

04What to do if a secret key leaked

Treat it as compromised: removing it from the code is not enough, because it may already have been copied.

  1. 1Revoke the key at the provider and create a new one.
  2. 2Keep the new key server-side only (server function or secret), never in browser code.
  3. 3Check recent usage at the provider.
  4. 4Run the audit again to confirm the key no longer appears.

Frequently asked questions

Was this article helpful?

Related articles