GET /v1/directions
Route directions between two points (Google-compatible).
Returns a route between two points as a Google Directions API compatible
response — routes[] → legs[] → steps[] with turn-by-turn instructions and
encoded polylines — so clients built for Google/Goong can switch with minimal
changes.
Required scope: routing:read
When no road route exists, the response still returns a drawable straight-line
estimate with status: "ESTIMATED" (see Fallback).
Request
Query parameters
| Name | Required | Description |
|---|---|---|
origin | yes | Start point as lat,lng (e.g. 21.0285,105.8542). |
destination | yes | End point as lat,lng. |
vehicle | no | Routing profile. Supported: motobike (default). car is planned. Other values return 400. |
Response
Response fields
| Field | Type | Description |
|---|---|---|
status | string | OK (real road route), ESTIMATED (straight-line fallback). |
routes[].overview_polyline.points | string | Encoded polyline (precision 5) of the whole route. |
routes[].bounds | object | Bounding box (northeast/southwest). Omitted on fallback. |
routes[].legs[].distance | object | { text, value } — value in meters. |
routes[].legs[].duration | object | { text, value } — value in seconds. |
routes[].legs[].steps[].html_instructions | string | Turn-by-turn instruction text. |
routes[].legs[].steps[].maneuver | string | Google-style maneuver (turn-left, turn-right, roundabout-right, …). May be absent. |
routes[].legs[].steps[].polyline.points | string | Encoded polyline for this step. |
The encoded polylines use Google's Encoded Polyline Algorithm Format (precision 5) — decode them with any standard Google/Mapbox polyline decoder.
Fallback
If the routing engine can't connect the two points, GoGoDuk returns a straight-line estimate instead of an error, so your map always has a line to draw:
statusis"ESTIMATED".- The leg has a single step whose geometry is the straight line
origin → destination. distanceis the great-circle distance × a road-detour factor;durationis estimated from an average speed.
Render ESTIMATED routes differently (e.g. a dashed line) to signal it is not a
real road route.
Common errors
400 INVALID_PARAMS—origin/destinationnot inlat,lngform.400 INVALID_VEHICLE— unsupportedvehiclevalue.401 INVALID_API_KEY— key not recognized.403 INSUFFICIENT_SCOPE— key is missingrouting:read.429 RATE_LIMIT_MINUTE— back off using theretry_afterfield.503 ROUTING_UNAVAILABLE— routing is temporarily disabled.