The Trips API returns the shortest and most efficient travel path between multiple geographic points. It intelligently determines the optimal order in which a user should visit the locations to save time and distance, making it highly valuable for logistics, field service, and multi-stop planning. The API also supports round trips, where the route returns to the starting point.
Authorization: X-Authorization-Token
(Get your token HERE)/v4/trips
https://apihub.latlong.ai/v4/trips
Parameter | Type | Required | Description |
---|---|---|---|
points | array | Yes | Array of coordinates: { "latitude": float, "longitude": float } |
round_trip | boolean | No | If true, route will return to the starting point |
curl --location ‘https://apihub.latlong.ai/v4/trips.json?path=12.888879069377102%2C77.55185397587415%7C12.896155017335511%2C77.57020279856766%7C12.88873290392621%2C77.56269163221032%7C12.88602478073188%2C77.55651807082072&round_trip=false'
{
"code": 1001,
"status": "success",
"data": {
"path": [
{
"coordinates": "12.888879069377102,77.55185397587415",
"trips": 1
},
{
"coordinates": "12.896155017335511,77.57020279856766",
"trips": 2
},
{
"coordinates": "12.88873290392621,77.56269163221032",
"trips": 3
},
{
"coordinates": "12.88602478073188,77.55651807082072",
"trips": 4
}
]
}
}
Field | Description |
---|---|
optimized_order | Indexes representing the best order to visit points |
optimized_path | List of points rearranged in the optimized travel sequence |
total_distance_km | Total estimated distance in kilometers |
total_time_minutes | Estimated travel time in minutes |
message | Status or summary message |
Delivery Optimization: Arrange multiple deliveries with the least travel time
Field Visits: Help field staff choose the best visit sequence
Travel Planning: Smart itinerary planning for tourists and agents
Round Trip Planning: Return to origin after covering all stops efficiently
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 |