Truck Routes with Multiple Stops

Products Used: Directions API & Navigation API


NextBillion.ai’s APIs allows you to add multiple stops, called waypoints, on the way to the destination that your truck is heading for. Depending on the type of request, the routing engine will either suggest routes covering all the stops specified or provide a route along with turn-by-turn instructions for easy navigation. Use the waypoints parameter in the routing APIs to add multiple stops for your trip.

Let’s take a look at the following sample request with

  • A pair of origin & destination locations

  • mode option set to truck.

  • waypoints parameter containing coordinates for 3 stops before the destination

Directions API request

1curl --location 'https://api.nextbillion.io/directions/json?key=<your_api_key>&origin=25.84220637,-80.36236245&destination=25.76683324,-80.21609475&mode=truck&waypoints=25.91338203,-80.34023395|25.90554444,-80.25598479|25.84769524,-80.22941337'

Directions API response

1{
2 "status": "Ok",
3 "routes": "[...]",
4}

Observe that all the stops are covered by the route on the way to destination.

In order to navigate easily from one stop to another, user can get turn-by-turn restrictions as well through a Navigation API request:

1curl --location 'https://api.nextbillion.io/navigation/json?key=<your_api_key>&origin=25.84220637,-80.36236245&destination=25.76683324,-80.21609475&mode=truck&waypoints=25.91338203,-80.34023395|25.90554444,-80.25598479|25.84769524,-80.22941337'
1{
2 "status": "Ok",
3 "routes": "[...]",
4}

Visit product documentation (Directions API | Navigation API) to know more about the available features