About Route Matrix API

The Route Matrix API returns a time-distance matrix between the provided source- and target- destinations. The matrix can be used as input for route optimization and analytics tasks.

Request example

Route Matrix API works via POST request that allows sending a massive amount of points in the request body.

HTTP Post request


POST https://api.geoapify.com/v1/routematrix?apiKey=YOUR_API_KEY
HEADERS 'Content-Type: application/json'

Request body

{
  "mode": "truck",
  "sources": [
    { "location": [9.236501233317654, 47.79125886208948] },
    { "location": [9.29243400499115, 47.75443519732946] },
    { "location": [9.402016578066196, 47.719889328346085] },
    { "location": [9.69195380266035, 47.63303975785408] },
    ...
  ],
  "targets": [
    { "location": [9.049297670979968, 47.572236047449366] },
    { "location": [9.204539649503204, 47.56068305549502] },
    { "location": [9.33923489557526, 47.51830028304724] },
    ...
  ]
}

Required parameters:

  • apiKey - your Geoapify key

Request body parameters:

  • mode - routing / transportation mode - 'drive', 'truck', 'walk', 'bicycle'
  • sources - a list of from-waypoints
  • targets - a list of to-waypoints

The response returned contains the time-distance matrix for the waypoints provided as well as original and matched locations for the source- and target-waypoints.