Skip to main content

Is your API key exposed on your website?

Apps built with AI often ship an OpenAI, Claude or Gemini key inside their public JavaScript, where anyone can copy it and run up your bill. Enter your website and see in seconds what a stranger can find.

Free · 1 scan a day ( Hostwares customers get 5) · We only read what any browser can download, and never use a key we find.

What the scanner checks

The page itself

The HTML your homepage sends, its inline scripts and its response headers.

Every JavaScript bundle

Each same-site script the page loads, and the chunks those scripts import, the way Vite, Next.js and other bundlers split them.

Public source maps

If .map files are downloadable, your original source code is public. We flag that and scan the source inside.

Files that should never be public

/.env, /.env.local, /.env.production and /.git/config.

Keys it recognises: OpenAI, Anthropic, OpenRouter, xAI, Groq, Perplexity, Hugging Face, Replicate, Stripe, Supabase, GitHub, AWS, Slack, SendGrid, Google, private keys, and any long value assigned to a name like OPENAI_API_KEY or SECRET_KEY.

Why AI-built apps leak keys

When you ask an AI builder to “add a chatbot” or “summarise with GPT”, the quickest code calls the model straight from the browser. The key goes into a VITE_ or NEXT_PUBLIC_ variable, the build copies it into a JavaScript file, and the file is served to every visitor. Bots scan the web for exactly these keys and use them within hours.

Found one? Fix it in this order

  1. Revoke the key with the provider and create a new one. Removing it from the code is not enough.
  2. Move the call to your server, an API route or edge function that reads the key from a server-only environment variable.
  3. Set a spend limit with the provider and check its usage page for calls you did not make.

For developers and AI agents

The same scan as JSON. Signed-in calls (session or Hostwares API key) return the full report.

curl "https://hostwares.com/api/tools/key-scan?url=example.com"

Connected to the Hostwares MCP server? Ask your AI: “scan my site for exposed API keys”.

Questions

How do I check if my API key is exposed on my website?

Enter your website address above. The scanner downloads what any visitor's browser downloads (the page, every JavaScript bundle, source maps and a few config files) and looks for API keys from OpenAI, Anthropic, Google Gemini, xAI, Groq, OpenRouter, Supabase, Stripe, GitHub, AWS and others. It shows what it found in seconds.

Why is my API key in my JavaScript when I put it in a .env file?

Variables that start with VITE_, NEXT_PUBLIC_ or REACT_APP_ are copied into the JavaScript bundle when the app is built, so every visitor can read them. A .env file keeps a key out of your git repository, not out of the browser. Any key the browser can use is public. Lovable, Bolt, v0 and other AI builders often put a key there when you ask the app to call an AI model directly.

What should I do if my OpenAI or Gemini key is exposed?

Revoke the key with the provider first and create a new one, because a key that was public is compromised even after you remove it. Then move the call to a server route or edge function that reads the key from a server-only environment variable, and set a spend limit with the provider. The full report includes a prompt you can paste into your AI coding tool to make that change.

Is a Supabase anon key or a Firebase API key a leak?

Usually not. The Supabase anon (publishable) key and Firebase web config are meant to be public, so the scanner marks them as Info. They are only safe if Row Level Security or Firebase security rules are set correctly. The Supabase service_role key or an sb_secret_ key is different: it skips Row Level Security, so it is marked Critical.

Does the scanner use or store my API key?

No. It only matches text. It never sends a found key to the provider or anywhere else, and it does not store keys: reports show a masked form such as sk-proj-Ab…x9Q2 and a one-way fingerprint so the same key can be grouped across files.

Can it find every leaked key?

No scanner can. This one sees only public files on the address you enter. It cannot see your server code, private repositories, git history or keys pasted into other services. A clean result means nothing was found in what is public, not that the app is secure.

How many scans can I run?

One scan a day for free. Hostwares customers get five scans a day, from the dashboard too. If someone scanned the same address in the last six hours, you see that result instantly without using your scan.

Can AI agents use this tool?

Yes. GET https://hostwares.com/api/tools/key-scan?url=example.com returns the result as JSON, and the Hostwares MCP server has a scan_exposed_keys tool, so Claude, ChatGPT, Cursor and other agents can run it and read the fix steps.

Host the fix where your app already lives

Hostwares runs the server half of an AI-built app: API routes, a dedicated Supabase, and secrets kept as server-only environment variables. Customers scan their own sites from the dashboard, five times a day.