TroubleShooting

The 400 error code occurs when there is a malformed API request, which happens if invalid parameters are present in the request. Below are a few examples of some common mistakes that lead to this error across various APIs.

Example

Reverse Geocoding API: We often see unnecessary spaces and characters in the input parameters with the Reverse Geocoding API.

  • Using the "+" value at the beginning of coordinates
  • Space between comma and longitude value in the request
Don'tDos
+17.44432,78.3848917.44432,78.38489
17.44432, 78.3848917.44432,78.38489


Example

Here are some common errors that lead to malformed requests for the Distance Matrix API.

  • Missing latitude value
  • Entering only one coordinate despite using a separator value, which is used to enter multiple coordinates in a single call
  • Missing values in the destination parameter
Don'tDos
origins=,88.36540origins=64.97205,88.36540
destinations=22.54579,88.39797|destinations=22.54579,88.39797|64.97205,88.36540
destinations=destinations=64.97205,88.36540

401 errors are shown when you enter the wrong API key or the key is missing altogether.

With NextBillion.ai’s APIs, the 403 error code appears when the request is trying to access a region which is not enabled for your account. Additionally, this error also occurs when you’re using the wrong mode in the request. Let’s take a look at how this might occur.

Service Requested not enabled for the apikey

This most likely means that you’ve entered location parameters which are outside the allocated geographical boundaries for your account.

Example -

Distance Matrix API: Let’s assume your deployment of our Distance Matrix API is limited to operations within the region of Europe. If any of your requests include locations that are outside of Europe, the 403 error will be displayed.


Wrong mode

This happens when you make a request for an API operation with a disabled mode or vehicle profile. Do note that for all non-premium accounts, only the 4-wheel mode parameter (mode=4w) is enabled by default.

Example -

Directions API: You’re using the free tier of our Directions API and do not have a premium account with us. During one of your trial runs, you want to test the custom vehicle profile feature, so you set the mode to 2-wheelers. In such an instance, you will see the 403 error.


Here’s what a sample API call would look like, with the mode parameter highlighted in bold:

https://api.nextbillion.io/directions/json?key=YOUR_KEY&mode=4w&origin=30.05071977,31.23974991&destination=30.04996229,31.25182636

Alternatively, you can also remove the mode parameter to avoid this error. Removing the mode parameter will make the request use the default ‘mode=4w’ parameter. To enable more vehicle profiles for your account, please contact your NextBillion.ai account manager or sales representative.

Request URI Too Large

A request made with the GET method has a maximum limit on the number of parameters you can add because of the limit on the maximum length of a URL. Normally, our APIs can support upto 100 parameters but this limit depends on the number of significant figures in numbers like co-cordinates. For example 56.677 latitude has just 5 significant figures, while 56.677254 has 8. These can contribute to the limit of URI.

When this limit is exceeded, you will get a 414 Error.


422 errors happen if there is a route failure and a valid route cannot be generated.

Example -

Directions API: You’ve set your origin and destination points both within a highway, and there’s no possible route that can be taken to avoid a toll booth. In such an instance, if you set the instruction to avoid tolls, which cannot be done, you will get a route failure.

429 errors are displayed when you exceed the number of allowed requests for an API. Here are a few examples that illustrate how this error occurs.

Example -

Distance Matrix API: The Distance Matrix API, by default, is limited to a matrix size of 1000x1000 elements. If your request exceeds the configured limit for an API call, you will see a 429 error.


Example -

Snap-to-Road API: Our Snap-to-Road API has a limit of 100 waypoints in GET requests and 200 waypoints in POST requests. If the number of waypoints in a request exceeds these limits, 429 errors are expected.

The 5XX series of errors occurs when there is an issue with our NextBillion.ai servers.

Have Questions ?