Skip to content

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

Documentation menu
docs / api / post-centroid
routing

POST/centroid

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

Call it

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

Request body

application/json

Valhalla centroid request JSON: the same shape as POST /route; locations (at least two), costing, optional costing_options. "Meet in the middle": finds the point in the road graph where paths from every location converge for the least total cost, and returns one path per location to that shared point. Not available from Google, Mapbox, HERE, TomTom or NextBillion

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

200A Valhalla route response: trip is the path from locations[0] to the centroid, and each alternates[i] is the path from locations[i+1] to the SAME centroid; every path's last location shares an identical lat/lon, which is the meeting point. costing (e.g. truck) applies identically to every participant's path
400Invalid request, or fewer than two locations (Valhalla error_code 120)
401Missing or invalid API key
429Quota or rate limit exceeded
501SN_ROUTING_ENGINE=graphhopper: GraphHopper has no centroid service
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_centroid