Use to get a route matrix showing the travel time and distance for all possible pairs in a list of origins and destinations, using a synchronous request.

[!NOTE]

Azure Maps Route v1 service retirement

The Azure Maps Route v1 service is now deprecated and will be retired on 3/31/28. To avoid service disruptions, all calls to Route v1 service will need to be updated to use Route v2025-01-01 service by 3/31/28. For more information, see Migrate Azure Maps Route 1.0 APIs.

The Post Route Matrix Sync API is an HTTP POST request that allows calculation of a matrix of route summaries for a set of routes defined by origin and destination locations by using a single synchronous (sync) request. To make an asynchronous (async) request, see Post Route Matrix. For every given origin, the service calculates the cost of routing from that origin to every given destination. The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell. As an example, let's say a food delivery company has 20 drivers and they need to find the closest driver to pick up the delivery from the restaurant. To solve this use case, they can call Matrix Route API.

For each route, the travel times and distances are returned. You can use the computed costs to determine which detailed routes to calculate using the Route Directions API.

The maximum size of a matrix for async request is 700 and for sync request it's 100 (the number of origins multiplied by the number of destinations).

Submit Synchronous Route Matrix Request

If your scenario requires synchronous requests and the maximum size of the matrix is less than or equal to 100, you might want to make synchronous request. The maximum size of a matrix for this API is 100 (the number of origins multiplied by the number of destinations). With that constraint in mind, examples of possible matrix dimensions are: 10x10, 6x8, 9x8 (it does not need to be square).

POST https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&subscription-key={subscription-key}

Submit Asynchronous Route Matrix Request

The Asynchronous API is appropriate for processing big volumes of relatively complex routing requests. When you make a request by using async request, by default the service returns a 202 response code along a redirect URL in the Location field of the response header. This URL should be checked periodically until the response data or error information is available. If waitForResults parameter in the request is set to true, user will get a 200 response if the request is finished under 120 seconds.

The maximum size of a matrix for this API is 700 (the number of origins multiplied by the number of destinations). With that constraint in mind, examples of possible matrix dimensions are: 50x10, 10x10, 28x25. 10x70 (it does not need to be square).

The asynchronous responses are stored for 24 hours. The redirect URL returns a 404 response if used after the expiration period.

POST https://atlas.microsoft.com/route/matrix/json?api-version=1.0&subscription-key={subscription-key}

Here's a typical sequence of asynchronous operations:

  1. Client sends a Route Matrix POST request to Azure Maps

  2. The server will respond with one of the following:

    HTTP 202 Accepted - Route Matrix request has been accepted.

    HTTP Error - There was an error processing your Route Matrix request. This could either be a 400 Bad Request or any other Error status code.

  3. If the Matrix Route request was accepted successfully, the Location header in the response contains the URL to download the results of the request. This status URI looks like the following:

  GET https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key}
  1. Client issues a GET request on the download URL obtained in Step 3 to download the results

Download Sync Results

When you make a POST request for Route Matrix Sync API, the service returns 200 response code for successful request and a response array. The response body will contain the data and there will be no possibility to retrieve the results later.

Download Async Results

When a request issues a 202 Accepted response, the request is being processed using our async pipeline. You will be given a URL to check the progress of your async request in the location header of the response. This status URI looks like the following:

  GET https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key}

The URL provided by the location header will return the following responses when a GET request is issued.

HTTP 202 Accepted - Matrix request was accepted but is still being processed. Please try again in some time.

HTTP 200 OK - Matrix request successfully processed. The response body contains all of the results.

post/route/matrix/sync/{format}

Query parameters

api-versionstring required

Version number of Azure Maps API.

waitForResultsboolean

Boolean to indicate whether to execute the request synchronously. If set to true, user will get a 200 response if the request is finished under 120 seconds. Otherwise, user will get a 202 response right away. Please refer to the API description for more details on 202 response. Supported only for async request.

computeTravelTimeFor'none' | 'all'

Specifies whether to return additional travel times using different types of traffic information (none, historic, live) as well as the default best-estimate travel time.

sectionTypestring[]

Specifies which of the section types is reported in the route response. <br><br>For example if sectionType = pedestrian the sections which are suited for pedestrians only are returned. Can be specified multiple times in one request, for example, '&sectionType=carTrain&sectionType=pedestrian&sectionType=motorway'. The default sectionType refers to the travelMode input. By default travelMode is set to car

arriveAtstring date-time

The date and time of arrival at the destination point formatted as a dateTime value as defined in RFC 3339, section 5.6, with an optional time zone offset. When a time zone offset is not specified it will be assumed to be that of the destination point.

Examples:

  • 2023-12-19T16:39:57
  • 2023-12-19T16:39:57-08:00

The arriveAt parameter cannot be used in conjunction with departAt, minDeviationDistance or minDeviationTime.

departAtstring date-time

The date and time of departure from the origin point formatted as a dateTime value as defined in RFC 3339, section 5.6, with an optional time zone offset. When a time zone offset is not specified, it will be assumed to be that of the origin point.

  • Default value: now
  • Other value: dateTime

Examples:

  • 2023-12-19T16:39:57
  • 2023-12-19T16:39:57-08:00

The departAt parameter cannot be used in conjunction with arriveAt.

vehicleAxleWeightinteger

Weight per axle of the vehicle in kg. A value of 0 means that weight restrictions per axle are not considered.

vehicleLengthnumber double

Length of the vehicle in meters. A value of 0 means that length restrictions are not considered.

vehicleHeightnumber double

Height of the vehicle in meters. A value of 0 means that height restrictions are not considered.

vehicleWidthnumber double

Width of the vehicle in meters. A value of 0 means that width restrictions are not considered.

vehicleMaxSpeedinteger

Maximum speed of the vehicle in km/hour. The max speed in the vehicle profile is used to check whether a vehicle is allowed on motorways.

  • A value of 0 means that an appropriate value for the vehicle will be determined and applied during route planning.

  • A non-zero value may be overridden during route planning. For example, the current traffic flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will again use 60 km/hour.

vehicleWeightinteger

Weight of the vehicle in kilograms.

windingness'low' | 'normal' | 'high'

Level of turns for thrilling route. This parameter can only be used in conjunction with routeType=thrilling.

hilliness'low' | 'normal' | 'high'

Degree of hilliness for thrilling route. This parameter can only be used in conjunction with routeType=thrilling.

travelMode'car' | 'truck' | 'taxi' | 'bus' | 'van' | 'motorcycle' | 'bicycle' | 'pedestrian'

The mode of travel for the requested route. If not defined, default is 'car'. Note that the requested travelMode may not be available for the entire route. Where the requested travelMode is not available for a particular section, the travelMode element of the response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van are BETA functionality. Full restriction data is not available in all areas.

avoidstring[]

Specifies something that the route calculation should try to avoid when determining the route. Can be specified multiple times in one request, for example, '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In Route Range requests, the value alreadyUsedRoads must not be used.

trafficboolean

Possible values:

  • true - Do consider all available traffic information during routing
  • false - Ignore current traffic data during routing. Note that although the current traffic data is ignored during routing, the effect of historic traffic on effective road speeds is still incorporated.
routeType'fastest' | 'shortest' | 'eco' | 'thrilling'

The type of route requested.

vehicleLoadType'USHazmatClass1' | 'USHazmatClass2' | 'USHazmatClass3' | 'USHazmatClass4' | 'USHazmatClass5' | 'USHazmatClass6' | 'USHazmatClass7' | 'USHazmatClass8' | 'USHazmatClass9' | 'otherHazmatExplosive' | 'otherHazmatGeneral' | 'otherHazmatHarmfulToWater'

Types of cargo that may be classified as hazardous materials and restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, plus generic classifications for use in other countries/regions. Values beginning with USHazmat are for US routing while otherHazmat should be used for all other countries/regions. vehicleLoadType can be specified multiple times. This parameter is currently only considered for travelMode=truck.

Parameters

../../../Common/preview/1.0/common.json#/components/parameters/ClientId — unresolved $ref
../../../Common/preview/1.0/common.json#/components/parameters/JsonFormat — unresolved $ref

Request body

originsGeoJsonMultiPoint — unresolved $ref
destinationsGeoJsonMultiPoint — unresolved $ref

Response

Matrix request successfully processed. The response body contains all of the results.

formatVersionstring

Format Version property

Changes