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
}
]
}
'import requests
url = "https://api.footstep.ai/v1/routing/matrix"
payload = {
"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
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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}]
})
};
fetch('https://api.footstep.ai/v1/routing/matrix', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.footstep.ai/v1/routing/matrix",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.footstep.ai/v1/routing/matrix"
payload := strings.NewReader("{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.footstep.ai/v1/routing/matrix")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.footstep.ai/v1/routing/matrix")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"matrix": [
[
{
"distance_meters": 123,
"duration_seconds": 123
}
]
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Calculate Matrix
Compute a time and distance matrix between sources and targets. Returns a 2D matrix indexed by [source][target] with distance_meters and duration_seconds for each pair. Null cells indicate unreachable pairs. All distances are in meters regardless of request units.
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
}
]
}
'import requests
url = "https://api.footstep.ai/v1/routing/matrix"
payload = {
"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
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
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}]
})
};
fetch('https://api.footstep.ai/v1/routing/matrix', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.footstep.ai/v1/routing/matrix",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'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
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.footstep.ai/v1/routing/matrix"
payload := strings.NewReader("{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.footstep.ai/v1/routing/matrix")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.footstep.ai/v1/routing/matrix")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sources\": [\n {\n \"lat\": 51.5322,\n \"lon\": -0.124\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0754\n }\n ],\n \"targets\": [\n {\n \"lat\": 51.5178,\n \"lon\": -0.0823\n },\n {\n \"lat\": 51.5055,\n \"lon\": -0.0862\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"matrix": [
[
{
"distance_meters": 123,
"duration_seconds": 123
}
]
]
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Your Footstep API key
Body
1 - 50 elementsShow child attributes
Show child attributes
1 - 50 elementsShow child attributes
Show child attributes
auto, bicycle, pedestrian, bus, truck Fine-tuning options. Include only the key matching your travel type.
Show child attributes
Show child attributes
kilometers, miles 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).
footstep, geojson Response
Time/distance matrix
Time/distance matrix with explicit units
2D matrix indexed as matrix[source_index][target_index]. null = unreachable pair.
Show child attributes
Show child attributes