Calculate toll fees

When you are computing a route or a route matrix, you might want to take into consideration any toll fees on the route. For select cities, you can compute the estimated toll fee for a route in the appropriate currency.

See the list of Supported toll locations below.

How tolls are calculated

The Routes API calculates the estimated toll fee, taking into consideration any toll price discounts or passes available to the driver or vehicle, and the most convenient payment methods. If there is no available toll price for a given route, the Routes API indicates the existence of a toll with an unknown fee.

In order to accurately calculate toll information, the Routes API gives you the option of specifying:

  • The emission type of the vehicle used for the route (VehicleEmissionType). If no emission type is provided, the toll for a gasoline-fueled vehicle is returned.
  • Any toll passes for the driver or vehicle that may apply (TollPass). If no toll passes are specified, the API returns the cash price.
  • avoidTolls as a RouteModifier to avoid toll roads.

Calculating tolls when using a toll pass

In some regions, a driver or vehicle with a toll pass pays a different toll than those who do not have a pass. For example, if you have a Good To Go! toll pass in Seattle, WA, US, you pay a lower toll than if you don't have a pass.

Some regions, such as Indonesia, have roads that require a toll pass. If a toll pass is not specified for a route where a toll pass is required, no price is returned.

If you specify a toll as part of the request, the API tries to return the pass price:

  • If you specify an invalid toll pass, the pass is ignored.

  • You can specify multiple toll passes as an array. The API attempts to calculate the pass price for the route for each pass.

Calculate toll fees for a route

The following example uses the computeRoutes method to return toll information with an estimated price when a toll pass is used. In this example, you:

  • 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 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. In this example, the request included the following properties in the response field mask:

    • routes.travelAdvisory.tollInfo field to return information for the entire route.

    • routes.legs.travelAdvisory.tollInfo to return information for each leg.

Request for toll information

curl -X POST -d '{
  "origin":{
    "location":{
      "latLng":{
        "latitude":42.340173523716736,
        "longitude":-71.05997968330408
      }
    }
  },
  "destination":{
    "location":{
      "latLng":{
        "latitude":42.075698891472804,
        "longitude": -72.59806562080408
      }
    }
  },
  "travelMode": "DRIVE",
  "extraComputations": ["TOLLS"],
  "routeModifiers":{
    "vehicleInfo":{
      "emissionType": "GASOLINE"
    },
    "tollPasses": [
      "US_MA_EZPASSMA",
      "US_WA_GOOD_TO_GO"
    ]
  }
}' \
-H 'Content-Type: application/json' \
-H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.travelAdvisory.tollInfo,routes.legs.travelAdvisory.tollInfo' \
'https://routes.googleapis.com/directions/v2:computeRoutes'

Response containing toll information

The response contains information on tolls in a TollInfo (REST) or TollInfo (gRPC) object. In this example, you return toll information for the entire route and for each leg of the route.

{
  "routes": [
    {
      "legs": [
        {
          "travelAdvisory": {
            "tollInfo": {
              "estimatedPrice": [
                {
                  "currencyCode": "USD",
                  "units": "4",
                  "nanos": 400000000
                }
              ]
            }
          }
        }
      ],
      "distanceMeters": 150338,
      "duration": "6650s",
      "travelAdvisory": {
        "tollInfo": {
          "estimatedPrice": [
            {
              "currencyCode": "USD",
              "units": "4",
              "nanos": 400000000
            }
          ]
        }
      }
    }
  ]
}

Calculate toll fees for a route matrix

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.

Request for a route matrix toll information

curl -X POST -d '{
"origins": [
  {
    "waypoint": {
      "location": {
        "latLng": {
          "latitude":42.340173523716736,
          "longitude":-71.05997968330408
        }
      }
    },
    "routeModifiers": {
      "vehicleInfo":{
        "emissionType": "GASOLINE"
      },
      "tollPasses": [
        "US_MA_EZPASSMA",
        "US_WA_GOOD_TO_GO"
      ]
    }
  }
],
"destinations": [
  {
    "waypoint": {
      "location": {
        "latLng": {
          "latitude":42.075698891472804,
          "longitude": -72.59806562080408
        }
      }
    }
  }
],
"travelMode": "DRIVE",
"extraComputations": ["TOLLS"]
}' \
-H 'Content-Type: application/json' \
-H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: originIndex,destinationIndex,travel_advisory.tollInfo,duration,distanceMeters,status' \
'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'

Response for route matrix toll information

The response contains information on tolls in a TollInfo (REST) or TollInfo (gRPC) object.

To configure the method to return toll information, use the response field mask to set the travelAdvisory.tollInfo field in the mask.

[
  {
    "originIndex": 0,
    "destinationIndex": 0,
    "status": {},
    "distanceMeters": 150338,
    "duration": "5382s",
    "travelAdvisory": {
      "tollInfo": {
        "estimatedPrice": [
          {
            "currencyCode": "USD",
            "units": "4",
            "nanos": 400000000
           }
        ]
      }
    }
  }
]

Supported toll locations

Toll information is currently available for the following locations:

Region CodeCountry/RegionState/City/Toll Road
AR Argentina Buenos Aires
AU Australia Brisbane
AU Australia Sydney
BR Brazil Countrywide
ID Indonesia Countrywide
IN India Countrywide
MX Mexico Mexico City
US United States Alabama
US United States Alaska
US United States California
US United States Colorado
US United States Delaware
US United States Florida
US United States Illinois
US United States Iowa
US United States Indiana
US United States Kansas
US United States Louisiana
US United States Maine
US United States Maryland
US United States Massachusetts
US United States Michigan
US United States Minnesota
US United States Missouri
US United States New Hampshire
US United States New Jersey
US United States New York
US United States North Carolina
US United States Ohio
US United States Pennsylvania
US United States Rhode Island
US United States South Carolina
US United States Texas
US United States Utah
US United States Virginia
US United States Washington
US United States West Virginia

This information will be updated as more toll data becomes available.