Route Api

The Route Flexible API provides customizable routing with features like truck routing, time-based paths, and traffic-aware routes. It supports both GET and POST methods, with differences in waypoint limits.

get/v1/direction/location

Request

  • Base URL: https://api.cloud.precisely.com
  • URL: https://api.cloud.precisely.com/v1/direction/location
  • Auth: one of:
    • HTTP bearer
    • API key in header Authorization

Query parameters

coordOrder'LatLon' | 'LonLat'

Specifies the order of coordinates in the request. Use 'LonLat' when providing coordinates in Longitude,Latitude order (X,Y). If not specified or set to 'LatLon', coordinates are expected in Latitude,Longitude order. This parameter applies to 'origin', 'destination', and 'waypoints' parameters. Default: LatLon. Example: LatLon

originAddressstring

The origin address of the location from where you want to start your route. Example: POINT REYES STATION CA

originCountrystring

Origin country name used only when the starting location is provided as originAddress. Example: USA

destinationAddressstring

The destination address of the location to where you want to end your route. Example: Lagunitas CA

destinationCountrystring

Destination Country name used only when the destination location is provided as destinationAddress. Example: USA

originstring

origin is the starting point of your route. Ensure that the origin is a routable land location.

destinationstring

destination is the ending coordinates of your route. Ensure that the destination is a routable land location..

waypointsstring

waypoints are coordinates along the route between the origin and destination. It is a comma-separated list of coordinate pairs. Please note that the route returned will arrive at the waypoints in the sequence they are provided in the input request. The maximum number of waypoints that can be added in a single request is 50.

mode'car' | 'truck'

Set which driving mode the service should use to determine a route; for example, using car returns a route suitable for cars, while truck returns a truck-appropriate route considering routing restrictions, with default truck dimensions of height 214 cm, width 183 cm, length 519 cm, and weight 5000 kg—custom dimensions can be set using truck_weight and truck_size parameters, but note that only the car profile is enabled by default and custom profiles like truck may not be available in all regions.

geometry'polyline' | 'polyline6' | 'geojson'

Sets the output format of the route geometry in the response. On providing polyline and polyline6 as input, respective encoded geometry is returned.Default: polyline6.

avoid'toll' | 'highway' | 'ferry' | 'sharp_turn' | 'uturn' | 'service_road' | 'left_turn' | 'right_turn' | 'bbox' | 'geofence_id' | 'tunnel' | 'none'

Set this parameter to avoid specific route objects using a pipe comma separator for multiple values; this acts as a flexible filter (effective only with route_type=fastest) and still returns a route if no alternatives exist—except for bbox, tunnel, and geofence_id, which enforce strict avoidance and return a 4xx error if no route is found; for bbox, boundaries must be defined in the format bbox:min_lat,min_lng,max_lat,max_lng, supporting multiple boxes (max perimeter 500 km), and for sharp_turn, the default permissible angle range is [120,240] clockwise (customizable via turn_angle_range); when using geofence_id; ferry routes are avoided by default unless this parameter is explicitly set, and specifying none with other values causes an error as no valid route can be generated.

exclude'toll' | 'ferry' | 'highway' | 'service_road' | 'uturn' | 'sharp_turn' | 'left_turn' | 'right_turn' | 'none'

This parameter is a strict filter that ensures routes exclude the specified object(s), separated by a pipe (,); effective only when route_type=fastest, it returns a 4xx error if no valid route exists, with default sharp_turn angles in [120,240] (override via turn_angle_range), and using none with other values results in an error.

approaches'unrestricted' | 'curb'

A semicolon-separated list specifying the side of the road to approach each waypoint; use unrestricted to approach from either side, curb to approach from the driving side, with the number of values being one more than the waypoints—skipped values can be left blank using ;.

departure_timeinteger

Use this parameter to set a departure time, expressed as UNIX epoch timestamp in seconds, for calculating the isochrone contour. The response will consider the typical traffic conditions at the given time and return a contour which can be reached under those traffic conditions. Please note that if no input is provided for this parameter then the traffic conditions at the time of making the request are considered.

local_departure_timestring

Use this parameter to specify departure time in local time format (day name and time). Format: 'DayName HH:mm'. The API will automatically convert this to the appropriate UTC timestamp based on the timezone of the origin location. Cannot be used together with departure_time parameter. Examples: Monday 08:00

truck_sizestring

This defines the dimensions of a truck in centimeters (cm). This parameter is effective only when the mode=truck. Maximum dimensions are as follows: Height = 1000 cm ,Width = 5000 cm ,Length = 5000 cm.Format: height,width,length

truck_weightinteger

This parameter defines the weight of the truck including trailers and shipped goods in kilograms (kg). This parameter is effective only when mode=truck. Minimum: 1 ,Maximum: 100000

route_type'fastest' | 'shortest'

Set the route type that needs to be returned.

altcountinteger

Sets the number of alternative routes to return. It is effective only when alternatives is true.Please note that adding alternative route count does not guarantee matching number of routes to be returned if potential alternative routes do not exist.Minimum: 1 ,Maximum: 3

alternativesboolean

When true the API will return alternate routes.The alternatives is effective only when there are no waypoints included in the request and the route_type is set to shortest.You can set the number of alternate routes to be returned in the altcount property.

road_info'max_speed' | 'toll_distance' | 'toll_cost'

Use this parameter to receive additional information about the road segments returned in the response. Currently, following inputs are supported: max_speed : segment-wise maximum speed information of roads in the response. toll_distance : returns the total distance travelled on the road segments having tolls. toll_cost: returns the range of toll charges, in local currency, that can be incurred for the suggested route.Please note that this parameter is effective only when option=flexible.

cross_borderboolean

Specify if crossing an international border is expected for operations near border areas. When set to false, the API will prohibit routes crossing the borders. When set to true, the service will return routes which cross the borders between countries, if required for the given set destination and waypoints.This feature is available in North America region only. Please get in touch with support@nextbillion.ai to enquire/enable other areas.

truck_axle_loadnumber

Specify the total load per axle (including the weight of trailers and shipped goods) of the truck, in tonnes. When used, the service will return routes which are legally allowed to carry the load specified per axle. Please note this parameter is effective only when mode=truck.

hazmat_type'explosives' | 'gas' | 'flammable_liquid' | 'flammable_gas' | 'organic' | 'toxic' | 'radioactive' | 'corrosive' | 'other'

Specify the type of hazardous material being carried and the service will avoid roads which are not suitable for the type of goods specified. Multiple values can be separated using a comma operator ',' .Please note that this parameter is effective only when mode=truck.

turn_angle_rangeinteger

Specify the turn angles that can be taken safely by the vehicle. The permissible turn angles are calculated as [0 + turn_angle_range , 360 - turn_angle_range]. Please note that this parameter is effective only when avoid = sharp_turn. It is worth highlighting here that providing smaller angles might lead to 4xx errors as route engine might not be able find routes satisfying the smaller turn angle criteria for all turns in the route.

drive_time_limitsstring

An array of durations, in seconds, for which the driver can drive continuously before taking a rest. Multiple drive time limits can be separated by a ,. After driving for the given duration the driver will take a rest for a fixed period, specified in rest_times . Once the rest duration is over, the subsequent driving duration starts and the process continues until all drive times and rest periods are exhausted or if the driver reaches the destination. This feature is useful in complying with Hours of Service regulations and calculates actual ETAs with regulated driving periods. As an example, a drive_time_limits = [500, 300] means that driver can drive for 500 seconds before the first rest period and then drive for another 300 seconds before taking a rest next time. Please note that, If the trip duration is smaller than the first input of drive_time_limits, then there will be no rest actions scheduled by the service. If the trip duration is larger than the scheduled time, then a warning is returned in the response - along with details of last leg of the trip - to indicate the same.Format: drive_time_limits_1, drive_time_limits_2,...

rest_timesstring

An array of durations, in seconds, for which the driver should rest after completing the corresponding continuous driving interval (provided in drive_time_limits). Multiple rest times can be separated by a , . Ideally, the number of rest_times provided should be equal to the number of drive_time_limits provided for proper scheduling of driver breaks. As an example, a rest_times = [500, 300] means that driver can rest for 500 seconds after the first continuous driving session and rest for 300 seconds after the next continuous driving session. Please note that: If the number of rest_times provided are less than the number of drive_time_limits, the service will schedule a rest period of 0 seconds after each such drive time period which does not have a corresponding entry in rest_times. If the number of rest_times provided is more than the number of drive times provided, the additional rest times are never applied.Format: rest_times_1,rest_times_2,rest_times_3,....

bearingsstring

Limits the search to road segments with given bearing, in degrees, towards true north in clockwise direction. Each bearings should be in the format of degree,range, where the degree should be a value between [0, 360] and range should be a value between [0, 180].Please note that the number of bearings should be two more than the number of waypoints. This is to account for the bearing of origin and destination. If a route can approach a waypoint or the destination from any direction, the bearing for that point can be specified as 0,180. Format: degree0,range0;degree1,range1;...

emission_class'euro0' | 'euro1' | 'euro2' | 'euro3' | 'euro4' | 'euro5' | 'euro6' | 'euro7' | 'euro8' | 'euro9'

Specify the emission class to which the vehicle (engine) belongs to. The service will use this setting to generate routes that are permissible for that engine class. Only the emission classifications in the EU regions are supported currently.

option'flexible' required

Use this option to switch to time based routing or if you want to choose between the fastest and shortest route types.

Headers

X-Request-Idstring

The X-Request-Id header is optional but incredibly useful for developers. It serves as a unique identifier for requests within our system. When you encounter any problems with your requests, providing us with the X-Request-Id will enable us to pinpoint the specific request in question without the need for extensive manual searching. This means faster and more efficient troubleshooting.

Response

OK

statusstring
msgstring
warningstring[]

Changes

No recorded changes to this operation across all 1 revision of this API.