Driving Direction API

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.

πŸ”‘ Authentication

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

🌐 Endpoint

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

πŸ“₯ Request Parameters

ParameterTypeRequiredDescription
origin_lat floatYesLatitude of the starting point
origin_lonfloatYesLongitude of the starting point
dest_latfloatYesLatitude of the destination point
dest_lonfloatYesLongitude of the destination point

πŸ“€ Sample Request

curl --location β€˜https://apihub.latlong.ai/v4/directions.json?origin=12.9307248%2C77.5761579&destination=12.9261023%2C77.5686565' 

πŸ“¦ Sample Response

 { 

  "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 

      ] 

    ] 

  } 

}  

🧠 Features

  • πŸš—

    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

⚠️ Errors

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