FOR NON-ENGINEERSGUIDE
BY PT MAVERICK RINTIS KARYA

6 MIN READ
VERIFIED 2.1.325. Last verified on 16 November 2026 with Claude Code 2.1.325.

Where are my API keys, and who can see them?

[SHORT ANSWER]

Some keys are meant to be public. Secret keys are not, and anything your app sends to the browser can be read by every visitor. Ask Claude Code to list the keys in your app, cancel any secret key that leaked, then move it to a server function that keeps it for you.

General information, not a security guarantee. Apps that handle payments or health data should get a professional review.

The short version

A key is a password your app uses to talk to another service, such as an AI model, a payment service or a database. Some keys are made to be public. Secret keys are not. Before you share your link, make sure no secret key is in anything the browser downloads, and keep each one on a server instead.

Two groups of people can see your keys:

  • Every visitor can read anything your app sends to their browser. Nobody needs to log in to do it.
  • Anyone who can see your code, for example on GitHub, can read keys written into it. Google’s and Stripe’s pages both say never to put keys in code you save there.

What goes wrong without it

Say you ask your builder to add an AI summary button. It may save your AI key under a name that starts with VITE_ or NEXT_PUBLIC_. Those starts tell the app’s build tools to copy the value into the files every visitor downloads. Vite’s and Next.js’s own pages say so, and Vite’s says these names should not hold API keys. A stranger opens your site, searches those files and finds the key. They use it for their own work, and you get the bill.

Two rows of three boxes. Wrong: your app's code holds the secret key, the visitor's browser downloads the code, a stranger copies the key and uses it. Right: the visitor's browser has no secret key, it asks a server function that holds the key, and the function calls the AI or payment service. Only the answer comes back to the browser. The key never does.

Which keys are public

Checked on 16 November 2026, from each company’s own page (for Supabase, its documentation’s source on GitHub):

Key starts withWhoseFine in the browser?
sb_publishable_, or the older anon keySupabaseYes. It reaches only what your access rules allow.
sb_secret_, or the older service_role keySupabaseNo. It skips your access rules.
pk_test_, pk_live_StripeYes
sk_, rk_StripeNo
sk-ant-apiAnthropic (Claude)No
The web key in a Firebase app’s setupFirebaseYes. Firebase’s page says it may be in your code.
A Google key made for Gemini AIGoogleNo. Google’s page says never to put it in a web app.

A key from any other AI company is a secret too, unless that company’s own page says otherwise. Two kinds of key can look alike, so don’t judge them by their first letters. Google keys for Firebase and for Gemini look alike. So do Supabase’s older anon and service_role keys, which both start with eyJ. Check what each key is for.

Find them with Claude Code

Claude Code is Anthropic’s coding assistant. Run it in the folder that holds your app’s code.

  1. Paste the prompt below. It asks Claude not to change anything. In our test, Claude was only allowed to read files.
  2. Read the answer. Each problem should name a file, the kind of key and what a stranger could do with it. Public keys come in a separate list.
  3. For each secret key, cancel it at the company that issued it (the steps are below). Anyone who saw it may have kept a copy.
  4. Then ask Claude to move the call that uses the key into a server function. That is a small program that runs on a server, not in the browser, and reads the new key from its own settings. We did not test this step.
  5. Make a fresh build of the app, which is the set of files visitors download, and run the prompt again.
Prompt for Claude Code · TERMINAL · TESTED ON 2.1.325
Check this app for secret keys that reach the browser. Look in the source files, the .env files, the public folder and the built files in dist. Tell me, in plain words, for each secret key you find: the file, what kind of key it is, and what a stranger could do with it. Show only the first 8 characters of any key. Then list separately the public keys that are meant to be in the browser and are not a problem. A Google key used for Gemini AI is a secret, not a public key. Do not change anything.

In our test on Claude Code 2.1.325, a small made-up app held six fake secret keys, in its code and in its built files: AI keys from OpenAI, Anthropic and Google Gemini, two Supabase admin keys and a Stripe secret key. In both runs Claude found all six and named the built files, and it put every public key on the public list, including a Firebase key that starts like the Gemini one. On a fixed copy of the app, which we made ourselves rather than by following step 4, both runs found no secret key.

Cancel a key that leaked

Never put the new key where the old one was, or it leaks the same way. It goes only in the server function from step 4. If a stranger may be using the key right now, cancel it at once, even though that feature stops working until step 4 is done.

We didn’t open these dashboards. The menu names come from each company’s page, checked on 16 November 2026 (for Supabase, its documentation’s source on GitHub). They say:

  • Stripe: on the API keys page, open the three dots (⋯) next to the key and choose Rotate key. Under Expiration, choosing Now deletes the old key at once. Any other choice keeps both keys working for a while. Stripe also suggests a restricted key (rk_) in place of a secret key.
  • Supabase, newer keys: in Settings > API Keys, create a new secret key, switch your app to it everywhere, then delete the old one. Deleting can’t be undone.
  • Supabase, older service_role key: there is no new service_role key to switch to. Move your server to a new secret key and your app’s browser side to a publishable key. Then turn off the older keys in Settings > API Keys, which turns off anon and service_role together. Supabase’s page also says to revoke the older signing secret that made these keys, and links to the steps.
  • Anthropic: on the API keys page in the Claude Console, Anthropic’s account website, Disable can be undone and Delete cannot.
  • Google Gemini: Google’s page says to disable a leaked key in the Google Cloud console.

How to check it worked

Check the live site, not only your files. On a computer:

  1. Open your published site. Right-click the page and choose View page source.
  2. Click the address of each .js file it lists.
  3. Press Ctrl+F (Command+F on a Mac). Search for sk_live_, sk_test_, rk_live_, sk-ant- and sb_secret_. Keys from other AI companies won’t show up in this search. The prompt above finds them.

We didn’t run this live-site search for this guide.

You want no matches. A public key such as pk_live_ showing up is fine. A long key starting with eyJ, or a Google key, could be public or secret, so run the prompt above to tell which. The pre-launch secrets sweep skill checks your app’s files and built files for you in Claude Code. It doesn’t open your live site.

A public key is only as good as the access rules behind it. The Supabase access rules review checks those next.

Before you launch, check

  • No secret key in your app's code, its .env files or its public folder
  • No secret key in the built files visitors download
  • Every leaked key cancelled at the company that issued it
  • Each secret key kept in a server function, not the browser
  • A search of your live site's .js file finds no secret key
[WRITTEN AND TESTED BY]

PT Maverick Rintis Karya

the company that runs Runs on AI. AI agents built on Claude write and test every guide, and a second agent checks each one against its test record before it is published.