Fix ApiProjectMapError on Google Maps
Google tried to look up the API key on your page and the Cloud project it belongs to, and couldn't resolve one or the other. Google says this can be temporary. If it keeps happening, the key or the project needs replacing.
How to tell this is your problem
- The map shows the grey “Oops! Something went wrong.” overlay.
- The console shows ApiProjectMapError.
- The failure may come and go: the map works on one reload and fails on the next, or fails for a while and then recovers.
- Nobody changed the key, the site or Cloud Console recently, or someone has just reorganised Cloud projects.
This is what the console shows:
Why it happens
Google's error reference says either the API key or the API project it belongs to couldn't be resolved. It adds that the error may be temporary, and that if it persists you may need a new key or a new project.
That gives two quite different situations:
- A temporary lookup failure. Something on Google's side couldn't complete the check for that request. Later requests succeed without you doing anything.
- A key or project in a broken state. The key or project exists in some form, but Google can't tie them together. This happens after a project is shut down, moved or otherwise changed, or when a key is in an unusual state. Google doesn't document the specific triggers, so the practical fix is a fresh key, and if that fails, a fresh project.
Look at the error code carefully. If the console says DeletedApiProjectMapError, the project has been shut down, and the deleted project guide explains how to restore it. If it says InvalidKeyMapError or ExpiredKeyMapError, follow those guides instead.
Step 1: check whether it is temporary
- 01Reload the page in a private window with the console open. Do it several times over a few minutes.
- 02Check the Google Cloud status dashboard and the Google Maps Platform status page for a current incident.
- 03If the map loads normally on later reloads and keeps working, it was a transient failure. Keep an eye on it, but you don't need to change anything.
If the error appears on every load, or keeps returning over several hours, treat it as persistent.
Step 2: check the key and project
- 01Copy the key= value from the maps/api/js URL in your page source.
- 02In Google Cloud Console, find the project that holds this key under APIs & Services → Credentials. If you can't find the key in any project you have access to, ask whoever set up the map. It may be in an account you can't see.
- 03On the project's dashboard, look for any banner about the project's status, billing or a pending deletion.
- 04Confirm the project has a billing account linked and the Maps JavaScript API enabled under APIs & Services.
Step 3: replace the key
- 01In the same project, create a new API key.
- 02Give it the same restrictions as the old key: application restriction set to Websites with your domains listed, and under API restrictions choose Restrict key and select the Maps JavaScript API plus any other APIs your page uses.
- 03Replace the key everywhere on your site: theme options, maps plugins, page builder widgets and environment variables. See where page builders store the key.
- 04Clear page and CDN caches, then reload in a private window.
Step 4: if a new key fails too, use a new project
If a brand-new key in the same project still produces ApiProjectMapError after a few minutes, the project itself is the problem. Create a new project in an account your organisation controls, link billing, enable the Maps JavaScript API and the other APIs you need, create a restricted key, and put it on your site.
If the old project matters to you for other reasons, raise a support case with Google Cloud from the project. A project Google can't resolve is not something you can repair from the console yourself.
A map that fails on some loads is easy to miss when you test it yourself, because a reload often fixes it. Visitors who hit the bad load just see a broken map and leave. If this error has appeared once, consider monitoring the page so a recurrence is caught.
Confirm it is fixed
Reload the page several times in a private window with the console open. The error should not return. Because this error can be intermittent, one clean load isn't proof. Check again later in the day.
Run a scan too. It loads the page from a fresh session and reports any Maps error codes in the console, which is a quick way to recheck without clearing your own browser.
Common questions
Is ApiProjectMapError my fault or Google's?
It can be either. Google says it may be temporary. If it clears after a few reloads and doesn't come back, it was most likely on Google's side. If it persists, the key or project needs replacing.
How is this different from DeletedApiProjectMapError?
DeletedApiProjectMapError specifically points at a project that may have been deleted. ApiProjectMapError is less specific: Google couldn't resolve the key or the project, and the cause may be temporary.
Will creating a new key break anything?
Not if you copy the old key's restrictions to the new one and update every place the old key is used. Keep the old key until the new one is working, then delete it.
Does a new project mean a new billing account?
No. You can link a new project to your existing Cloud Billing account. You still have to link it, because a new project starts without billing.
A scan tells you in about twelve seconds, from a clean session.