Skip to content

50,000 free calls a month, card-free. Get an API key →

Documentation menu
docs / api / post-matrix
routing

POST/matrix

API key required, sent as Authorization: Bearer snk_… or ?api_key=snk_….

Call it

bash
curl -fsS -X POST "https://api.mapmap.ai/matrix" \
  -H "Authorization: Bearer $MAPMAP_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json

Request body

application/json

Valhalla matrix request JSON: sources, targets, costing, optional units and costing_options. Scenario analysis: optional exclude_polygons; areas whose intersecting roads are avoided, as a JSON array of rings of [lon, lat] pairs (note the lon-first order), e.g. [[[-0.1,51.5],[-0.11,51.5],[-0.11,51.52]]], and exclude_locations, {lat, lon} objects each mapped to its nearest road(s), which are then excluded, so "close this bridge and recompute the matrix" is one request. Valhalla engine only: a GraphHopper-backed deployment ignores both fields

The OpenAPI document declares this body as a free-form JSON object with no field list, so there is nothing here to generate a table from. The prose above is what the gateway states about it; the raw document is the authority.

Responses

200{durations, distances}: row-major seconds and metres, null when unreachable
400Invalid request
401Missing or invalid API key
422More than 10,000 source×target elements, or a source/target pair further apart than the deployment's configured max_matrix_distance (SN_ENGINE_MAX_MATRIX_DISTANCE_M; 400 km by default, 1,500 km on the hosted gateway; not chunkable around). The span refusal names the offending pair as furthest_pair: {source_index, target_index} and carries max_span_km, span_km, limit_env, engine_setting and self_host_docs
429Quota or rate limit exceeded
502Upstream routing engine failed

Error bodies follow the shared problem model documented on API conventions.

Also under routing

Generated from https://api.mapmap.ai/openapi.json on 2026-09-17 · operationId post_matrix