How to find exposed API keys on your website
By Afaq Ahmad. Published , last updated .
To find exposed API keys on your website, view the page source and the scripts the page loads and search them for the start of the keys your services use, such as sk_live_ for Stripe. The free exposed API key checker does this for one page. If you find a secret key, replace it with a new one and keep the new one on your server.
Free tool for this: Free exposed API key checker. It checks one page, with no sign-up.
Which keys are a problem
Some keys are made to be public: a Stripe publishable key (it starts with pk_) and a Supabase anon key. Others are secrets that act as you: a Stripe secret key (sk_live_), a Supabase service role key, an OpenAI or Anthropic key, AWS keys, GitHub tokens and similar. A secret key in code that runs in the browser can be copied by any visitor.
How to look yourself
- Open your page, press Ctrl+U (Cmd+Option+U on a Mac) to view the source and search for “key”, “secret” and “token”.
- Open DevTools, then the Sources tab, and search all files (Ctrl+Shift+F) for the first characters of each key type you use, for example sk_live_.
- Check the Network tab for requests that carry a key in the address or in a header.
Use the free checker
The free exposed API key checker reads one page and the scripts it loads from the same site, looks for the shapes real keys have and tells you the kind of key it found. It shows only the fixed first characters, for example “a key starting with sk_live_...”, and never uses the key.
If you find one
Treat it as stolen, even if you remove it from the page straight away, because anyone who saw it before can still use it.
- Create a new key in the service’s dashboard.
- Delete the old key, so the exposed one stops working.
- Move the new key to your server, a server function or an environment variable that is not sent to the browser.
- Check the service’s logs and bills for use you do not recognise.
How to stop it happening again
Keep calls that need a secret key on a server. When an AI builder suggests putting a key in front-end code to make a feature work, ask it to move the call to a server function instead. Check the live site after each change, because that is the code visitors get. A Glitchmark scan reads every page it reaches, up to your plan’s page limit, for exposed keys and masks any it finds.