Documentation menu
POST/route/report
Access and price
| Auth | An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Needs a full key; a browser (maps) key is refused. |
|---|---|
| Price | 1 call per request. Class: standard, or premium for truck and ADR work. Published as unit_rules.default in /pricing.json. |
| Premium | When the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true |
What it does
Distance and duration of a route or trace broken down by road class, administrative area, toll, bridge, tunnel and surface.
An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: 1 call per request.
Call it
curl -fsS -X POST "https://api.mapmap.ai/route/report" \
-H "Authorization: Bearer $MAPMAP_KEY" \
-H "Content-Type: application/json" \
-d '{"costing":"truck","costing_options":{"truck":{"height":4,"weight":40}},"shape":[{"lat":51.50748,"lon":-0.12796},{"lat":51.5065,"lon":-0.14335},{"lat":51.50074,"lon":-0.16209},{"lat":51.49511,"lon":-0.18124},{"lat":51.49214,"lon":-0.20101},{"lat":51.49121,"lon":-0.22201},{"lat":51.49052,"lon":-0.24375},{"lat":51.48757,"lon":-0.26428},{"lat":51.4918,"lon":-0.28295}]}'Request body
application/json
Either {"locations": [{lat,lon}, …], "costing": "auto"} (route mode: computes the route internally) or {"shape": [{lat,lon}, …]} / {"encoded_polyline": "…"} (trace mode: reports over an existing trace); exactly one of locations or shape/encoded_polyline. Optional costing_options
Example: From website/public/docs/analysis.md:610
{
"costing": "truck",
"costing_options": {
"truck": {
"height": 4,
"weight": 40
}
},
"shape": [
{
"lat": 51.50748,
"lon": -0.12796
},
{
"lat": 51.5065,
"lon": -0.14335
},
{
"lat": 51.50074,
"lon": -0.16209
},
{
"lat": 51.49511,
"lon": -0.18124
},
{
"lat": 51.49214,
"lon": -0.20101
},
{
"lat": 51.49121,
"lon": -0.22201
},
{
"lat": 51.49052,
"lon": -0.24375
},
{
"lat": 51.48757,
"lon": -0.26428
},
{
"lat": 51.4918,
"lon": -0.28295
}
]
}Responses
{distance_m, duration_s, by_road_class: {<class>: {distance_m, duration_s, edge_count}}, by_admin: [{country_code, country_text, state_code, state_text, distance_m, duration_s, edge_count}], toll: {edge_count, distance_m}, bridge: {…}, tunnel: {…}, by_surface: {<surface>: {distance_m, edge_count}}, edge_count}. Distances in metres, durations in seconds. An edge with no resolvable admin area is grouped under a null-keyed entry in by_admin, never guessed at| Field | Type | Required | Description |
|---|---|---|---|
| bridge | object | no | Distance and edge count on bridges. |
| by_admin | object[] | no | Distance, time and edge count per country and state. |
| by_road_class | object | no | Distance, time and edge count per road class (motorway,
trunk, primary, residential and so on). |
| by_surface | object | no | Distance and edge count per surface class. |
| distance_m | number | no | Total length, metres. |
| duration_s | number | no | Total time, seconds. |
| edge_count | integer | no | Number of road edges matched. |
| toll | object | no | Distance and edge count on toll roads. |
| tunnel | object | no | Distance and edge count in tunnels. |
Example: Recorded from the hosted gateway on 2026-11-05 with a test key: POST /route/report with the request example's shape, by car; lists trimmed to their first items
{
"bridge": {
"distance_m": 1149,
"edge_count": 5
},
"by_admin": [
{
"country_code": "GB",
"country_text": "United Kingdom",
"distance_m": 11891,
"duration_s": 1062.4,
"edge_count": 216,
"state_code": "ENG",
"state_text": "England"
}
],
"by_road_class": {
"motorway": {
"distance_m": 486,
"duration_s": 36.5,
"edge_count": 2
},
"primary": {
"distance_m": 1949,
"duration_s": 231.1,
"edge_count": 54
},
"residential": {
"distance_m": 448,
"duration_s": 66.3,
"edge_count": 20
},
"trunk": {
"distance_m": 9008,
"duration_s": 728.5,
"edge_count": 140
}
},
"by_surface": {
"paved_smooth": {
"distance_m": 11891,
"edge_count": 216
}
},
"distance_m": 11891,
"duration_s": 1062.4,
"edge_count": 216,
"toll": {
"distance_m": 0,
"edge_count": 0
},
"tunnel": {
"distance_m": 313,
"edge_count": 1
}
}locations and a trace givenapplication/problem+json · Problem
unauthorized); the body carries signup, docs and a one-call hint for a free keyapplication/problem+json · Problem
X-PAYMENT). Not problem+jsonapplication/json · X402PaymentRequired
scope-insufficient), a request from an origin the key does not allow (origin-not-allowed), or an account restriction (forbidden)application/problem+json · Problem
text/plain
rate-limited, with Retry-After), or monthly quota exhausted with no payment path (quota-exceeded)application/problem+json · Problem
application/problem+json · Problem
request-timeout)application/problem+json · Problem
Error bodies follow the shared problem model documented on API conventions.
Also under Routing
Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_route_report