Mapbox Matrix API

The Mapbox Matrix API (formerly the Distance 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 mutliplied to create the matrix, or timetable, and calculate the number of elements needed to make the request. For example, given 3 locations A, B, C, the Matrix API will return a matrix of all travel times in seconds between all locations:

image of 3 elements used for matrix request

  A B C
A A → A A → B A → C
B B → A B → B B → C
C C → A C → B C → C

The Matrix API works worldwide and is available for the driving, cycling, and walking routing profiles. Learn more about how the Mapbox Matrix API works on our comprehensive How Directions Works tutorial.

The Mapbox Matrix API is available for all plan levels.