Stay organized with collections
Save and categorize content based on your preferences.
European Economic Area (EEA) developers
When you are computing a route matrix, you might want to take into consideration
any toll fees on the routes in the matrix. For select cities, you can compute
the estimated toll fee for a route in the appropriate currency.
For the list of supported toll locations, see the reference for
TollPass.
Route matrix toll example
The following example uses the
computeRouteMatrix
method to return toll information on a route with an estimated
price when a toll pass is used:
Set the extraComputations array field to TOLLS to enable the calculation
of toll information.
Specify the vehicle type and the toll pass type by using the
routeModifiers field of the origin waypoints of the request. The toll
price returned is based on the pricing used by the specified vehicle type
and pass. If more than one pass is specified, the least expensive pricing is
returned.
Use the response field mask to configure the method to
return toll information in the response. Specify
routes.travelAdvisory.tollInfo to return information for the entire route.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe Routes API's \u003ccode\u003ecomputeRouteMatrix\u003c/code\u003e method allows you to calculate estimated toll fees for routes in supported cities, providing cost insights for route planning.\u003c/p\u003e\n"],["\u003cp\u003eTo enable toll calculations, specify \u003ccode\u003eTOLLS\u003c/code\u003e in the \u003ccode\u003eextraComputations\u003c/code\u003e field and provide vehicle and toll pass details in the \u003ccode\u003erouteModifiers\u003c/code\u003e field within the request.\u003c/p\u003e\n"],["\u003cp\u003eToll prices are estimates and are influenced by factors like vehicle type and toll pass used, with the response including the estimated price in the specified currency.\u003c/p\u003e\n"],["\u003cp\u003eWhile the Route Matrix provides toll information, detailed route specifics are not included; for that, use the \u003ccode\u003eCompute Routes\u003c/code\u003e functionality with single origin and destination points.\u003c/p\u003e\n"],["\u003cp\u003eBe aware that requests including toll fee calculations are billed at a higher rate than standard route matrix requests.\u003c/p\u003e\n"]]],["To calculate toll fees for a route matrix, set the `extraComputations` field to `TOLLS`. Specify the vehicle type and toll pass using the `routeModifiers` field within the origin waypoints; the lowest-cost toll pass pricing will be applied if multiple passes are set. Use the response field mask with `routes.travelAdvisory.tollInfo` to include toll information, and note that toll fee requests have a higher billing rate. The response then contains `estimatedPrice`.\n"],null,["# Calculate toll fees for a route matrix\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nWhen you are computing a route matrix, you might want to take into consideration\nany toll fees on the routes in the matrix. For select cities, you can compute\nthe estimated toll fee for a route in the appropriate currency.\n\nTo get tolls for a route, see\n[Calculate tolls fees for a route](/maps/documentation/routes/calculate_toll_fees).\n\nFor the list of supported toll locations, see the reference for\n[TollPass](/maps/documentation/routes/reference/rest/v2/RouteModifiers#tollpass).\n| **Caution:** Requests that calculate toll fees are billed at a higher rate. [Learn more about billing](/maps/documentation/routes/usage-and-billing) for the Routes API.\n\nRoute matrix toll example\n-------------------------\n\nThe following example uses the\n[`computeRouteMatrix`](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRouteMatrix)\nmethod to return toll information on a route with an estimated\nprice when a toll pass is used:\n\n- Set the `extraComputations` array field to `TOLLS` to enable the calculation\n of toll information.\n\n- Specify the vehicle type and the toll pass type by using the\n `routeModifiers` field of the *origin* waypoints of the request. The toll\n price returned is based on the pricing used by the specified vehicle type\n and pass. If more than one pass is specified, the least expensive pricing is\n returned.\n\n- Use the [response field mask](/maps/documentation/routes/choose_fields) to configure the method to\n return toll information in the response. Specify\n `routes.travelAdvisory.tollInfo` to return information for the entire route.\n\n| **Note:** Route matrix does not return detailed route information, such as the legs, steps, and polylines of the route. To obtain detailed route information, pass a single origin and single destination to [Compute\n| Routes](/maps/documentation/routes/compute_route_directions).\n\n### Request for a route matrix toll information\n\n```console\ncurl -X POST -d '{\n\"origins\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\":42.340173523716736,\n \"longitude\":-71.05997968330408\n }\n }\n },\n \"routeModifiers\": {\n \"vehicleInfo\":{\n \"emissionType\": \"GASOLINE\"\n },\n \"tollPasses\": [\n \"US_MA_EZPASSMA\",\n \"US_WA_GOOD_TO_GO\"\n ]\n }\n }\n],\n\"destinations\": [\n {\n \"waypoint\": {\n \"location\": {\n \"latLng\": {\n \"latitude\":42.075698891472804,\n \"longitude\": -72.59806562080408\n }\n }\n }\n }\n],\n\"travelMode\": \"DRIVE\",\n\"extraComputations\": [\"TOLLS\"]\n}' \\\n-H 'Content-Type: application/json' \\\n-H 'X-Goog-Api-Key: \u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e' \\\n-H 'X-Goog-FieldMask: originIndex,destinationIndex,travel_advisory.tollInfo,duration,distanceMeters,status' \\\n'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'\n```\n\n### Response for route matrix toll information\n\nThe response contains information on tolls in a\n[TollInfo](/maps/documentation/routes/reference/rest/v2/TollInfo) (REST) or\n[TollInfo](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#tollinfo) (gRPC) object.\n\nTo configure the method to return toll information, use the\n[response field mask](/maps/documentation/routes/choose_fields) to set the `travelAdvisory.tollInfo` field\nin the mask. \n\n```json\n[\n {\n \"originIndex\": 0,\n \"destinationIndex\": 0,\n \"status\": {},\n \"distanceMeters\": 150338,\n \"duration\": \"5382s\",\n \"travelAdvisory\": {\n \"tollInfo\": {\n \"estimatedPrice\": [\n {\n \"currencyCode\": \"USD\",\n \"units\": \"4\",\n \"nanos\": 400000000\n }\n ]\n }\n }\n }\n]\n```"]]