**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).

By default, the API treats intermediate waypoints as stops along a route.
However, you can configure an intermediate waypoint as a pass-through `via`
waypoint that the vehicle passes through without stopping.

Use pass-through waypoints to shape or adjust a specific route. Rather
than splitting the route into separate pickup or drop-off stops, a pass-through
waypoint forces the routing engine to pass through a specific location on the
way to the destination---for example, to follow a preferred road segment or avoid
a known hazard.

A route containing an origin, one or more pass-through intermediate waypoints,
and a destination contains only **one route leg** that connects the origin
directly to the destination.

To configure an intermediate waypoint as a pass-through waypoint, set the
`via` property of the waypoint to `true` in either the REST
[Waypoint](https://developers.google.com/maps/documentation/routes/reference/rest/v2/Waypoint.md.txt) resource or the gRPC
[Waypoint](https://developers.google.com/maps/documentation/routes/reference/rpc/google.maps.routing.v2.md.txt#waypoint) message.

While the Routes API accepts addresses, Place IDs, and latitude and longitude
coordinates, **latitude and longitude, or `latLng`, coordinates provide the
most precise route adjustments** for pass-through waypoints.

The `via` property is most effective when you create routes in response to
dragging waypoints on a map. This approach lets you see how the final route
looks in real time and helps you place waypoints in accessible locations.

## Example: Set a pass-through waypoint

The following example demonstrates how to set `"via": true` on an intermediate
waypoint in a complete `computeRoutes` POST request:

```json
curl -X POST -d '{
  "origin":{
    "location":{
      "latLng":{
        "latitude": 37.419734,
        "longitude": -122.0827784
      }
    }
  },
  "destination":{
    "location":{
      "latLng":{
        "latitude": 37.417670,
        "longitude": -122.079595
      }
    }
  },
  "intermediates": [
    {
      "location":{
        "latLng":{
          "latitude": 37.419734,
          "longitude": -122.0807784
        }
      },
      "via": true
    }
  ],
  "travelMode": "DRIVE"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.legs' \
'https://routes.googleapis.com/directions/v2:computeRoutes'
```

## Using addresses or Place IDs for pass-through waypoints

While we recommend latitude and longitude coordinates for precise
pass-through routing, you can also specify intermediate waypoints using an
address string or a Place ID.

When you use an address or Place ID for a pass-through waypoint, the API
interpolates and snaps the location to the nearest navigable road. This
road-snapping process can sometimes result in route variations or inaccuracies
compared to exact coordinates.

If you specify a waypoint using an **address string** or **Plus Code** , the API
geocodes the location and returns the matching Place ID in the
[`geocodingResults.intermediates`](https://developers.google.com/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes.md.txt#geocodingresults)
array in the response.

> [!NOTE]
> **Note:** The `geocodingResults` array omits waypoints that use latitude and longitude coordinates or existing Place IDs because they don't require geocoding.

For each element in the `intermediates` array, use the
`intermediateWaypointRequestIndex` property to determine which intermediate
waypoint in the request corresponds to the Place ID in the response.

### Example: Request Place IDs for pass-through waypoints

The following example shows a request with three pass-through intermediate
waypoints, each of which specifies `"via": true`:

```json
curl -X POST -d '{
  "origin":{
    "address": "1600 Amphitheatre Parkway, Mountain View, CA"
  },
  "destination":{
    "address": "24 Willie Mays Plaza, San Francisco, CA 94107"
  },
  "intermediates": [
    {
      "address": "450 Serra Mall, Stanford, CA 94305, USA",
      "via": true
    },
    {
      "location":{
        "latLng":{
          "latitude": 37.419734,
          "longitude": -122.0807784
        }
      },
      "via": true
    },
    {
      "address": "1836 El Camino Real, Redwood City, CA 94063",
      "via": true
    }
  ],
  "travelMode": "DRIVE"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.legs,geocodingResults' \
'https://routes.googleapis.com/directions/v2:computeRoutes'
```

The response includes the `geocodingResults` array containing the Place IDs for
the origin, destination, and the two intermediate waypoints that you specified
by address at request index 0 and index 2. The API omits the intermediate
waypoint at index 1 from `geocodingResults` because you specified it using
latitude and longitude coordinates:

```json
{
  "routes": [
    {
      "distanceMeters": 54200,
      "duration": "2400s",
      "legs": [
        {
          "distanceMeters": 54200,
          "duration": "2400s",
          "startLocation": {
            "latLng": {
              "latitude": 37.4220,
              "longitude": -122.0841
            }
          },
          "endLocation": {
            "latLng": {
              "latitude": 37.7786,
              "longitude": -122.3893
            }
          }
        }
      ]
    }
  ],
  "geocodingResults": {
    "origin": {
      "geocoderStatus": {},
      "type": [
        "premise"
      ],
      "placeId": "ChIJj38IfwK6j4ARNcyPDnEGa9g"
    },
    "destination": {
      "geocoderStatus": {},
      "type": [
        "premise"
      ],
      "placeId": "ChIJI7ES6tl_j4ARVpDZoXbWAiY"
    },
    "intermediates": [
      {
        "geocoderStatus": {},
        "intermediateWaypointRequestIndex": 0,
        "type": [
          "street_address"
        ],
        "placeId": "ChIJvdLMGyq7j4ARScE5tWX_C0Y"
      },
      {
        "geocoderStatus": {},
        "intermediateWaypointRequestIndex": 2,
        "type": [
          "premise"
        ],
        "placeId": "ChIJkTc0GKajj4AR9UMsOSHwGD0"
      }
    ]
  }
}
```