Skip to content
Matrix API

Matrix API

The Matrix API calculates travel times and distances between multiple origins and multiple destinations in a single request. This is useful for finding the fastest destination from a set of options, or for building a full distance matrix between locations.

The Matrix API is currently available in the German state of NRW. Contact us for other regions.

Base URL

https://routing.maptoolkit.net/matrix

Authentication

Add your API key as ?api_key=YOUR_API_KEY to every request. See Authentication for details.

Parameters

ParameterTypeRequiredDescription
fromlat,lngYesOrigin coordinate. Repeat for multiple origins.
tolat,lngYesDestination coordinate. Repeat for multiple destinations.
routeTypestringYesVehicle type: car, bike, foot, or transit.
departurestringNoDeparture time in ISO 8601 format (e.g., 2025-04-05T23:16:00Z). Only affects transit routing.

Notes

  • For transit routing, the departure parameter affects results — without it, a default departure time is used.

Response

Calculate travel times and distances from two origins to two destinations by car:

GET https://routing.maptoolkit.net/matrix?routeType=car&from=51.2194,6.7941&from=50.7323,7.0960&to=50.9420,6.9581&to=50.7681,6.0926&api_key=YOUR_API_KEY

This is a response to the HTTP GET request shown above:

{
  "distances": [
    [
      39500,
      80656
    ],
    [
      28732,
      91729
    ]
  ],
  "times": [
    [
      1684,
      2874
    ],
    [
      1464,
      3165
    ]
  ],
  "info": {
    "copyrights": "gtfs.de, OpenStreetMap contributors"
  }
}

The result is ordered as [from1→to1, from1→to2, …], [from2→to1, from2→to2, …]. Times are in seconds, distances in meters.

If a connection cannot be found, the value is null. The distances matrix is not available for the transit profile.