Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4862 pages

Help for owners

My Google Maps API bill is suddenly high and nobody changed anything

Short answer

A Google Maps API bill that is suddenly high means more billable requests than before, from a misused key, code that calls the API too often or a change in what is free. Google warns that you are financially responsible for charges caused by abuse of unrestricted API keys. Restrict each key, check usage per API and replace keys in planned steps.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • The Google Cloud invoice for Maps is several times last month's.
  • The usage report lists Maps APIs my website or app never uses.
  • Requests keep coming at night when my customers are asleep.
  • Anyone can see the map key in my website's page source.
  • The bill grew right after an address search box went live.

Why does this happen?

  1. Unrestricted keys get used by strangers

    Google's security guidance says to restrict every API key by application, such as website addresses, server IP addresses or Android and iOS app identifiers, and by the APIs it may call. It adds that you are financially responsible for charges caused by abuse of unrestricted keys. A key in a web page is public by design, so restrictions are what keep it yours.

  2. One key shared by every app hides the source

    Google recommends a separate key for each app, so a compromised key can be rotated or deleted without updating every other app, and so usage can be told apart. With one shared key, the bill cannot show which site or app grew.

  3. Google changed how free usage works

    Google's billing change page says the old monthly credit was replaced by a free usage threshold for each Core Services SKU, grouped into Essentials, Pro and Enterprise. Geocoding, for example, includes 10,000 free requests per month. A site that used to fit inside the credit can now pay for one API while another is still free.

  4. Some older APIs are now Legacy

    The same page lists Places API, Directions API and Distance Matrix API as Legacy, with fewer volume discounts and no new features, and recommends Places API (New) and Routes API instead.

  5. The code asks for more than it needs

    An address box that looks up every keystroke, or a map loaded on pages where it is hidden, multiplies requests without any extra customers.

What can I do about it today?

  1. Group the bill by serviceIn Google Cloud billing, view the costs by service and SKU for the last two months, and note which Maps API grew and on which day.
  2. Look at each key's restrictionsOn the Credentials page, check that every Maps key has an application restriction and an API restriction. Write down any key with neither.
  3. Restrict before you deleteDeleting a key that is still in use takes your maps offline. Google's advice is to restrict the key first and replace it only if restricting is not possible or abuse continues.
  4. Set a budget alertAdd a budget with email alerts on the billing account, so the next spike reaches you in days and not at invoice time.

When should I bring someone in?

  • Usage keeps climbing after every key has restrictions.
  • You can't tell which website or app uses which key.
  • The amount is large enough that you want to take it up with Google with clear evidence.

How do I handle it?

  1. Read usage per key and per APIGoogle's Metrics explorer can filter calls by credential, which shows what each key calls and from which platform before anything is changed.
  2. Split and restrict keysEach website, server and app gets its own key with one application restriction and only the APIs it needs, and unused Maps APIs are disabled on the project.
  3. Cut wasteful calls in the codeAddress search waits for the user to pause typing, maps load only when shown and repeated lookups are cached where Google's terms allow.
  4. Plan any move off Legacy APIsScreens that use Legacy Places or Directions get a scoped plan to move to the newer APIs, tested on a staging key first.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Will Google refund charges caused by a stolen key?

Google's guidance says you are financially responsible for charges from abuse of unrestricted keys. You can still contact Google Cloud billing support about your case, with the usage evidence ready.

Is any Google Maps usage still free?

Google's billing change page describes a monthly free usage threshold for each Core Services SKU, and the amount differs by category. Check the current pricing page for the APIs you use.

Why is the key in my mobile app harder to replace?

Google notes that users must update the app before a new key takes effect, so a restricted old key keeps serving older installs during the switch.

Should I switch to another map provider?

Fix keys and wasteful calls first, then compare providers on your real request counts. A move has its own development cost.

Sources

For your developer: the technical fixes

Related help

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.