Single Route
Calculate route for a sequence of stops
POST
/routing/singleCalculate the route geometry, distance, and duration for a sequence of coordinates. This endpoint returns the optimal driving route through the provided stops in order.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
stops | Coordinates[] | Yes | Ordered sequence of stops |
departure | ISO8601 | No | Departure time for traffic calculation |
Coordinates
| Field | Type | Required | Description |
|---|---|---|---|
lat | number | Yes | Latitude |
lng | number | Yes | Longitude |
Example Response
Response Fields
| Field | Type | Description |
|---|---|---|
geometry | string | Encoded polyline of the route |
distance | number | Total distance in meters |
duration | number | Total duration in seconds |
legs | RouteLeg[] | Per-segment details |
Route Leg
Each leg represents the segment between consecutive stops:
| Field | Type | Description |
|---|---|---|
distance | number | Segment distance in meters |
duration | number | Segment duration in seconds |
Use Cases
- Route Preview: Show the route before committing to a trip
- Manual Route Planning: Calculate routes for custom stop sequences
- ETA Calculation: Get accurate travel times between locations
- Route Comparison: Compare different stop orderings