Skip to main content

Understand Google Maps API-key errors and restrictions

Open DevTools → Console and locate the first message containing Google Maps JavaScript API error. The code identifies which Google Cloud control failed.

Console code or symptomMeaningFix
MissingKeyMapErrorMaps loader has no keySave the browser key under Settings → Map and clear caches
InvalidKeyMapErrorGoogle cannot find the keyCopy the complete current key from the correct Cloud project
ExpiredKeyMapErrorKey expired or is not recognizedWait briefly for a new key to propagate or replace the expired key
ApiNotActivatedMapErrorMaps JavaScript API is disabledEnable Maps JavaScript API in the key's project
ApiTargetBlockedMapErrorAPI restrictions exclude the requested servicePermit Maps JavaScript API and any required Places/Static service
BillingNotEnabledMapError / ClientBillingNotEnabledMapErrorProject has no active billingAttach/enable billing for the same project
RefererNotAllowedMapErrorCurrent website origin is absent from Website restrictionsAdd exact HTTP/HTTPS production, staging, and local origins as needed
OverQuotaMapErrorProject/key exceeded a quotaInspect quotas and usage in Google Cloud; do not simply remove restrictions
Dark watermarked mapUsually key or billing failureFind the accompanying console code and fix that condition

Browser key versus server key

Cliq Store Locator intentionally has two fields:

  • Browser key loads Maps JavaScript plus places,marker libraries and is visible in page source. Restrict by Websites.
  • Server key is used by server-side Google geocoding for imports and Fill missing coordinates. Keep it private and restrict by server IP plus Geocoding API.

Using one heavily restricted key for both commonly causes either the frontend map or server geocoding to fail.

Local and staging domains

Website restrictions must cover the origin used in the browser. Add entries for production and each legitimate staging/local HTTP(S) host. Ports matter for local testing. Avoid authorizing * globally; Google recommends separate keys per application and restrictions appropriate to each key.

After changing Cloud settings, allow propagation time, purge page/CDN optimization caches, open a private window, and reload the exact failing URL.