Overview
Directions API returns the real road route between two points (or ordered waypoints): distance (meters), estimated duration (seconds), route geometry (polyline or GeoJSON), and optional turn-by-turn steps.Endpoint
Quickstart
Request Parameters
Service options
General options
These options apply to all routing services. Options that take one value per coordinate use the array-like encoding{option}={element};{element}[;...] — the number of elements must match the number of coordinates (except generate_hints and exclude). Pass an empty element to use the default for that coordinate, e.g. bearings=;90,20;.
Examples
- Waypoints (multi-stop)
- Avoid motorways
- GeoJSON geometry
Response
response-example.json
Response fields
Decoding geometry
Decoding geometry
Precision-5 polyline — decodable with any Note the decoded pairs are
polyline library:[lat, lng] — the opposite order of the lng,lat request input.Annotation object
Annotation object
When
annotations is requested, each leg gets an annotation object with arrays aligned to the route geometry coordinates:Coordinates use
lng,lat order, and all coordinates in one request must be in the same country. See Coverage.Errors
Recipes
- Draw a line:
geometries=geojson+ Draw a Route on a Map - Navigation:
steps=true+ Turn-by-Turn Navigation - Multi-stop ordering: route 3+ waypoints in order, or let Fleet Optimization solve the optimal sequence
Related
Distance Matrix
Travel time and distance between many points in one call
Fleet Optimization
VROOM vehicle routing with time windows and capacity
Map Matching
Snap GPS traces to real roads
