**European Economic Area (EEA) developers**

> [!NOTE]
> 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](https://developers.google.com/maps/comms/eea/faq.md.txt).

To request that Compute Routes returns route
tokens for generated routes, follow these steps:

1. Set the following parameters required to return a route token:
   - Set `travelMode` to `DRIVE` or `TWO_WHEELER`.
   - Set `routingPreference` to `TRAFFIC_AWARE` or `TRAFFIC_AWARE_OPTIMAL`.
2. Specify the origin and destination locations. You can specify locations to suit your use case, using the following: latitude longitude coordinates, address strings, navigation point tokens, or place IDs. [See options for
   location
   specification](https://developers.google.com/maps/documentation/routes/specify_location).
3. Check that none of your route waypoints are `Via` waypoints.
4. Specify the `routes.routeToken` field mask to return a route token:

   ```restructuredtext
   X-Goog-FieldMask: routes.routeToken
   ```

> [!NOTE]
> **Note:** Due to dynamic road conditions, routes generated with a given token may differ from the planned route. To minimize the differences, use the token within minutes of token generation.

You can use the route token for your planned route in the Navigation SDK.
For more details, see:

- [Plan a route (Android)](https://developers.google.com/maps/documentation/navigation/android-sdk/customize-route.md.txt#use-token)
- [Plan a route (iOS)](https://developers.google.com/maps/documentation/navigation/ios-sdk/route-customizations.md.txt#use-token)

## Route token example

Here's an example curl request body for a single origin, single-destination
route. It uses field masks to request a route token, along with the route
duration, distance, and route polyline:

```curl
curl -X POST -d
{"origin":{
    "location": {
        "latLng":{
            "latitude":  -37.8167,
            "longitude": 144.9619
        }
    }
},
"destination":{
    "location": {
        "latLng":{
            "latitude":-37.8155,
            "longitude": 144.9663
        }
    }
},
"routingPreference":"TRAFFIC_AWARE",
"travelMode":"DRIVE"
}
-H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H X-Goog-FieldMask: routes.routeToken,routes.duration,routes.distanceMeters,routes.polyline.encodedPolyline
'https://routes.googleapis.com/directions/v2:computeRoutes'
```

For more details, see the
[Compute Routes API reference](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes.md.txt).