AIza…

Exposed Google API Key? Here's how to detect and rotate it

A leaked Google API key (AIza…) can rack up Cloud and Maps billing on your project. Scan free with Trust, then delete or restrict it in Google Cloud Console.

A Google API key (starting with AIza) authenticates calls to Google services like Maps, Cloud, and other APIs, and bills usage to your Google Cloud project. If the key is unrestricted, anyone who finds it can call those APIs on your project until you revoke or lock it down. Restricting a key to specific APIs and referrers limits the blast radius, but a leaked unrestricted key must be deleted or rotated.

What an attacker can do with a leaked Google API Key

How Google API Keys get exposed

Scan your repo and live site for exposed Google API Keys — free

Trust checks your code, git history, and shipped JavaScript. No signup, results in about a minute.

Run a free scan →

How to rotate a leaked Google API Key

  1. Go to console.cloud.google.com/apis/credentials and pick the affected project at the top.
  2. Find the leaked key under API Keys, open it, and click Delete — or click Regenerate/Rotate key to swap it.
  3. Note that deletion propagates gradually, so treat the old key as live for up to ~30 minutes.
  4. Create or edit the replacement key and add Application restrictions (HTTP referrers, IPs, or app) plus API restrictions so it only calls the services you need.
  5. Update your server environment or secrets with the new key and redeploy; never ship it in client code unrestricted.
  6. Open APIs & Services → Metrics (and Billing) to check for usage spikes or unexpected API calls from the abuse window.

Open the Google API Key dashboard →

Other secret types to check

Keep your app safe