Avoid tolls on the route

Products Used: Directions API & Navigation API


Use the avoid feature in the routing APIs to ensure that your trucks are not taking the roads with tolls on them. This can help save both time and money when traveling to your destination. Depending on the information needed, users can use this feature either in NextBillion.ai’s Directions API to get desired route directions along with ETA and distance information, or they can also use Navigation API to get turn-by-turn navigation instructions as well along with other information about the route.

Following is a sample Directions API request with following parameters:

  • A pair of origin & destination locations

  • mode option set to truck

  • avoid option set to toll

Directions API request

1curl --location 'https://api.nextbillion.io/directions/json?origin=40.75293961,-73.99254045&destination=40.72607894,-74.15828141&mode=truck&key=<your_api_key>&avoid=toll'

Directions API response

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

To verify the impact of the avoid feature, you can create another request without the avoid feature and check the route suggested.

Let’s take a look at how a Navigation API call would look like for the exact same parameters as the above example.

1curl --location 'https://api.nextbillion.io/navigation/json?origin=40.75293961,-73.99254045&destination=40.72607894,-74.15828141&mode=truck&key=<your_api_key>&avoid=toll'

Notice that this API only responds with the turn-by-turn navigation instructions along with ETA and distance information for a route taken while avoiding roads with tolls.

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

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