Trips API

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.

🔑 Authentication

  • All requests must include your API key.
  • Header Example:
  • Authorization: X-Authorization-Token (Get your token HERE)

🌐 Endpoint

  • GET /v4/trips
  • Base URL: https://apihub.latlong.ai/v4/trips

📥 Request Parameters

ParameterTypeRequiredDescription
pointsarrayYesArray of coordinates: { "latitude": float, "longitude": float }
round_tripbooleanNoIf true, route will return to the starting point

📤 Sample Request


    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' 

📦 Sample Response

{ 

  "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 

      } 

    ] 

  } 

}  

📊 Response Fields

FieldDescription
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

🧠 Features

  • 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

⚠️ Errors

Status CodeMessageDescription
400Missing required parametersWhen query is not provided
401UnauthorizedAPI key missing or invalid
500Internal Server ErrorSomething went wrong on our side