v15

latestOpenAPI 3.1.02026-07-1295183803.5 KB
Routing

Optimization

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.

get/optimization/json

Query parameters

coordinatesstring latitude,longitude required
Example:coordinates=41.35544869444527,2.0747669962025292|41.37498154684205,2.103705 4530396886|41.38772862000152,2.1311887061315526

This is a pipe-separated list of coordinates.

Minimum 3 pairs of coordinates and Maximum 12 pairs of coordinates are allowed.

destination'any' | 'last'

Specify the destination coordinate of the returned route. If the input is last, the last coordinate will be the destination.

geometries'polyline' | 'polyline6' | 'geojson'
Example:geometries=polyline

Sets the output format of the route geometry in the response.

On providing polyline and polyline6 as input, respective encoded geometry is returned. However, when geojson is provided as the input value, polyline encoded geometry is returned in the response along with a geojson details of the route.

keystring 32 character alphanumeric string required
Example:key=API_KEY

A key is a unique identifier that is required to authenticate a request to the API.

mode'car' | 'truck'
Example:mode=car

Set which driving mode the service should use to determine a route. For example, if you use "car", the API will return a route that a car can take. Using "truck" will return a route a truck can use, taking into account appropriate truck routing restrictions.

When "mode=truck", following are the default dimensions that are used:

- truck_height = 214 centimeters

- truck_width = 183 centimeters

- truck_length = 519 centimeters

- truck_weight = 5000 kg

Please use the Directions Flexible version if you want to use custom truck dimensions.

Note: Only the "car" profile is enabled by default. Please note that customized profiles (including "truck") might not be available for all regions. Please contact your NextBillion.ai account manager, sales representative or reach out at support@nextbillion.ai in case you need additional profiles.

roundtripboolean

Indicates whether the returned route is a roundtrip.

source'any' | 'first'

The coordinate at which to start the returned route. If this is not configured, the return route’s destination will be the first coordinate.

with_geometryboolean

Indicates whether the return geometry should be computed or not.

approaches'unrestricted' | 'curb' approaches_1;approaches_2;....
Example:approaches=unrestricted;;curb

A semicolon-separated list indicating the side of the road from which to approach waypoints in a requested route. If provided, the number of approaches must be the same as the number of coordinates. However, you can skip a coordinate and show its position in the list with the ; separator.

Response

codestring

A string indicating the state of the response. This is a separate code than the HTTP status code. On normal valid responses, the value will be Ok.