Travel Matrix Api

The Travel Matrix Flexible API provides ETAs and distances using truck-specific routes, departure times, traffic, and route preferences by setting the option parameter to flexible. It supports both HTTPS GET and POST, with POST allowing larger origin-destination sets.

get/v1/matrix/location

Request

  • Base URL: https://api.cloud.precisely.com
  • URL: https://api.cloud.precisely.com/v1/matrix/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 'origins' and 'destinations' parameters. Default: LatLon. Example: LatLon

originsstring required

origins are the starting point of your route. Ensure that origins are routable land locations. Multiple origins should be separated by a comma symbol (,).

destinationsstring required

destinations are the ending coordinates of your route. Ensure that destinations are routable land locations. Multiple destinations should be separated by a comma symbol (,).

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.

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 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 comma (,); 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 first 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.

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.

route_failed_promptboolean

A prompt to modify the response in case no feasible route is available for a given pair of origin and destination. When set to true a value of -1 is returned for those pairs in which either origin or the destination can not be snapped to a nearest road. Please note that if all the origins and destinations in a request can't be snapped to their nearest roads, a 4xx error is returned instead, as the entire request failed both origin and destination can be snapped to the nearest road but the service can't find a valid route between them.However, a value of "0" is returned if both the origin and destination are snapped to the same location.false is the default value. In this case, a 0 value is returned for all the above cases. A 4xx error is returned, in this case as well, when all origins and destinations in the request can't be snapped to their nearest road.

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
warningstring[]

Changes

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