oslew docs
Console
Menu

RoutingroutingoperationId matrix

GET/v1/matrix

Travel times between every pair of up to 500 points.

Send Authorization: Bearer sk_live_…. The key's plan must include therouting product; which plans do.

Explained in Products and plans, Travel-time matrices and A store locator.

Example

Four points, every pair.

curl
curl -G "https://api.oslew.com/v1/matrix" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'points=19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.matrix(
    "19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620",
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.matrix("19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620");
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 296
ratelimit-reset: 1

{
  "points": [
    [
      19.4406,
      -99.2047
    ],
    [
      19.4326,
      -99.1332
    ],
    [
      19.4352,
      -99.1412
    ],
    [
      19.35,
      -99.162
    ]
  ],
  "snapped": [
    {
      "node": 394836,
      "lat": 19.44024148258054,
      "lon": -99.20469439858863,
      "distance_m": 39.86969964600963
    },
    {
      "node": 355496,
      "lat": 19.432020221186303,
      "lon": -99.13343108985583,
      "distance_m": 68.87232944392214
    },
    {
      "node": 289914,
      "lat": 19.435305832231098,
      "lon": -99.14069479599135,
      "distance_m": 54.266522306414174
    },
    {
      "node": 368462,
      "lat": 19.35000467473249,
      "lon": -99.16174576953559,
      "distance_m": 26.677376568826062
    }
  ],
  "durations_s": [
    [
      0,
      693.5,
      561,
      814.5
    ],
    [
      691.5,
      0,
      212.1,
      651.1
    ],
    [
      546.3,
      170.5,
      0,
      745.7
    ],
    [
      791.1,
      656.5,
      732.8,
      0
    ]
  ],
  "engine": "base/hierarchy",
  "provenance": {
    "name": "overture-transportation",
    "release": "2026-08-19.0",
    "license": "ODbL-1.0"
  },
  "took_us": 2093
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Query

NameTypeDescription
points
queryrequired
string
lat,lon;lat,lon;…
profile
query
string
driving | walking | cycling | rail | live
default driving
The mode; each has its own network, speeds and access rules. live is driving on the traffic feed's weights when one is applied, and the release's weights when none is.
traffic
query
string
live
Use the traffic feed's weights when one is applied (driving only); the same as profile=live.

Responses

200 — Seconds, row-major from each point to each point.

  • durations_s((number | null[])[])required
  • enginestringrequired
  • pointsnumber[][]required
  • provenanceSourcerequired
    • licensestringrequired
    • namestringrequired
    • releasestringrequired
  • snapped(Snap | null[])required
    • distance_mnumberrequired
    • latnumberrequired
    • lonnumberrequired
    • nodeintegerrequired
  • took_usintegerrequired

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400Bad request.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

More examples

A matrix larger than the plan allows
curl
curl -G "https://api.oslew.com/v1/matrix" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'points=19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.matrix(
    "19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620",
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.matrix("19.4406,-99.2047;19.4326,-99.1332;19.4352,-99.1412;19.3500,-99.1620");
Response
HTTP/1.1 403 Forbidden
content-type: application/json
ratelimit-limit: 5
ratelimit-remaining: 24
ratelimit-reset: 1

{
  "error": "this plan allows at most 3 points on a side; 4 were asked for. A larger matrix is what the next tier is for."
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.