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

Routes account for live road conditions in Singapore, Manila, Kuala Lumpur, and Jakarta.

Multi-stop routes

Add more than two coordinate pairs for multi-stop routes. Up to 30 waypoints per request are supported.

Avoidance options

Exclude tolls or highways using the avoid parameter. Request alternate routes with alternatives.

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

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.

GET/api/v1/routes

Get a route between two or more points (coordinates use lng,lat by default).

Parameters

ParameterTypeDescription
coordinatesstringRepeat 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_firstbooleanSet to true only if each coordinate pair is latitude,longitude instead.
profilestringdriving, motorcycle, tricycle, cycling, walking
overviewstringUse simplified or full to include encoded route geometry; false omits geometry.
geometriesstringEncoding format for geometry: polyline6 (default, high precision) or polyline.
avoidstringComma-separated: tolls, highways.
alternativesintegerNumber 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

FieldTypeDescription
codestringEndpoint-level routing result status.This response field is separate from the HTTP status and GrabMaps error retCode.
waypointsarray<object>Input points snapped to the routable network.
waypoints[].hintstringRouting hint returned by the service.May be empty.
waypoints[].distancenumberDistance in meters from the input point to the snapped waypoint.
waypoints[].namestringRoad or waypoint name when available.May be empty.
waypoints[].locationarray<number>Snapped waypoint coordinate pair returned by the service.Response order is [latitude, longitude]; request coordinates default to longitude,latitude.
routesarray<object>Candidate routes for the requested coordinates.
routes[].distancenumberTotal route distance in meters.
routes[].durationnumberEstimated route duration in seconds.
routes[].geometrystringEncoded route geometry for map rendering.Returned for overview=simplified or overview=full. Encoding is controlled by geometries and defaults to polyline6.
routes[].legsarray<object>Route segments between consecutive waypoints.
routes[].legs[].distancenumberLeg distance in meters.
routes[].legs[].durationnumberLeg duration in seconds.
routes[].fee.amountnumberRoute fee amount when returned by the routing service.
routes[].fee.currencystringCurrency code for the route fee.May be empty when no fee applies.
routes[].traffic_lightnumberTraffic-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 pathRecommended path
/api/v1/maps/eta/v1/direction/api/v1/routes

Was this page helpful?