---
title: "Finds the least-cost meeting point of several locations (see module docs)."
method: POST
path: "/centroid"
tags: ["routing"]
---

# Finds the least-cost meeting point of several locations (see module docs).

`POST /centroid`

## Request

- Base URL: `https://api.mapmap.ai`
- URL: `https://api.mapmap.ai/centroid`
- Auth: one of:
  - HTTP bearer
  - API key in query parameter `api_key`

## Request body

- object

## Response `200`

A 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

- object

## Other responses

- `400`: Invalid request, or fewer than two locations (Valhalla error_code 120)
- `401`: Missing or invalid API key
- `429`: Quota or rate limit exceeded
- `501`: SN_ROUTING_ENGINE=graphhopper: GraphHopper has no centroid service
- `502`: Upstream routing engine failed

---

[API](https://skmtc.dev/mapmap/apis/sn-gateway.md) · [All operations](https://skmtc.dev/mapmap/apis/sn-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/mapmap/apis/sn-gateway/revisions/2293be8b4c38?raw)
