Route & Navigate
Calculate routes between places. Use the Routing API to get distance, ETA, route geometry, and route legs between two or more points.
What the Routing API returns
Congestion-aware ETAs
Multi-stop routes
Avoidance options
Order of latitude and longitude
By default, pass coordinates as longitude,latitude.
To use latitude,longitude order instead, add lat_first=true.
const params = new URLSearchParams();
params.append('coordinates', '1.3521,103.8198');
params.append('coordinates', '1.2921,103.7767');
params.set('lat_first', 'true');
params.set('profile', 'motorcycle');API reference
Basic routes, multi-stop routes, and transport profiles use the same endpoint and response contract. For client, dependency, and internal error behavior, see API Calls.
/api/v1/routesGet a route between two or more points (coordinates use lng,lat by default).
Parameters
| Parameter | Type | Description |
|---|---|---|
coordinates | string | Repeat per point. Default order: longitude,latitude (e.g. 103.8198,1.3521). Add more pairs for multi-stop routes. Maximum 30 waypoints per request. |
lat_first | boolean | Set to true only if each coordinate pair is latitude,longitude instead. |
profile | string | driving, motorcycle, tricycle, cycling, walking |
overview | string | Use simplified or full to include encoded route geometry; false omits geometry. |
geometries | string | Encoding format for geometry: polyline6 (default, high precision) or polyline. |
avoid | string | Comma-separated: tolls, highways. |
alternatives | integer | Number of alternative routes to return (e.g. 1 or 2). |
Response format
{
"code": "ok",
"waypoints": [
{ "hint": "", "distance": 548.073, "name": "", "location": [1.355168, 103.823657] },
{ "hint": "", "distance": 19.742, "name": "", "location": [1.291924, 103.776677] }
],
"routes": [
{
"distance": 14635.232,
"duration": 1557,
"geometry": "_yuqAqq{_eEcUnJw@LsABiXwC{@Kq@hBwDbL...(encoded polyline6)",
"legs": [
{ "distance": 14635.232, "duration": 1557 }
],
"fee": { "amount": 0, "currency": "" },
"traffic_light": 0
}
]
}Response fields
| Field | Type | Description |
|---|---|---|
code | string | Endpoint-level routing result status.This response field is separate from the HTTP status and GrabMaps error retCode. |
waypoints | array<object> | Input points snapped to the routable network. |
waypoints[].hint | string | Routing hint returned by the service.May be empty. |
waypoints[].distance | number | Distance in meters from the input point to the snapped waypoint. |
waypoints[].name | string | Road or waypoint name when available.May be empty. |
waypoints[].location | array<number> | Snapped waypoint coordinate pair returned by the service.Response order is [latitude, longitude]; request coordinates default to longitude,latitude. |
routes | array<object> | Candidate routes for the requested coordinates. |
routes[].distance | number | Total route distance in meters. |
routes[].duration | number | Estimated route duration in seconds. |
routes[].geometry | string | Encoded route geometry for map rendering.Returned for overview=simplified or overview=full. Encoding is controlled by geometries and defaults to polyline6. |
routes[].legs | array<object> | Route segments between consecutive waypoints. |
routes[].legs[].distance | number | Leg distance in meters. |
routes[].legs[].duration | number | Leg duration in seconds. |
routes[].fee.amount | number | Route fee amount when returned by the routing service. |
routes[].fee.currency | string | Currency code for the route fee.May be empty when no fee applies. |
routes[].traffic_light | number | Traffic-light count along the route. |
Examples
Basic two-point route
Pass two coordinate pairs and a profile. Distances are returned in meters and durations in seconds.
const params = new URLSearchParams();
params.append('coordinates', '103.8198,1.3521');
params.append('coordinates', '103.7767,1.2921');
params.set('profile', 'driving');
params.set('overview', 'full');
const response = await fetch('https://api.maps.grab.com/api/v1/routes?' + params, {
headers: {
'Authorization': 'Bearer <ACCESS_TOKEN>'
}
});
if (!response.ok) {
throw new Error('Request failed with HTTP ' + response.status);
}
const data = await response.json();
const route = data.routes[0];
console.log(route.distance, route.duration, route.geometry, route.legs, data.waypoints);Multi-stop with avoidance
Add more coordinate pairs and use avoid to exclude tolls or highways.
const params = new URLSearchParams();
params.append('coordinates', '103.8198,1.3521');
params.append('coordinates', '103.7767,1.2921');
params.append('coordinates', '103.8454,1.3146');
params.append('coordinates', '103.8000,1.3000');
params.set('profile', 'driving');
params.set('overview', 'full');
params.set('avoid', 'tolls');
const response = await fetch('https://api.maps.grab.com/api/v1/routes?' + params, {
headers: { 'Authorization': 'Bearer <ACCESS_TOKEN>' }
});
if (!response.ok) {
throw new Error('Request failed with HTTP ' + response.status);
}
const data = await response.json();
const route = data.routes[0];
console.log(route.distance, route.duration, route.geometry);Transport profiles
Set profile to driving, motorcycle, tricycle, cycling, or walking.
const params = new URLSearchParams();
params.append('coordinates', '103.8198,1.3521');
params.append('coordinates', '103.7767,1.2921');
params.set('profile', 'cycling');
params.set('overview', 'full');
const response = await fetch('https://api.maps.grab.com/api/v1/routes?' + params, {
headers: { 'Authorization': 'Bearer <ACCESS_TOKEN>' }
});
if (!response.ok) {
throw new Error('Request failed with HTTP ' + response.status);
}
const data = await response.json();
const route = data.routes[0];
console.log(route.distance, route.duration, route.geometry);Previous endpoint paths
The following paths remain supported for backward compatibility. New integrations should use the simplified /api/v1/... paths shown alongside them.
View previous endpoint paths
| Previous path | Recommended path |
|---|---|
/api/v1/maps/eta/v1/direction | /api/v1/routes |
