This product or feature is in Legacy status and cannot be enabled for new usage. For more information about the Legacy stage and how to migrate from Legacy to newer services, see Legacy products and features.
Distance Matrix API requests generate calls to one of two SKUs depending on the type of request:
basic or advanced.
Click the infoinfo
icon to see the table of contents for this page.
This SKU is triggered for each element returned by a request to the Distance Matrix API. Each query sent to the Distance Matrix API generates elements, where the number
of origins times the number of destinations equals the number of elements.
This SKU is triggered for each element returned by a request to the Distance Matrix API. Each query sent to the Distance Matrix API generates elements, where the number
of origins times the number of destinations equals the number of elements.
Traffic information. When you use all of the following request options so that the response returns the duration_in_traffic field in the Distance Matrix response:
Travel mode is driving: Set
travel mode todriving. Driving is the default travel mode.
Departure time is set: Specify a valid
departure_time. You can set departure_time to the current time or some time in the future. It cannot be in the past.
Location modifiers. When you use the following
location
modifiers to indicate how drivers should approach a particular location:
[null,null,["Last updated 2025-03-03 UTC."],[[["The Distance Matrix API is priced on a pay-as-you-go basis, charging per element, which is calculated by multiplying the number of origins by the number of destinations in a request."],["There are two SKUs for billing: Distance Matrix (basic requests) and Distance Matrix Advanced (requests using traffic information or location modifiers), each having its own pricing tier."],["While there is no daily limit on the total number of elements, the API has usage restrictions on the maximum number of origins, destinations, and elements per request, as well as a rate limit of 60,000 elements per minute."],["Users can manage their costs by setting daily quota limits for the Distance Matrix API within the Google Cloud Console, ensuring their application's usage stays within budget."],["You must enable billing on your projects and include an API key or OAuth token for all API requests to utilize the Distance Matrix API."]]],["The Distance Matrix API requires enabled billing and an API key or OAuth token. It uses a pay-as-you-go model, with costs based on SKU usage, either basic or advanced. The advanced SKU includes traffic and location modifiers. Usage limits include maximums of 25 origins/destinations, 100 elements per request, and 60,000 elements per minute. Users can manage costs by setting daily quota limits in the Google Cloud console and utilize the $200 monthly credit until March 1, 2025.\n"]]