Fix guide · medium · api_key_in_url

API key passed in URL query string

What this rule means

An API-key-shaped query parameter (api_key=, apikey=, etc.) was found in the bundle. URLs ride in too many side channels (logs, history, Referer) for credentials to live there.

Why it matters

Same fundamental leak surface as auth tokens (see /fix/auth_token_in_url) — server logs, browser history, Referer headers, analytics. The severity is lower because:

But it's not zero-risk:

Decision tree:

How to fix it

1. Move it to a header. Most APIs accept their key as a header in addition to query params:

fetch('https://api.example.com/things', {
  headers: { 'x-api-key': 'YOUR_KEY' }
});

2. If it's a private key, rotate it. Get a new one from the provider, update your config, deploy. Treat the leaked one as compromised — assume someone has it.

3. If it's a public key, audit your assumption. Many "public" keys have hidden modes that aren't actually public (Algolia "search-only" keys can mutate analytics endpoints; Stripe "publishable" keys can list customers in some old configurations). Read the provider docs.

4. For provider APIs you can't change (an API that only accepts query-string keys), proxy through your own backend. The browser hits /api/proxy/things; your backend adds the key and forwards. Now the key only lives server-side.

Did vibecheck flag this on your app?

If you reached this page from a vibecheck inspection report, the redacted match in your scan output is the exact string we found in your bundle. After applying the fix above, run the inspection again — the finding should clear.

Run another inspection