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.

Changes

Changed in 3 of the 15 revisions of this API.4833

  • 7ee76f0ff6791611See the full diff
    • for the query request parameter approaches, default value was changed from unrestricted to unrestricted

      request-parameter-default-value-changed

    • for the query request parameter destination, default value was changed from last to last

      request-parameter-default-value-changed

    • for the query request parameter geometries, default value was changed from polyline6 to polyline6

      request-parameter-default-value-changed

    • for the query request parameter mode, default value was changed from car to car

      request-parameter-default-value-changed

    • for the query request parameter source, default value was changed from first to first

      request-parameter-default-value-changed

    • removed the enum value any from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value any from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value car from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value curb from the query request parameter approaches

      request-parameter-enum-value-removed

    • removed the enum value first from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value geojson from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value last from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value polyline6 from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value polyline from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value truck from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value unrestricted from the query request parameter approaches

      request-parameter-enum-value-removed

    • added the new enum value any to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value any to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value car to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value curb to the query request parameter approaches

      request-parameter-enum-value-added

    • added the new enum value first to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value geojson to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value last to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value polyline to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value polyline6 to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value truck to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value unrestricted to the query request parameter approaches

      request-parameter-enum-value-added

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • a800b73f11c11611See the full diff
    • for the query request parameter approaches, default value was changed from unrestricted to unrestricted

      request-parameter-default-value-changed

    • for the query request parameter destination, default value was changed from last to last

      request-parameter-default-value-changed

    • for the query request parameter geometries, default value was changed from polyline6 to polyline6

      request-parameter-default-value-changed

    • for the query request parameter mode, default value was changed from car to car

      request-parameter-default-value-changed

    • for the query request parameter source, default value was changed from first to first

      request-parameter-default-value-changed

    • removed the enum value any from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value any from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value car from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value curb from the query request parameter approaches

      request-parameter-enum-value-removed

    • removed the enum value first from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value geojson from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value last from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value polyline from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value polyline6 from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value truck from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value unrestricted from the query request parameter approaches

      request-parameter-enum-value-removed

    • added the new enum value any to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value any to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value car to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value curb to the query request parameter approaches

      request-parameter-enum-value-added

    • added the new enum value first to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value geojson to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value last to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value polyline6 to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value polyline to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value truck to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value unrestricted to the query request parameter approaches

      request-parameter-enum-value-added

  • b79d96775b131611See the full diff
    • for the query request parameter approaches, default value was changed from unrestricted to unrestricted

      request-parameter-default-value-changed

    • for the query request parameter destination, default value was changed from last to last

      request-parameter-default-value-changed

    • for the query request parameter geometries, default value was changed from polyline6 to polyline6

      request-parameter-default-value-changed

    • for the query request parameter mode, default value was changed from car to car

      request-parameter-default-value-changed

    • for the query request parameter source, default value was changed from first to first

      request-parameter-default-value-changed

    • removed the enum value any from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value any from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value car from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value curb from the query request parameter approaches

      request-parameter-enum-value-removed

    • removed the enum value first from the query request parameter source

      request-parameter-enum-value-removed

    • removed the enum value geojson from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value last from the query request parameter destination

      request-parameter-enum-value-removed

    • removed the enum value polyline6 from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value polyline from the query request parameter geometries

      request-parameter-enum-value-removed

    • removed the enum value truck from the query request parameter mode

      request-parameter-enum-value-removed

    • removed the enum value unrestricted from the query request parameter approaches

      request-parameter-enum-value-removed

    • added the new enum value any to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value any to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value car to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value curb to the query request parameter approaches

      request-parameter-enum-value-added

    • added the new enum value first to the query request parameter source

      request-parameter-enum-value-added

    • added the new enum value geojson to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value last to the query request parameter destination

      request-parameter-enum-value-added

    • added the new enum value polyline to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value polyline6 to the query request parameter geometries

      request-parameter-enum-value-added

    • added the new enum value truck to the query request parameter mode

      request-parameter-enum-value-added

    • added the new enum value unrestricted to the query request parameter approaches

      request-parameter-enum-value-added