Search code examples
google-mapsgoogle-maps-api-3api-keygoogle-maps-static-api

Google Static Maps rejects requests for some domains


On some domains Google Maps returns instead of image this error message: The Google Maps Platform server rejected your request. You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account

Domains where it does not work:

Domains where it works:

The image I display on web is from http://maps.googleapis.com/maps/api/staticmap URL. It is Google Maps Stati API https://developers.google.com/maps/documentation/maps-static/intro

Why on some domains it works and some not? If it wil not work for any domain, then I think I need to add "key=YOUR_API_KEY" parameter.

I spent many hours trying to find out the reason, but did not succeeded. Any help is very welcome.


Solution

  • In the past (and this is probably still the case), domains that were using the API before keys became required were "grandfathered" with keyless access (they will work without a key).

    Keys are now required, so regardless whether the domains "work" without keys or not, it is best to add a valid key to the request.

    The things that determine whether or not the domains are "grandfathered" to keyless access are:

    • When the domain was created
    • When the domain started using the Google Maps APIs