# Maps route matrix

`POST /maps/matrix` · Rivier · maps

Travel times and distances from each source to each target (at most 25 points in all, 10 with live traffic), for choosing the nearest or planning a round.

- Scope: maps:read
- Mcp: rivier_maps_matrix
- Graphql: Query.mapsRouteMatrix
- Sdk: maps.route.matrix
- Cli: maps route matrix

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "lng": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        },
        "required": [
          "lat",
          "lng"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 24
    },
    "targets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "lng": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        },
        "required": [
          "lat",
          "lng"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 24
    },
    "mode": {
      "type": "string",
      "enum": [
        "driving",
        "driving-traffic",
        "walking",
        "cycling"
      ],
      "default": "driving",
      "description": "at most 25 points in all, sources and targets together (10 with driving-traffic)"
    }
  },
  "required": [
    "sources",
    "targets"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/maps/matrix' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "sources": [
    {
      "lat": 0,
      "lng": 0
    }
  ],
  "targets": [
    {
      "lat": 0,
      "lng": 0
    }
  ]
}'
```
