LatLong
GET/v4/trips.json

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 →

Authentication

Include your API token in the request header:

X-Authorization-Token: your_token_here

Parameters

NameTypeRequiredDescription
coordinatesstringRequiredSemicolon-separated coordinates (lng,lat;lng,lat;...)
roundtripbooleanOptionalReturn to start point (default: true)

Code Examples

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

Response

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

Ready to try it?

Test this API interactively in the playground.

Open Playground →