Skip to content

Directions API

POST Async Route Matrix - Submit Job enterprise only

The Async Route Matrix API computes large-scale travel time and distance matrices between sets of origins and destinations, supporting up to 10,000 x 10,000 location pairs. It uses a 3-step asynchronous flow: submit, poll, retrieve.

This endpoint submits a matrix calculation request and returns a job ID used to poll status and retrieve results.

Resource URL

https://www.mapquestapi.com/directions/v2/routematrix/jobs

Resource Information

Response FormatsJSON
AuthenticationYes (Requires Key)
Rate LimitedYes

Request Parameters

Request ParameterDescriptionRequired
key
String
The API Key, which is needed to make requests to MapQuest services.Yes

Body Parameters

ParameterTypeDescriptionRequired
originsArrayArray of {lat, lng} objects representing origin locations. Min 1, max 10,000.Yes
destinationsArrayArray of {lat, lng} objects representing destination locations. Min 1, max 10,000.Yes
options.transportStringTransport mode: car, truck, pedestrian, bicycle. Case-insensitive.No, defaults to car
options.modeStringRouting mode: fastest or shortest. Case-insensitive.No, defaults to fastest
options.departureTimeStringISO 8601 datetime with timezone offset (e.g. 2026-08-06T11:20:00+02:00), or "any" for time-independent routing. Only supported when options.region is provided.No
options.regionObjectGeoJSON Polygon constraining the routing area. See Region Parameter below.No

Response Object

idThe unique job identifier. Use this value as-is in subsequent status and results requests.
statusThe current job status (accepted).
hrefURL to poll the job status.

Transport and Mode Combinations

The following transport and mode combinations are supported:

TransportMode
car (default)fastest (default)
carshortest
truckfastest
pedestrianany
bicycleany

Unsupported combinations when no region is provided

  • truck + shortest returns a 400 error
  • taxi, scooter, bus, privateBus are not supported without a region and return a 400 error

Region Parameter

The options.region field defines a GeoJSON Polygon that constrains the routing area. When provided, routes are computed only within the polygon boundary, which can improve performance for regional matrices.

When to use a region vs. not:

  • With region (polygon): Best for smaller, focused matrices. Supports transport, mode, and departureTime options. The polygon must have a diameter under 400 km.
  • Without region: Routing is unbounded and supports large matrices (e.g. 10,000 x 10,000). Does not support departureTime.

Polygon constraints:

  • Must be a closed ring: first and last coordinate must be identical
  • Minimum 3 vertices (4 coordinates including closing point)
  • Maximum 100 vertices (101 coordinates including closing point)
  • Coordinates are in GeoJSON order: [longitude, latitude]
  • Maximum diameter of ~400 km. If exceeded, a 400 error is returned.

Example polygon (bounding box):

json
{
  "type": "Polygon",
  "coordinates": [[
    [-106.545, 38.532],
    [-103.55, 38.532],
    [-103.55, 40.928],
    [-106.545, 40.928],
    [-106.545, 38.532]
  ]]
}

Transaction / Billing

Each call to the submit endpoint counts as one or more transactions depending on the number of origins (S) and destinations (D):

  • If S or D is less than 5: transactions = S × D
  • If S and D are both 5 or greater: transactions = max(S, D) × 5
Origins (S)Destinations (D)TransactionsRule Applied
3412S × D (one side < 5)
21020S × D (one side < 5)
1020100max(10, 20) × 5 (both ≥ 5)
100100500max(100, 100) × 5 (both ≥ 5)
5525max(5, 5) × 5 (both ≥ 5)

Example Request

bash
curl -X POST "https://www.mapquestapi.com/directions/v2/routematrix/jobs?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origins": [
      {"lat": 39.7392, "lng": -104.9903},
      {"lat": 40.7128, "lng": -74.0060}
    ],
    "destinations": [
      {"lat": 34.0522, "lng": -118.2437},
      {"lat": 41.8781, "lng": -87.6298}
    ],
    "options": {"transport": "car", "mode": "fastest"}
  }'

Example Response

json
{
  "id": "YWJjMTIzLWRlZjQ1Ni1naGk3ODk6dXMtZWFzdC0xOm0",
  "status": "accepted",
  "href": "https://www.mapquestapi.com/directions/v2/routematrix/jobs/YWJjMTIzLWRlZjQ1Ni1naGk3ODk6dXMtZWFzdC0xOm0"
}

Error Handling

  • Validation error (400): Returned for invalid request bodies (e.g. missing origins, invalid coordinates, unclosed polygon ring). The response includes a descriptive message.
  • Region too large (400): Returned when the polygon region exceeds the ~400 km diameter limit.
  • Unsupported transport/mode (400): Returned for transport/mode combinations not supported without a region (e.g. truck + shortest, or taxi).

Important Notes

  • Matrix size: Up to 10,000 × 10,000 (100 million calculations) without a region. With a polygon region, smaller matrices are recommended to avoid per-segment waypoint limits.
  • Processing time: Large matrices may take minutes to hours to compute.
  • Units: Distances are always in meters. Travel times are always in seconds.
  • Job ID: The id returned by the API encodes all context needed for polling and retrieval. Use it as-is in subsequent requests.
  • 3-step flow: This endpoint only submits the job. Use Poll Job Status to check progress, and Retrieve Results once complete.