# ComputeRouteMatrixRequest

- [JSON representation](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#SCHEMA_REPRESENTATION)
- [RouteMatrixOrigin](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin)
  - [JSON representation](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin.SCHEMA_REPRESENTATION)
- [RouteMatrixDestination](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination)
  - [JSON representation](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination.SCHEMA_REPRESENTATION)

ComputeRouteMatrix request message

| JSON representation |
|---|
| ``` { "origins": [ { object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin`) } ], "destinations": [ { object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination`) } ], "travelMode": enum (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode`), "routingPreference": enum (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RoutingPreference`), "departureTime": string } ``` |

| Fields ||
|---|---|
| `origins[]` | ``object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixOrigin`)`` Required. Array of origins, which determines the rows of the response matrix. Several size restrictions apply to the cardinality of origins and destinations: - The number of elements (origins × destinations) must be no greater than 625 in any case. - The number of elements (origins × destinations) must be no greater than 100 if routingPreference is set to `TRAFFIC_AWARE_OPTIMAL`. - The number of waypoints (origins + destinations) specified as `placeId` must be no greater than 50. |
| `destinations[]` | ``object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/ComputeRouteMatrixRequest#RouteMatrixDestination`)`` Required. Array of destinations, which determines the columns of the response matrix. |
| `travelMode` | ``enum (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode`)`` Optional. Specifies the mode of transportation. |
| `routingPreference` | ``enum (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RoutingPreference`)`` Optional. Specifies how to compute the route. The server attempts to use the selected routing preference to compute the route. If the routing preference results in an error or an extra long latency, an error is returned. You can specify this option only when the `travelMode` is `DRIVE` or `TWO_WHEELER`, otherwise the request fails. |
| `departureTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Optional. The departure time. If you don't set this value, this defaults to the time that you made the request. If you set this value to a time that has already occurred, the request fails. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `"2014-10-02T15:01:23Z"` and `"2014-10-02T15:01:23.045123456Z"`. |

## RouteMatrixOrigin

A single origin for ComputeRouteMatrixRequest

| JSON representation |
|---|
| ``` { "waypoint": { object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/Waypoint`) }, "routeModifiers": { object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteModifiers`) } } ``` |

| Fields ||
|---|---|
| `waypoint` | ``object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/Waypoint`)`` Required. Origin waypoint |
| `routeModifiers` | ``object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteModifiers`)`` Optional. Modifiers for every route that takes this as the origin |

## RouteMatrixDestination

A single destination for ComputeRouteMatrixRequest

| JSON representation |
|---|
| ``` { "waypoint": { object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/Waypoint`) } } ``` |

| Fields ||
|---|---|
| `waypoint` | ``object (`https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/Waypoint`)`` Required. Destination waypoint |