Distance Matrix API
Returns an N×N matrix of driving times (seconds) and distances (meters) in a single request, powered by the OSRM Table service. Ideal for nearest-store lookup, dispatch, and batch route planning.Endpoint
Request Parameters
Quickstart
Response
response-example.json
Response fields
Size limits
Exceeding the limit returns
400 TooBig. For large matrices: trim to the sub-matrix you need with sources/destinations, compute in batches, and cache the results — matrices are stable and rarely need real-time recomputation.
Recipes
- Nearest store:
sources=0(the user) againstdestinations=all, pick the column with the smallest duration - Dispatch planning: feed the matrix into Fleet Optimization or your own VRP solver
