API directory · Google Maps Platform
Routes API: traffic-aware routing and route matrix for India
The Routes API is Google's current production routing surface, replacing the legacy Directions and Distance Matrix APIs. It covers Compute Routes for a single origin-to-destination path and Compute Route Matrix for bulk ETA calculation across up to 625 origin-destination pairs. Lepton integrates it for delivery, mobility and logistics teams across India.
Get a demo →What the API does
Traffic-aware routing, two-wheeler mode and bulk ETA in one surface
The Routes API is the GA replacement for the legacy Directions API and Distance Matrix API. Compute Routes calculates an ideal route between an origin and destination with optional waypoints, pass-through points, alternative routes and stopover qualifiers. Compute Route Matrix returns a full distance-and-duration matrix for up to 625 origin-destination element pairs, with streaming for large matrices.
Routing modes include driving, two-wheeler, bicycling, walking and transit. Real-time traffic is available on route polylines. Toll fees are included for select cities. Eco-friendly routing by engine type is supported. Waypoint optimization reorders multi-stop routes to reduce total travel time.
Use cases
Where teams put the Routes API to work
- 01
Last mile · Two-wheeler routing for Indian delivery fleets
Two-wheeler mode applies narrow-roads and flyover logic specific to India, so routes reflect the roads bike riders actually take rather than routes optimized for four-wheelers.
- 02
ETA · Live-traffic ETA for quoted arrival windows
Real-time traffic on route polylines means the ETA your customer sees at booking reflects current congestion, not a static average, reducing missed SLAs and customer complaints.
- 03
Logistics · Multi-stop optimization and bulk route matrix
Waypoint optimization reorders delivery stops to minimize total time. Route Matrix calculates durations and distances across up to 625 origin-destination pairs in a single streaming call, for bulk dispatch and ETA grids.
- 04
Tolls · Toll-cost awareness in routing
For applicable cities, the Routes API returns toll cost alongside the route so dispatch and driver apps can factor toll spend into route selection and cost attribution.
Where Lepton comes in
Mode selection, matrix architecture and migration from legacy APIs
The Routes API is the current surface; Directions and Distance Matrix are the legacy. Teams already on the legacy endpoints need a structured migration. New integrations need mode selection (driving vs two-wheeler vs transit) and matrix sizing matched to the dispatch workload.
Structured move from Directions and Distance Matrix
We run a phased migration from the legacy APIs to the Routes API, including field mapping, quota analysis and parallel-run validation, so existing products migrate without a delivery gap.
GCP setup and SDK wiring
Service accounts, API enablement, billing configuration and Routes API call architecture delivered as a working integration, including two-wheeler mode and the correct traffic model for India.
Matrix sizing and SKU engineering
Route Matrix billing is per element pair. We size the matrix to your dispatch pattern and validate streaming call architecture so cost stays predictable as order volume grows.
Request headers and JSON body
POST https://routes.googleapis.com/directions/v2:computeRoutes
Content-Type: application/json
X-Goog-Api-Key: <your key>
X-Goog-FieldMask: routes.distanceMeters,routes.duration,
routes.polyline.encodedPolyline
{
"origin": {
"location": { "latLng": { "latitude": 12.9784, "longitude": 77.6408 } }
},
"destination": {
"location": { "latLng": { "latitude": 12.9352, "longitude": 77.6245 } }
},
"travelMode": "TWO_WHEELER",
"routingPreference": "TRAFFIC_AWARE",
"computeAlternativeRoutes": false,
"routeModifiers": { "avoidTolls": false, "avoidHighways": false },
"languageCode": "en-IN",
"units": "METRIC"
} Response application/json
{
"routes": [
{
"distanceMeters": 7420,
"duration": "1284s",
"polyline": {
"encodedPolyline": "yjmnAsxwxMR}CjAaGx@_Ef@sCXqBLoFVwM{E?"
}
}
]
} Tell us the routing problem. We will name the right surfaces.
Bring the fleet or delivery use case. We map it to the correct Routes API mode and matrix configuration and walk through the integration.
Get a demo →