When using the google maps static API service, all my requests are showing up as a 403 Forbidden. When taking a look at my request, I notice this error message: "The Google Maps API server rejected your request. This service requires an API key."
The code that is calling the service is below:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=Albany,+NY&zoom=13&scale=false&size=600x300&maptype=roadmap&format=png&visual_refresh=true" alt="Google Map of Albany, NY">
I've used the static map service before and it worked fine and easily. But for some reason, all my requests show up as a 403 now? I've never had to use an API key in the past. If I do use an API key with this call, it works.
What is going on here?
The Google Static Maps API now requires a key (as of June 22, 2016), existing applications should be "grandfathered" with keyless access. See this blog post for more information (relevant text below):
As of June 22, 2016 we are making the following changes to the Google Maps APIs Standard Plan:
We no longer support keyless access (any request that doesn't include an API key). Future product updates are only available for requests made with an API key. API keys allow us to contact developers when required and help us identify misbehaving implementations.
We have implemented a simple 25,000 map loads per day free limit to new Google Maps JavaScript API, Static Maps API, and Street View Image API implementations. The confusing 90-consecutive-day grace period for these APIs is being retired on October 12, 2016. With this change, developers can predictably plan for growth while media sites and US nonprofits can request more quota at no charge via our dedicated support programs.
We have reduced the daily map load maximum limit you can purchase for Google Maps JavaScript API, Static Maps API, and Street View Image API from 1,000,000 to 100,000 requests per API.* We believe higher-volume developers are best served with a Premium Plan license, which includes technical support and a Service Level Agreement, and with this change we've also created consistency between Standard Plan quotas across our maps and web service APIs.
We now count Google Maps JavaScript API client-side requests towards the daily limit of the associated web service API.*
The new policies will apply immediately to all Maps API implementations created on or after June 22nd, 2016.
Existing applications have been grandfathered based on their current usage to ensure that they continue to function both now and in the future. We will also be proactively contacting all existing API key users who, based on usage growth patterns, may be impacted in the future. If you’re an existing user, please take the time to read our Policy Update for Standard Plan summary for details on how each of these changes might affect your implementation.
Related
Why Google Maps Timezone Web Service works with/without specifying API-KEY but Google Places Web Service needs API-KEY?
Generally why some google web services don't insist on entering API-KEY, do they monitor IP?
As far as I know Google intends to deprecate a keyless access to their APIs. The last one was keyless access deprecation for Maps JavaScript API, Static Maps API and Street View API announced on June 22, 2016.
https://maps-apis.googleblog.com/2016/06/building-for-scale-updates-to-google.html
Probably, keyless access for web services will be deprecated at some point as well.
Currently, if you execute TimeZone API with an API key your quota is applied on per project basis. Otherwise the quota is applied on per IP basis. If you share the IP with somebody else probably you couldn't execute 2500 daily requests. So, an API key is a better option to control your usage.
Update
With migration to Google Maps Platform that was announced on May 2, 2018 the keyless access was deprecated for all APIs. From now on you must use an API key and enable Billing account in your project in order to be able to use Google Maps APIs.
I'm reading the documentation for the Google Geocoding API, and I noticed that it says that a key is required in a geocoding request, but when I do "https://maps.googleapis.com/maps/api/geocode/json?address=LosAngeles,usa" it gives me the expected result.
Why is this? Is the documentation wrong? Will it start asking for the key after a certain amount of requests? Or is there something I'm not understanding?
Providing a key is not required for most geocoding API requests. When you do not provide a key, Google will use an IP-based quota to determine when you reach the 2,500-queries daily limit.
Some parameters require a key and will not allow IP-based quota. These are explicitly marked in the documentation with:
Note: This parameter is available only for requests that include an API key or a client ID.
Currently, this is only for two parameters in reverse geocoding: result_type and location_type.
source
Beginning on June 11, 2018, you’ll need to enable billing with a
credit card and have a valid API key for all projects. This will give
you the ability to scale easily with less downtime and fewer
performance issues. In addition, we’re simplifying our 18 individual
APIs into three products: Maps, Routes, and Places.
Also, in June 2016 we announced that we would stop supporting keyless
usage, meaning any request that doesn’t include an API key or Client
ID. This will go into effect on June 11th, and keyless access will no
longer be supported. At that time, keyless calls to the Maps
JavaScript API and Street View API will return low-resolution maps
watermarked with “for development purposes only.” Keyless calls to any
of the following APIs will return an error: Maps Static API (including
Static Street View), Directions API, Distance Matrix API, Geocoding
API, Geolocation API, Places API, Roads API, and Time Zone API.
To avoid a service interruption to your projects, please visit our Get
Started page to enable a billing account and generate an API key. Once
you generate and secure an API key, make sure to update your
application with the new API key.
I'm working on a project that uses Google Maps APIs to reverse geocoding locations.
The customer is supposed to buy a licensed API key when rolling out to production.
Now I'm developing the application and I also need to test its functionality when using a valid, whether free or business, API key.
Let's pick a sample reverse geolocation request
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true
I have registered a developer account into https://code.google.com/apis/console/ and generated a server API key. Then I enabled Google Geolocation APIs and Google Maps API v3 (I think I need only the second).
When adding &key=XXX parameter to my previous request I get an error that the key is not valid.
Reading documentation with more attention, I discovered that the geolocation service I'm using is actually part of Maps Web Service APIs (Maps V3 APIs run on browser as Javascript). I tried to find those APIs into the Services list of my console but couldn't find anything more.
How do I use Google's reverse geocoding API with a business key for a project that will handle thousands of daily requests?
with no api key, the Google Geocoding API has the following limits in place: 2,500 requests per day.
Google Maps API for Business customers have higher limits: 100,000 requests per day.
to use to API for Business you have to use URL signing, see https://developers.google.com/maps/documentation/business/webservices/auth
NB: If you're switching from the free API services to a Maps API for Business implementation, you must remove the key parameter from your requests. Google Maps API web services will deny requests made with both a client ID and a key.
I'm using Google Maps web services to perform server-side (reverse) geocoding.
I've got a browser-side and server-side Google API key from the Google APIs Console, which permits the Google Maps JS API to use higher request quotas, and enables pay-per-use for overages (successfully tested in-browser via JS). But the server-side key doesn't seem to work on web services requests.
For example, this URL works fine:
http://maps.googleapis.com/maps/api/geocode/json?sensor=true&latlng=43.477329,-80.548601
But if you add a "key=..." parameter, as in the other APIs, I get a REQUEST_DENIED status.
Am I doing something wrong, or is this just not supported on the web services APIs (yet)? Will it be supported in the future?
See also
request_denied when i include key=my_api_key
Nope, you're not doing anything wrong.
Unfortunately, enforcing tight limits on the Google Geocoding API, also called "Server-Side Geocoding", is Google's design. If your app needs more than 2,500 Server-Side Geocodes per day, then you'll need to upgrade to their Google Maps API for Business product.
Hold on, it gets worse.
If your app's server IP address is shared with other apps, that 2,500 request daily limit applies to ALL of them. This includes apps that share the same server IP address as you, but don't belong to you! This can be a common situation with any PaaS, like Google App Engine or Heroku. So, even if your app works flawlessly today, there is no guarantee that it's still going to work tomorrow.
In the article, "Geocoding Strategies", Google indicates the solution is to "almost always" use "Client-Side Geocoding" via the Geocoding Service, part of the Google Maps JavaScript API V3. The primary reason is that limits are enforced per user, per session. Requests like this shouldn't run up against quota limits unless you're executing geocode batches on the client (not a typical use case).
One golden nugget from the "Geocoding Strategies" article: Design a page that takes user input, calls the client-side Geocode service method, then passes that information to your server app where it can be processed, and hopefully cached. This is FAR from ideal, but if upgrading to Google Maps API for Business isn't an option, it might be the only way to go.
Good luck!
According to this post, your API key should work as one of the three option for requests over 25,000 loads per day.
https://developers.google.com/maps/faq#usagelimits
I have an app for which I have extensive use of geocoding, and map plotting. I'd like to make money off it, but not pay the $10k tax since I'm a little guy.
I was thinking about offering the mapping aspects of the app for free, but charge for additional add-ons/features.
Would this be breaking the google licensing?
You can normally use the free Google Maps API if your Maps API implementation is generally accessible to users without charge. You may require users to log in to a section in your website where you would have the Maps API Implementation, but you must not require users to pay a fee. (Google Maps API Terms of Service)
Unless you have entered into a separate written agreement with Google or obtained Google's written permission, your Maps API Implementation must not:
require a fee-based subscription or other fee-based restricted access; or
operate only behind a firewall or only on an internal network (except during the development and testing phase).
In addition you mentioned that your application will use geocoding extensively. Server-side geocoding with the free Maps API has a limit of 15,000 request per IP address per day. (Google Maps API FAQ)
I would suggest getting in touch with Google first, describing your application. They should be able to classify if your application can work within the terms of the free Maps API or not.