Skip to main content
POST
/
v1
/
routing
/
matrix
Calculate time/distance matrix
curl --request POST \
  --url https://api.footstep.ai/v1/routing/matrix \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "sources": [
    {
      "lat": 51.5322,
      "lon": -0.124
    },
    {
      "lat": 51.5055,
      "lon": -0.0754
    }
  ],
  "targets": [
    {
      "lat": 51.5178,
      "lon": -0.0823
    },
    {
      "lat": 51.5055,
      "lon": -0.0862
    }
  ]
}
'
{
  "sources": [
    {
      "lat": 0,
      "lon": 0
    }
  ],
  "targets": [
    {
      "lat": 0,
      "lon": 0
    }
  ],
  "matrix": [
    [
      {
        "distance_m": 123,
        "duration_s": 123
      }
    ]
  ]
}

Authorizations

x-api-key
string
header
required

Your Footstep API key

Body

application/json
sources
object[]
required
Required array length: 1 - 50 elements
targets
object[]
required
Required array length: 1 - 50 elements
costing
enum<string>
default:auto
Available options:
auto,
bicycle,
pedestrian,
bus,
truck
costing_options
object

Mode-specific tuning. Include only the key matching your costing mode.

units
enum<string>
default:kilometers
Available options:
kilometers,
miles
format
enum<string>
default:footstep

Response format. footstep = optimised for app developers (encoded polyline, flat structure). geojson = standard GeoJSON FeatureCollection (decoded coordinates, immediately usable in Leaflet/Mapbox GL/deck.gl).

Available options:
footstep,
geojson

Response

Time/distance matrix

Time/distance matrix with explicit units

sources
object[]
required

Flattened source coordinates

targets
object[]
required

Flattened target coordinates

matrix
((object | null)[])[]
required

2D matrix indexed as matrix[source_index][target_index]. null = unreachable pair.