Skip to content

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

Documentation menu
docs / examples / route-rationale
Example

Why this route

Ask a route to explain itself. The gateway re-routes with each declared constraint relaxed and reports the ones that provably changed the geometry, with the place the routes part ways. Derived by the engine, not written by a language model.

bash
export BASE=https://api.mapmap.ai
export API_KEY=snk_...

curl -fsS -X POST "$BASE/route" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "locations": [
    { "lat": 51.5072, "lon": -0.1276 },
    { "lat": 52.4862, "lon": -1.8904 }
  ],
  "costing": "bicycle",
  "costing_options": { "bicycle": { "use_hills": 0.1 } },
  "rationale": true
}'

# The response gains a rationale block: each entry names the constraint, the
# diverging span, what it cost in time and distance, and carries
# basis: "route_divergence" plus the caveats that bound the claim. Every
# block also carries a metering object saying what the extra probes cost.