The Direction API provides accurate driving directions, driving distance, aerial (straight-line) distance, and a visual path between any two geographical points. Ideal for navigation, logistics planning, delivery route estimation, and travel applications.
Authorization: X-Authorization-Token
(Get your token HERE)/v4/direction
https://apihub.latlong.ai/v4/directions
Parameter | Type | Required | Description |
---|---|---|---|
origin_lat | float | Yes | Latitude of the starting point |
origin_lon | float | Yes | Longitude of the starting point |
dest_lat | float | Yes | Latitude of the destination point |
dest_lon | float | Yes | Longitude of the destination point |
curl --location βhttps://apihub.latlong.ai/v4/directions.json?origin=12.9307248%2C77.5761579&destination=12.9261023%2C77.5686565'
{
"code": 1001,
"status": "success",
"data": {
"origin": "12.9307248,77.5761579",
"destination": "12.9261023,77.5686565",
"time": "0 hours, 7 minutes.",
"distance": "1.95 km",
"aerial_distance": "0.96 km",
"route": [
"start",
"Continue onto Kanakapura Road",
"Make a U-turn onto Kanakapura Road",
"Keep right onto 13th Cross Road",
"Turn right onto 9th Main Road",
"Turn left onto 22nd Cross Road",
"Turn right onto 13th Cross Road",
"Arrive at destination"
],
"geom": [
[
77.576166,
12.930727
],
[
77.576102,
12.930909
],
[
77.576174,
12.930929
],
[
77.576209,
12.930846
],
[
77.576467,
12.930115
],
[
77.576607,
12.929638
],
[
77.576694,
12.929252
],
[
77.576959,
12.927314
],
[
77.577035,
12.926628
],
[
77.577048,
12.926345
],
[
77.577039,
12.925559
],
[
77.576992,
12.924648
],
[
77.576951,
12.924435
],
[
77.576861,
12.924199
],
[
77.576743,
12.924002
],
[
77.576541,
12.923767
],
[
77.576252,
12.923484
],
[
77.574824,
12.923479
],
[
77.572548,
12.92354
],
[
77.571138,
12.92386
],
[
77.570343,
12.924062
],
[
77.570496,
12.924831
],
[
77.56891,
12.925147
],
[
77.568569,
12.925163
],
[
77.568785,
12.926073
]
]
}
}
Building route planners and delivery management dashboards
Estimating delivery or travel times for e-commerce or logistics
Comparing straight-line vs road-based distance for efficiency
Visualizing optimal routes on maps for mobile or web platforms
Status Code | Message | Description |
---|---|---|
400 | Missing required parameters | When query is not provided |
401 | Unauthorized | API key missing or invalid |
500 | Internal Server Error | Something went wrong on our side |