Knowledge base / API keys

Fix ApiNotActivatedMapError on Google Maps

The key is valid, but the API it is calling was never switched on for the Cloud project the key belongs to. Most often the key was created in one project and the API was enabled in another.

How to tell this is your problem

  • The map area is grey with the “Oops! Something went wrong.” overlay on every page load, in every browser.
  • The console shows ApiNotActivatedMapError. It does not show InvalidKeyMapError or RefererNotAllowedMapError, which would point at the key itself.
  • The map loads, but address search, a store locator or directions fail. The console or the network tab shows REQUEST_DENIED for Geocoding, Places or Directions.
  • Nothing changed on your site. Someone created a new project, moved keys around or tidied up Cloud Console.

This is what the console shows:

Google Maps JavaScript API error: ApiNotActivatedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#api-not-activated-map-error

Google's description is short: “The Maps JavaScript API is not activated on your API project.” If you can't open the console on the live site, see how to read Google Maps errors in the browser console.

Why it happens

Every Google Maps Platform API is enabled per project. An API key belongs to exactly one project, and it can only call APIs that are switched on in that project. Creating a key does not enable anything. These are the usual causes, most likely first:

  • The key lives in a different project. You enabled the Maps JavaScript API in project A, but the key on the page was created in project B. This is the most common cause on sites set up by an agency or a previous developer.
  • The API was never enabled. A new project with a fresh key, where the setup stopped after creating the key.
  • Someone disabled it. APIs can be turned off in APIs & Services, by hand or by a clean-up script.
  • The page uses more than maps. Address search, geocoding and directions each call a separate API that has to be enabled on its own.

Geocoding REQUEST_DENIED and other services

The JavaScript API's services don't use the …MapError codes. When a geocoder, Places or directions call is refused, the request comes back with the status REQUEST_DENIED instead. For the Geocoder, Google's documentation describes this as “The web page is not allowed to use the geocoder.” The map itself may load perfectly, so the problem shows up as a search box that does nothing or a store locator with no results.

Google's geocoding guide says to enable the Geocoding API “in the same project you set up for the Maps JavaScript API”. The same applies to the other services. Common pairings:

What the page doesAPI to enable
Shows a mapMaps JavaScript API
Turns an address into a pin (Geocoder)Geocoding API
Address autocomplete or place detailsPlaces API (New), or the legacy Places API for older widgets
Directions or distance between pointsRoutes API, or the legacy Directions API for the older service
Static map imageMaps Static API

Google classed Places API, Directions API and Distance Matrix API as legacy from 1 March 2025 and advises keeping legacy APIs disabled on new projects. If a plugin needs one of them and you can't enable it, the plugin needs updating. See migrating Places Autocomplete to Places API (New) and migrating from the Directions API to the Routes API.

The fix, step by step

  1. 01Copy the key from your page. Use View source and search for maps/api/js or maps.googleapis.com. The key is the key= value. If the page uses the inline bootstrap loader, search for key: instead.
  2. 02In Google Cloud Console, open APIs & Services → Credentials. Use the project picker at the top to switch between your projects until you find the key listed. That project is the one that matters, whatever its name suggests.
  3. 03With that project selected, open APIs & Services → Library, search for Maps JavaScript API and click Enable.
  4. 04Enable every other API the page uses, from the table above. If you aren't sure, check the network tab for requests that return REQUEST_DENIED and note which service they go to.
  5. 05Back in Credentials, open the key. If API restrictions is set to restrict the key, add the APIs you just enabled to its list and save.
  6. 06Make sure the project has an active billing account. A project without billing produces BillingNotEnabledMapError once the API is enabled.
Enabled is not the same as allowed

Enabling an API is a project setting. The key's API restrictions are a separate allow-list on the key. If the project has the API enabled but the key's list leaves it out, you get ApiTargetBlockedMapError for the map, or REQUEST_DENIED for a service. See fixing ApiTargetBlockedMapError.

If you use WordPress or a page builder

Maps plugins often have their own key field, and some widgets accept a key of their own that overrides the global one. The key you checked in step 1 is the one that counts. If a store-locator or address-autocomplete plugin is installed, it almost always needs the Geocoding API or a Places API as well as the Maps JavaScript API. The plugin's settings page usually lists which ones. See where each page builder stores the key.

If you load the API in your own code

Check the geocoder status in your callback, so a refused request shows up in your logs instead of failing silently:

JavaScript
const { Geocoder } = await google.maps.importLibrary("geocoding");
const geocoder = new Geocoder();
try {
  const { results } = await geocoder.geocode({ address: "10 Downing Street, London" });
  map.setCenter(results[0].geometry.location);
} catch (e) {
  // e.code is "REQUEST_DENIED" when the Geocoding API isn't enabled
  // or the key isn't allowed to call it
  console.error("Geocoding failed:", e.code, e.message);
}

Confirm it is fixed

Google notes that after you enable an API you might have to wait a few minutes before requests to it succeed. Give it five minutes, then reload the page in a private window with the console open. The error should be gone and tiles should load. Try the search box or directions too, since those call different APIs.

If the error changes to ApiTargetBlockedMapError, BillingNotEnabledMapError or RefererNotAllowedMapError, the API is now enabled and you have moved on to the next check. Run a scan as well: it loads the page from a clean session and reports each Maps request that was refused.

Common questions

Why does my map work but address search returns REQUEST_DENIED?

The map uses the Maps JavaScript API and the search uses the Geocoding API or a Places API. Each one has to be enabled on the key's project, and listed in the key's API restrictions if those are set.

How do I tell which project an API key belongs to?

Open APIs & Services → Credentials in Cloud Console and switch projects with the project picker until the key appears in the list. A key belongs to one project only, and it can only use APIs enabled there.

Do I need a new key after enabling the API?

No. Enabling the API on the key's project is enough. The existing key starts working once the change has applied, usually within a few minutes.

Is ApiNotActivatedMapError the same as ApiTargetBlockedMapError?

No. ApiNotActivatedMapError means the API is switched off for the whole project. ApiTargetBlockedMapError means the project has it enabled but the key's own API restrictions don't include it.

Check whether this is your error

A scan tells you in about twelve seconds, from a clean session.

Related articles