# RoutingSummary

- [JSON representation](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#SCHEMA_REPRESENTATION)
- [Leg](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#Leg)
  - [JSON representation](https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#Leg.SCHEMA_REPRESENTATION)

The duration and distance from the routing origin to a place in the response, and a second leg from that place to the destination, if requested. **Note:** Adding `routingSummaries` in the field mask without also including either the `routingParameters.origin` parameter or the `searchAlongRouteParameters.polyline.encodedPolyline` parameter in the request causes an error.

| JSON representation |
|---|
| ``` { "legs": [ { object (`https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#Leg`) } ], "directionsUri": string } ``` |

| Fields ||
|---|---|
| `legs[]` | ``object (`https://developers.google.com/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#Leg`)`` The legs of the trip. When you calculate travel duration and distance from a set origin, `legs` contains a single leg containing the duration and distance from the origin to the destination. When you do a search along route, `legs` contains two legs: one from the origin to place, and one from the place to the destination. |
| `directionsUri` | `string` A link to show directions on Google Maps using the waypoints from the given routing summary. The route generated by this link is not guaranteed to be the same as the route used to generate the routing summary. The link uses information provided in the request, from fields including `routingParameters` and `searchAlongRouteParameters` when applicable, to generate the directions link. |

## Leg

A leg is a single portion of a journey from one location to another.

| JSON representation |
|---|
| ``` { "duration": string, "distanceMeters": integer } ``` |

| Fields ||
|---|---|
| `duration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` The time it takes to complete this leg of the trip. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `distanceMeters` | `integer` The distance of this leg of the trip. |