---
title: "Compute a travel-time and distance matrix"
method: POST
path: "/matrix"
tags: ["navigation"]
---

# Compute a travel-time and distance matrix

`POST /matrix`

## Request

- Base URL: `https://api.mapsource.io`
- URL: `https://api.mapsource.io/matrix`
- Auth: HTTP bearer

Returns travel times and distances for up to 625 origin-destination pairs per request.

When to use: Compare destinations or build a travel-time matrix for analysis.

When not to use: Use route when directions or route geometry are required.

## Request body

- object
  - `sources` unknown[], required: Origins.
    - unknown
  - `targets` unknown[]: Destinations. Omit for the square matrix of sources against themselves.
    - unknown
  - `costing` 'auto' | 'bicycle' | 'pedestrian' | 'truck' | 'motor_scooter' | 'bus': Travel mode.

## Response `200`

Compute a travel-time and distance matrix

- object
  - `schema` string
  - `profile` string: The costing model that produced this result.
  - `units` object
    - `distance` string
    - `duration` string
  - `graph` object
    - `engine` string
    - `tilesetBuiltAt` string, nullable
  - `geometryAvailable` 'inline' | 'handle': Where the geometry is. handle means read geometryRef.
  - `meta` object
    - `requestId` string
    - `computeMs` integer
    - `requestedAt` string, date-time
    - `sources` object[]
      - `dataset` string
      - `observedAt` string, nullable
      - `license` string
    - `freshness` object, nullable
    - `licenses` string[]
    - `attribution` string[]
  - `costing` string
  - `sources` unknown[]
    - unknown
  - `targets` unknown[]
    - unknown
  - `durationSeconds` unknown[]: Rows of seconds, source by target. null where no route exists.
    - unknown
  - `distanceKm` unknown[]
    - unknown
  - `pairs` unknown[]: Reachable origin-destination pairs sorted by duration. Unreachable pairs are omitted.
    - unknown

## Other responses

- `400`: Error with a stable machine code.
- `401`: Error with a stable machine code.
- `429`: Error with a stable machine code.
- `500`: Error with a stable machine code.

---

[API](https://skmtc.dev/mapsource/apis/mapsource-overpass-api.md) · [All operations](https://skmtc.dev/mapsource/apis/mapsource-overpass-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mapsource/apis/mapsource-overpass-api/revisions/8af8c2769e7b?raw)
