Glossary

Matrix API

The Mapbox Matrix API calculates travel times between many points in one API request.

The Matrix API returns travel times between many locations and is designed specifically for building a timetable or matrix. The number of sources and destinations are multiplied to create the matrix, or timetable, and calculate the number of elements needed to make the request. For example, given 3 locations — A, B, and C — the Matrix API will return a matrix of all travel times in seconds between all the locations:

image of 3 elements used for matrix request

ABC
AA → AA → BA → C
BB → AB → BB → C
CC → AC → BC → C

The Matrix API works worldwide and is available for the mapbox/driving-traffic, driving, cycling, and walking routing profiles.

A sample Matrix API request looks like:

https://api.mapbox.com/directions-matrix/v1/mapbox/driving/-122.42,37.78;-122.45,37.91;-122.48,37.73?access_token=YOUR_MAPBOX_ACCESS_TOKEN

The Matrix API has optional parameters that can be used to refine the results of a request.

Related resources:

Was this page helpful?