Directions API
Introduction
Nextbillion.ai’s Directions API is a service that computes a route between two places. With the Directions API, you can:
- Find the most optimal route and ETAs between the origin and the destination.
- Get directions for different driving modes like car & truck.
- You can also add waypoints, which are coordinates along the route.
- Plan your trips in advance by setting
departure_time
to get best routes and ETAs - Get different routes based on different truck dimensions and weight.
The Directions API has 2 versions to cater to different business needs. First, is the Fast version which would return the route and related information in real time. Second, is the Flexible version which offers truck routing and time-based routing features in addition to those available in the Fast version. We will be talking about both these services below
Also check out NextBillion's Road Editor API for easy manipulation and custom updates to road network data, enhancing the utility of Directions API response in meeting your business needs
Directions Fast API
The Directions Fast API gets the directions in real time for trips starting at current time. The routes returned through this service have the traffic conditions factored in to avoid any delays under usual circumstances.
Directions Fast API service can take input using both HTTPS GET and POST requests. Request URL, parameters and response schema are exactly the same for both methods. However, an important difference between these two input methods is in the maximum number of waypoints
that can be added to the input. We will cover them below.
GET Request
To utilize the Directions API and obtain route information, a GET request is made with the required parameters: key
, origin
, and destination
. To customize the request, additional parameters such as waypoints
, mode
and avoid
can be included based on the user's preferences.
Please note that the maximum number of waypoints
allowed in a GET request is 50.
Request Parameters
Loading..POST Request
The parameters and their properties for the Directions Fast POST version are the same as listed in the Request Parameter section. The key
is passed as a request parameter and the rest of the parameters should be included in the Request Body.
Please note that the maximum number of waypoints
allowed in a POST request is 200.
Response Schema
Loading..Directions Flexible API
The Directions Flexible API offers customizable features for determining routes accurately. It can serve requests for truck specific routing, time based routing, choosing between fastest
and shortest
route types and also offers to return segment-wise speed limits of the route suggested. The traffic conditions are also factored in, to avoid delays under usual circumstances.
To use the Directions Flexible API service please set the option
parameter to flexible
. Please note some request and response parameters available in the Fast version are not available in Flexible version and vice-versa.
The Flexible version also supports both HTTPS GET and POST methods. Request URL, parameters and response schemas are exactly the same for both methods. However, an important difference between these two input methods is in the maximum number of waypoints
that can be added to the input. We will cover them below.
GET Request
To utilize the Directions Flexible API and obtain route information, a GET request is made with the required parameters: key
, origin
, destination
and option
. To customize the request, additional parameters such as waypoints
, mode
and avoid
can be included based on the user's preferences.
Please note that the maximum number of waypoints
allowed in a GET request is 50.
Request Parameters
Loading..POST Request
The parameters and their properties for the Directions Flexible POST version are the same as listed in the Request Parameter section. The key
and option
are passed as query parameters and the rest of the parameters should be included in the Request Body.
Response Schema
Loading..API Query Limits
- Following are the maximum number of
waypoints
allowed in a single request for both Fast and Flexible methods:- 50 when using HTTPS GET
- 200 when using HTTPS POST
- Maximum dimensions allowed for
truck_size
are 5000 cm for length, 5000 cm for width, 1000 cm for height. - Maximum weight allowed for
truck_weight
(including the trailer and shipped goods) is 100,000 kg - NextBillion.ai allows a maximum rate limit of 6000 queries per minute or 100 queries/second for continuous requests.
Note: We can increase the quota if needed, on request. Contact [email protected] for more details.