Skip to content
API Reference

Matrix API Reference

Try the API in your browser

Base URL

https://routing.maptoolkit.net

Endpoints

GET /matrix

Calculate a travel time and distance matrix

Returns a 2D matrix of travel times and distances for all combinations of from and to coordinates. Times are in seconds, distances are in meters. Distances are not available for routeType=transit. If a route cannot be found, the value is null.

ParameterInTypeRequiredDescription
fromqueryarrayYesOrigin coordinate in lat,lng format. Repeat to specify multiple origins.
routeTypequerystringYesTravel mode. Accepted values are car, bike, foot, and transit. One of: car, bike, foot, transit.
toqueryarrayYesDestination coordinate in lat,lng format. Repeat to specify multiple destinations.
callbackquerystringNoWraps the response in a JSONP callback function with this name.
departurequerystringNoDeparture time for transit routing as an ISO 8601 date-time string. Default: current time.
vehiclequerystringNoDeprecated. Use routeType instead. One of: car, bike, foot, transit.
StatusDescription
200Travel time and distance matrix.
400

Bad request.

Transit errors

  • Cannot parse departure time!departure value is not a valid date string.

Profile errors

  • Only car,bike,foot,transit profile is allowedrouteType must be one of the listed values.

General errors

  • Upstream routing engine error message forwarded as-is.
500Internal server error.

POST /matrix

Calculate a travel time and distance matrix (POST)

Same as GET but accepts parameters in the request body. Useful when querying many origins or destinations.

StatusDescription
200Travel time and distance matrix.
400

Bad request.

Transit errors

  • Cannot parse departure time!departure value is not a valid date string.

Profile errors

  • Only car,bike,foot,transit profile is allowedrouteType must be one of the listed values.

General errors

  • Upstream routing engine error message forwarded as-is.
500Internal server error.

Try it

The console below sends live requests against the endpoints above. You can browse it without an API key; Execute needs one, because every endpoint requires the api_key query parameter and returns 403 without it. Use Authorize to add your key. See First Steps if you do not have one yet.