Trips API

Optimize multi-stop routes for the shortest total travel distance. Solves the Travelling Salesman Problem for delivery and field service routes.

Try in Playground →

Endpoint

GET/v4/trips.json

Authentication

Include your token in the request header:

X-Authorization-Token: your_token

Parameters

NameTypeDescription
coordinatesstringSemicolon-separated coordinates (lng,lat;lng,lat;...)
roundtripbooleanReturn to start point (default: true)

Code Examples

curl "https://apihub.latlong.ai/v4/trips.json?coordinates=VALUE" \
  -H "X-Authorization-Token: YOUR_TOKEN"

Example Response

JSON
{
  "status": "success",
  "code": 1001,
  "data": {
    "total_distance": "14.2 km",
    "total_duration": "38 min",
    "optimized_order": [0, 2, 1, 0],
    "geometry": "encoded_polyline"
  }
}