Batch Routing API

Introduction

NextBillion.ai Batch Routing API is designed to support multiple requests in a single go. Users first need to submit a valid batch of multiple routing requests and retrieve the result asynchronously. Currently, this method accepts only Isochrone API requests.

Let’s take a look at the available methods to create batch requests and retrieve their results.

Create a Batch request

The Batch Routing service allows users to submit a valid batch of routing requests using the HTTP POST method. The individual queries in a batch can be formed using the attributes supported by the standard routing endpoints. The limitations and validations applicable for individual queries in a batch are consistent with those for standard routing endpoints. Know more about these limitations by visiting the individual endpoint documentation which is being added in a batch routing request.

POST

https://api.nextbillion.io/batch?key={your_api_key}

Request Parameters

Loading..

Request Body

Loading..

Response Schema

Loading..

Sample Request

1
curl --location 'https://api.nextbillion.io/batch?key=<your_api_key>' \
2
--header 'Content-Type: application/json' \
3
--data '{
4
"requests": [
5
{
6
"query": "/isochrone/json?mode=4w&coordinates=38.517410585895064,-121.48676022290115&denoise=1&contours_minutes=3&key=<your_api_key>"
7
},
8
{
9
"query": "/isochrone/json?mode=4w&coordinates=37.71775363,-122.20668736&denoise=1&contours_minutes=2&key=<your_api_key>"
10
}
11
12
]
13
}'

Sample Response

1
{
2
"status": "pending",
3
"track_id": "1f41eb60-334b-4f9c-ba8c-0d9ed59d2790"
4
}

Retrieve a Batch result

In order to retrieve the result of a previously submitted batch routing request, users can submit a GET request to the following endpoint while specifying the track_id generated once the batch was successfully created.

GET

https://api.nextbillion.io/batch?track_id={track_id}&key={your_api_key}

Request Parameters

Loading..

Response Schema

Loading..

Sample Request

1
curl --location 'https://api.nextbillion.io/batch?track_id=1f41eb60-334b-4f9c-ba8c-0d9ed59d2790&key=<your_api_key>'

Sample Response

1
{
2
"status": "success",
3
"track_id": "1f41eb60-334b-4f9c-ba8c-0d9ed59d2790",
4
"responses":[...]
5
}

API Query Limits

  1. Only the Isochrone API requests can be added as individual queries in a batch, for now.
  2. The maximum number of individual queries that can be added to a single batch are limited to 20.
  3. 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.

API Error Codes

Response codeDescriptionAdditional notes
200Normal success case.Normal success case.
400Input validation failed.There is a missing or an invalid parameter or a parameter with an invalid value type is added to the request.
401APIKEY not supplied or invalidThis error occurs when the wrong API key is passed in the request or the key is missing altogether.
403APIKEY is valid but does not have access to requested resourcesYou might be querying for a geographical region which is not valid for your account or requesting a service which is not enabled for you.
404Requested host/path not foundThis error occurs when a malformed hostname is used.
422Could not process the requestA feasible solution could not be generated for the given set of locations or parameter configuration.
429Too many requestsQPM reached or API request count quota reached.
500Internal Service error.There was an internal issue with NextBillion.ai services. You can reach out to [email protected] for an explanation.

© 2024 NextBillion.ai all rights reserved.