WayMatrixWayMatrix
WayMatrix
  • Getting started
  • API reference
  • Your API keys
  • Your usage
  • Billing
  • Back to waymatrix.io
Information
Matrix
    Travel-time and distance matrixpostTravel-time and distance matrix (explicit JSON form)post
Directions
    Route between two pointsgetRoute with full optionspostRoute, JSON formpostRoute, GeoJSON formpostRoute, GPX formpost
Isochrones
    Reachability polygonspostReachability polygons (explicit GeoJSON form)post
Service
    LivenessgetLiveness, headers onlyheadEngine and graph provenancegetEngine and graph provenance, headers onlyhead
Schemas
powered by Zuplo
WayMatrix Routing API
WayMatrix Routing API

Matrix

Travel-time and distance matrices.


Travel-time and distance matrix

POST
https://api.waymatrix.io
/v2/matrix/{profile}

Computes travel times (durations), distances, or both, from every source to every destination. You send your points once in locations, then choose which of them are sources and which are destinations.

What it costs

The number of sources times the number of destinations. Put another way, elements consumed = |sources| × |destinations|.

If you leave out sources, or send ["all"], every location is used as a source. The same goes for destinations. So a request with n locations that sets neither field costs n² elements.

Limits

PlanLargest matrix per request
Free2,500 elements (50 × 50)
Every other plan90,000 elements (300 × 300)

A bigger request is refused before any work is done, with 400 (code 6004, matrix too large).

Requests with certain options

Five options make a matrix much slower to compute, so requests using them also have a limit on the number of sources.

The five are avoid_borders, avoid_polygons, avoid_countries, avoid_features and dynamic_speeds. The value doesn't matter: "dynamic_speeds": false counts the same as true. Sending "optimized": false without an options block counts too, because it asks for the same slower work.

An empty options, "options": null, and an options block holding only other fields are not affected by this limit.

How many sources you may send depends on your plan:

PlanMatrix with these optionsIf you go over
FreeNot allowed403 (code 5011)
Every other planUp to 25 sources400 (code 6004), with a message that names the limit

The number of sources is the length of sources when it lists location indices, counting repeats; otherwise it is the number of locations. The element limit above still applies to these requests.

A 5011 refusal has the same error text as an invalid key ({"error":"Access to this API has been disallowed","code":5011}), so check code to tell them apart.

When one of these requests runs out of searching

A matrix using those options searches the road network once per source, and there is a ceiling on how much searching a single request may do. A request that reaches it fails with 500 (code 6020), partway through. You aren't charged for it.

Send fewer sources, or cover a smaller area. This ceiling is not a plan limit, so a larger plan does not lift it.

Travel-time and distance matrix › path Parameters

profile
​string · required

The routing profile. Only driving-car is served. Any other value returns an "incorrect value" error.

Example: driving-car

Travel-time and distance matrix › Headers

Authorization
​string · required

The Authorization header is used to authenticate with the API using your API key. Value is of the format Bearer YOUR_KEY_HERE.

Travel-time and distance matrix › Request Body

MatrixRequest
locations
​Coordinate[] · required

The points the matrix is computed over. At least two.

sources
​(integer | string)[]

Indices into locations to use as sources. Leave it out, or send ["all"], to use every location. Cost is |sources| × |destinations|.

destinations
​(integer | string)[]

Indices into locations to use as destinations. Leave it out, or send ["all"], to use every location. Cost is |sources| × |destinations|.

metrics
​string[]

Which matrices to return. Defaults to durations only.

Enum values:
duration
distance
resolve_locations
​boolean

Return the name of the nearest road for each snapped point.

units
​string · enum

Units for the distance matrix. Durations are always seconds.

Enum values:
m
km
mi
id
​string

An arbitrary identifier echoed back in the response metadata.

Travel-time and distance matrix › Responses

The computed matrix.

MatrixResponse
durations
​array[]

Travel times in seconds, as rows of sources by columns of destinations. A null entry means no route was found between that pair.

distances
​array[]

Distances, present only when requested via metrics.

​SnappedPoint[]
​SnappedPoint[]
​Metadata

Details about the request and the data behind the answer, plus element_count.

POST/v2/matrix/{profile}
curl https://api.waymatrix.io/v2/matrix/:profile \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "locations": [ { "0": -87.6298, "1": 41.8781 }, { "0": -87.6244, "1": 41.8796 }, { "0": -87.6722, "1": 41.9227 } ], "metrics": [ "duration", "distance" ], "units": "km" }'
Example Request Body
{ "locations": [ { "0": -87.6298, "1": 41.8781 }, { "0": -87.6244, "1": 41.8796 }, { "0": -87.6722, "1": 41.9227 } ], "metrics": [ "duration", "distance" ], "units": "km" }
json
application/json
Example Responses
{ "durations": [ { "0": 0, "1": 421.3, "2": 782.6 }, { "0": 402.9, "1": 0, "2": 897.4 }, { "0": 768.1, "1": 881.5, "2": 0 } ], "distances": [ { "0": 0, "1": 2.61, "2": 6.42 }, { "0": 2.68, "1": 0, "2": 8.13 }, { "0": 6.35, "1": 8.21, "2": 0 } ], "sources": [ { "location": [ -87.6298, 41.8781 ], "snapped_distance": 4.31 }, { "location": [ -87.6244, 41.8796 ], "snapped_distance": 11.82 }, { "location": [ -87.6722, 41.9227 ], "snapped_distance": 6.09 } ], "destinations": [ { "location": [ -87.6298, 41.8781 ], "snapped_distance": 4.31 }, { "location": [ -87.6244, 41.8796 ], "snapped_distance": 11.82 }, { "location": [ -87.6722, 41.9227 ], "snapped_distance": 6.09 } ], "metadata": { "attribution": "© openrouteservice by HeiGIT | Data from OpenStreetMap", "service": "matrix", "timestamp": 1788412800000, "query": { "locations": [ { "0": -87.6298, "1": 41.8781 }, { "0": -87.6244, "1": 41.8796 }, { "0": -87.6722, "1": 41.9227 } ], "metrics": [ "duration", "distance" ], "units": "km", "profile": "driving-car" }, "engine": { "version": "9.10.0", "build_date": "2026-07-28T00:00:00Z", "graph_date": "2026-07-31T00:00:00Z", "osm_date": "2026-07-30T00:00:00Z" }, "element_count": 9 } }
json
application/json

Travel-time and distance matrix (explicit JSON form)

POST
https://api.waymatrix.io
/v2/matrix/{profile}/json

Identical to POST /v2/matrix/{profile}.

Travel-time and distance matrix (explicit JSON form) › path Parameters

profile
​string · required

The routing profile. Only driving-car is served. Any other value returns an "incorrect value" error.

Example: driving-car

Travel-time and distance matrix (explicit JSON form) › Headers

Authorization
​string · required

The Authorization header is used to authenticate with the API using your API key. Value is of the format Bearer YOUR_KEY_HERE.

Travel-time and distance matrix (explicit JSON form) › Request Body

MatrixRequest
locations
​Coordinate[] · required

The points the matrix is computed over. At least two.

sources
​(integer | string)[]

Indices into locations to use as sources. Leave it out, or send ["all"], to use every location. Cost is |sources| × |destinations|.

destinations
​(integer | string)[]

Indices into locations to use as destinations. Leave it out, or send ["all"], to use every location. Cost is |sources| × |destinations|.

metrics
​string[]

Which matrices to return. Defaults to durations only.

Enum values:
duration
distance
resolve_locations
​boolean

Return the name of the nearest road for each snapped point.

units
​string · enum

Units for the distance matrix. Durations are always seconds.

Enum values:
m
km
mi
id
​string

An arbitrary identifier echoed back in the response metadata.

Travel-time and distance matrix (explicit JSON form) › Responses

The computed matrix.

MatrixResponse
durations
​array[]

Travel times in seconds, as rows of sources by columns of destinations. A null entry means no route was found between that pair.

distances
​array[]

Distances, present only when requested via metrics.

​SnappedPoint[]
​SnappedPoint[]
​Metadata

Details about the request and the data behind the answer, plus element_count.

POST/v2/matrix/{profile}/json
curl https://api.waymatrix.io/v2/matrix/:profile/json \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "locations": [ { "0": -87.6298, "1": 41.8781 }, { "0": -87.6244, "1": 41.8796 }, { "0": -87.6722, "1": 41.9227 } ], "metrics": [ "duration", "distance" ], "units": "km" }'
Example Request Body
{ "locations": [ { "0": -87.6298, "1": 41.8781 }, { "0": -87.6244, "1": 41.8796 }, { "0": -87.6722, "1": 41.9227 } ], "metrics": [ "duration", "distance" ], "units": "km" }
json
application/json
Example Responses
{ "durations": [ [ 0 ] ], "distances": [ [ 0 ] ], "sources": [ { "location": { "0": -87.6298, "1": 41.8781 }, "snapped_distance": 0, "name": "name" } ], "destinations": [ { "location": { "0": -87.6298, "1": 41.8781 }, "snapped_distance": 0, "name": "name" } ], "metadata": { "attribution": "© openrouteservice by HeiGIT | Data from OpenStreetMap", "service": "service", "timestamp": 0, "query": {}, "engine": { "version": "version", "build_date": "build_date", "graph_date": "graph_date", "osm_date": "osm_date" }, "element_count": 0 } }
json
application/json

Directions