94

I've been using Google Maps API v3 for some time without an API key, and it worked well.
It still works, but I get a warning in the console:

Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

I include the script the standard way:

<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>

And google.maps.version indicates that I'm using 3.24.2.

In the Google documentation I can only see the different ways to obtain a key, but there is no indication if it's required or not. I noticed the warning today and I'm quite sure it didn't appear a few weeks ago.

Everything is working fine for now, but I'm afraid that maps access without an API key will be ceased in the future. I'm reluctant to register for a key if I don't absolutely need to.

Should I worry about it?

JJJ
  • 32,902
  • 20
  • 89
  • 102
Tamás Sallai
  • 3,195
  • 1
  • 14
  • 25

4 Answers4

101

Creating and using the key is the way to go. The usage is free until your application reaches 25.000 calls per day on 90 consecutive days.

BTW.: In the google Developer documentation it says you shall add the api key as option {key:yourKey} when calling the API to create new instances. This however doesn't shush the console warning. You have to add the key as a parameter when including the api.

<script src="https://maps.googleapis.com/maps/api/js?key=yourKEYhere"></script>

Get the key here: GoogleApiKey Generation site

Max
  • 2,561
  • 1
  • 24
  • 29
  • 3
    This should be marked as the correct answer for this question. Seems silly that someone would ask why the API key says it's missing if they never placed it there to begin with. – Juan Pablo Ugas Jul 11 '16 at 22:34
  • Great! But which is the direct link to generate the API Key? Thanks! – candlejack Jul 31 '16 at 21:57
  • https://developers.google.com/maps/documentation/javascript/get-api-key Included the link into the answer now – Max Aug 01 '16 at 09:09
  • i have the same issue, but i don't know how to add this key, what is the nature of the key and how to choose it. – Bilal Dekar Oct 09 '16 at 08:44
  • the key is a string you get on the site linked in my answer. You add it to the api load url as a GET var. see above – Max Oct 09 '16 at 08:58
  • 3
    So if you add the api key you will be billed for api calls over 25000 per day, but if you don't add api key, can you still use google maps even exceeding the quota?! – cybergeek654 Jun 28 '17 at 09:22
40

A key currently still is not required ("required" in the meaning "it will not work without"), but I think there is a good reason for the warning.

But in the documentation you may read now : "All JavaScript API applications require authentication."

I'm sure that it's planned for the future , that Javascript API Applications will not work without a key(as it has been in V2).

You better use a key when you want to be sure that your application will still work in 1 or 2 years.

Dr.Molle
  • 116,463
  • 16
  • 195
  • 201
  • 4
    For those coming here after June 2016, see @Max answer below - you DO need an api key. This answer is obsolete – Erenor Paz Jul 29 '16 at 07:58
  • 5
    For those coming here in August 2016, all my google js-api maps are still working fine (but yes, i have warnings) – Devtrix.net Aug 03 '16 at 09:02
  • 2
    @Devtrix.net API keys are required for new applications, existing apps are exempted for now, as long as you don't change your url etc. – Rosdi Kasim Jan 10 '17 at 17:10
  • 2
    where to add the key? – mercury Jan 23 '17 at 00:02
  • 1
    @HosMercury https://developers.google.com/maps/documentation/javascript/get-api-key#specify-a-key-when-loading-the-api – Dr.Molle Jan 23 '17 at 11:52
  • This answer is actually not exactly obsolete, because for some APIs the warning is still pops up AND a key is still not required. (I get the warning when using the Google GeoChart, that calls the Maps API internally, without setting up any Google API project). – gilad905 May 04 '17 at 10:58
  • 2018 still fine without a key – rbennell Feb 08 '18 at 10:17
27

I had the same problem and I found out that if you add the URL param ?v=3 you won't get the warning message anymore:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3"></script>

Reproduction online

As pointed out in the comments by @Zia Ul Rehman Mughal

Turns out specifying this means you are referring to old frozen version 3.0 not the latest version. Frozen old versions are not updated with bug fixes or anything. But this is good to mention though. https://developers.google.com/maps/documentation/javascript/versions#the-frozen-version

Update 07-Jun-2016

This solution doesn't work anymore.

Alvaro
  • 40,778
  • 30
  • 164
  • 336
  • This is interesting, can you explain some background why you added it and what is causing warning to go away? – Zia Ul Rehman Mughal Apr 12 '16 at 14:16
  • 1
    Turns out specifying this means you are referring to old frozen version 3.0 not the latest version. Frozen old versions are not updated with bug fixes or anything. But this is good to mention though. https://developers.google.com/maps/documentation/javascript/versions#the-frozen-version – Zia Ul Rehman Mughal Apr 12 '16 at 14:26
  • 5
    Turns out your fiddle actually throws the warning – Max May 03 '16 at 16:49
  • @Max you are right. It seems the behavior changed by now. – Alvaro May 26 '16 at 09:26
  • https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing I want to use this api. Does this need any api key?? – Aman Gupta Jun 14 '16 at 10:14
  • For whatever reason, that solution still works for me on the domain, but it doesn't if it go to the index.html file directly. – Edward Jul 21 '16 at 14:15
  • 1
    Thanks you saved me @Alvaro! – Ana DEV Sep 07 '16 at 07:27
7

Google maps requires an API key for new projects since june 2016. For more information take a look at the Google Developers Blog. Also more information in german you'll find at this blog post from the clickstorm Blog.

eu_typo3
  • 106
  • 1
  • 2