• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

Optimization API

A newer version of Route Optimization API is available.
A newer version of the API is available and is recommended for all users. Learn about the latest optimization features at Route Optimization Flexible API

Introduction

Nextbillion.ai Optimization API computes and returns an optimized route between an origin and destination which have multiple stop points in between. With NextBillion.ai's Route Optimization API you get.

  • Optimized routing between way points

  • Highly accurate ETAs with customized routes

  • Roundtrip optimization with customized destinations

A list of all parameters is specified in the next section.

Parameters

Loading..

Response Schema

Loading..

Query Limits

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.

Examples

Sample API Request

1{{base_url}}/optimization/json?coordinates=41.35544869444527,2.0747669962025292|41.37498154684205,2.103705 4530396886|41.38772862000152,2.1311887061315526&destination=last&key={{api_key}}&mode=4w&source=first& roundtrip=false&with_geometry=true

For the above example, here are the parameters we have used-

  • We have set 3 coordinates separated by pipe symbol.

  • We have set the destination property equal to last. This means that the last coordinate in our given list will be treated as the destination.

  • The source property is set to first, so the first coordinate pair in the coordinates object will be treated as the source.

  • We have set mode as 4w which will return a route pertaining to 4 wheelers only.

  • The roundtrip property is set to false, so there will be no roundtrip returned.

  • By setting the with_geometry property as true, we will ensure that the route geometry is returned for each leg of the journey.

Sample API Response

1{
2 "code": "Ok",
3 "waypoints": [
4 {
5 "name": "",
6 "location": {
7 "latitude": 41.35544869444527,
8 "longitude": 2.0747669962025292
9 },
10 "trips_index": 0,
11 "waypoint_index": 0
12 },
13 {
14 "name": "",
15 "location": {
16 "latitude": 41.37498154684205,
17 "longitude": 2.1037054530396886
18 },

API Error Codes

Response CodeDescriptionAdditional Notes
200Normal success case.
Normal success case.
400Input validation failed.
Such as missing parameter or parameter with invalid value type (for example value cannot be parsed into number).
401APIKEY not supplied or invalid.
This 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 resources.
You 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 found.
This error occurs when there is a malformed host name used.
422Could not process the request.
There is an underlying map issue which prevents the processing of the request.
429Too many requests.
QPM 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.