Important: The Google Maps Platform Premium Plan is no longer available for sign up or new customers.
Overview
If your application exceeds the usage limits for a Google Maps Platform web service, the service returns an error message. If your application continues to exceed the usage limits, it might be blocked from accessing the web service and, in some cases, receive "403 Forbidden" responses.
If your application’s web service requests receive error messages, you can lower usage by optimizing applications to use the web services more efficiently.
Before you begin
Before optimizing your application’s web service usage, check that you’re using the correct service for your use case and the correct Maps APIs license.
Validate your use case
Google Maps Platform web services are best for applications that don't require real-time input from users or when a web browser is not used. For example, you should use web services if your application uses a dataset that is independent of user input—for example, a fixed set of addresses on a real estate website that needs to be geocoded.
Note that with web services, the queries-per-minute (QPM) limit applies to your Premium Plan license, regardless of how many IP addresses requests are sent from.
On the other hand, the client-side services available with the Maps JavaScript API are rate limited per browser session, so that requests are distributed across all your users and scale as the number of users grows. Therefore, client-side services are best for applications that geocode address input from users in real time, such as a store locator that searches for stores near a user’s home address.
For a more detailed discussion on when to use web services, see Geocoding Strategies. Although specific to geocoding, the recommendations in this document apply to all web services, explaining when you should use server-side web services or their client-side equivalents.
How to optimize web service usage
To use web services more efficiently, you can lower usage by sending requests only when necessary and spreading usage evenly to keep it under the limits.
Cache results
Sections 3.2.3.a and b of the Google Maps Platform Terms of Service states that you must not pre-fetch, index, store, or cache any Content except under the limited conditions stated in the Terms.
Note that the place ID, used to uniquely identify a place, is exempt from the caching restriction. You can therefore store place ID values indefinitely.
Throttle requests
To avoid exceeding usage limits, you can configure your application to throttle requests, by placing them in a queue that keeps track of when the requests are sent. If your application receives one additional request beyond the QPM limit, adjust the pace of your queries. In your code, add a waiting period of **`S`** seconds between queries. If the query still results in a quota error, double the waiting period and then send another query. Continue adjusting the waiting period until the query returns without an error.
Even with throttling, applications might still receive responses with the status code
OVER_QUERY_LIMIT
. Configure your application to insert a small delay (20 ms)
and try again if it receives such response.