---
title: "Travel-time matrix."
method: POST
path: "/directions-matrix/v1"
tags: ["Routing"]
---

# Travel-time matrix.

`POST /directions-matrix/v1`

## Request

- Base URL: `https://api.rijwind.com`
- URL: `https://api.rijwind.com/directions-matrix/v1`
- Auth: HTTP bearer

Calculate the travel time and distance between every source and every target — the cost grows with `M × N`, the number of pairs.

**Quota cost:** `M × N` units per call (`M = sources`, `N = targets`). Capped at `M × N ≤ 2500`; requests beyond that return 400 without charging quota.

## Request body

- MatrixRequest
  - `costing` 'auto' | 'bicycle' | 'pedestrian', required: Routing profile. `auto` (car), `bicycle`, or `pedestrian` (foot).
  - `sources` LngLat[], required
    - `lat` number, double, required
    - `lon` number, double, required
  - `targets` LngLat[], required
    - `lat` number, double, required
    - `lon` number, double, required
  - `units` 'kilometers' | 'miles'

## Response `200`

Matrix response.

- MatrixResponse: Matrix response. Outer array indexes sources, inner array indexes targets — `M × N` cells in row-major order.
  - `sourcesToTargets` array[], required
    - MatrixCell[]
      - `distance` number, double, nullable: Distance in the requested units. `null` if the pair is unreachable.
      - `fromIndex` integer, required
      - `time` number, double, nullable: Travel time in seconds. `null` if the pair is unreachable.
      - `toIndex` integer, required
  - `units` string, required

## Other responses

- `400`: Body malformed, costing unsupported, or `M × N > 2500`.
- `401`: Missing, malformed, or revoked API key.
- `429`: Monthly quota exhausted.

---

[API](https://skmtc.dev/rijwind/apis/rijwind-api.md) · [All operations](https://skmtc.dev/rijwind/apis/rijwind-api/llms.txt) · [OpenAPI document](https://skmtc.dev/rijwind/apis/rijwind-api/revisions/01d72fb6aa4d?raw)
