Route Matrix API Specification

The API is used to calculate a time-distance matrix between provided waypoints. The API is implemented via an HTTP POST request.

API URL

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

Request parameters

Name Description
apiKey Geoapify API key

Request body parameters

Name Description
mode Transportation or travel mode. Possible values: "drive", "truck", "walk", "bicycle"
sources List of from-waypoints
sources.location Location represented as an array of coordinates: [longitude, latitude]
targets List of to-waypoints
targets.location Location represented as an array of coordinates: [longitude, latitude]

Response Object

Name Description
sources List of from-waypoints with original and matched to existing roads locations
sources.original_location Original location represented as an array of coordinates: [longitude, latitude]
sources.location Matched location represented as an array of coordinates: [longitude, latitude]
targets List of to-waypoints with original and matched to existing roads locations
targets.original_location Original location represented as an array of coordinates: [longitude, latitude]
targets.location Matched location represented as an array of coordinates: [longitude, latitude]
sources_to_targets The time-distance matrix
sources_to_targets.distance Distance in meters between source waypoint and target waypoint
sources_to_targets.time Travel time in seconds between source waypoint and target waypoint
sources_to_targets.source_index Index of the source waypoint
sources_to_targets.target_index Index of the target waypoint