Skip to content
Documentation menu
docs / api / post-route-along
Routing

POST/route/along

Access and price

AuthAn API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Needs a full key; a browser (maps) key is refused.
PriceA flat 10 calls, whatever max_results asks for. Class: standard, or premium for truck and ADR work. Published as unit_rules.along_route in /pricing.json.
PremiumWhen the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true

What it does

Places along a route matching a query, each priced with its real detour through the routing engine.

An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: A flat 10 calls, whatever max_results asks for.

Call it

bash
curl -fsS -X POST "https://api.mapmap.ai/route/along" \
  -H "Authorization: Bearer $MAPMAP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"costing":"truck","costing_options":{"truck":{"height":4,"weight":40}},"destination":{"lat":52.4862,"lon":-1.8904},"max_detour_minutes":15,"max_results":2,"origin":{"lat":51.1279,"lon":1.3134},"query":"diesel"}'

Request body

application/json

Along-route search: a route (geometry_polyline6, or origin + destination + costing), a free-text query, optional max_detour_minutes (default 10), max_results (default 5, max 25), source (geocode default | places), category (an OSM category token for geocode, the customer taxonomy for places), sort (cheapest_diesel | cheapest_petrol, fuel-enriched results by price then detour), Valhalla costing_options and an optional top-level adr profile

Example: From website/public/docs/analysis.md:347

json
{
  "costing": "truck",
  "costing_options": {
    "truck": {
      "height": 4,
      "weight": 40
    }
  },
  "destination": {
    "lat": 52.4862,
    "lon": -1.8904
  },
  "max_detour_minutes": 15,
  "max_results": 2,
  "origin": {
    "lat": 51.1279,
    "lon": 1.3134
  },
  "query": "diesel"
}

Responses

200Places along the route, each with its honest engine-computed detour: {query, source, costing, route, max_detour_minutes, candidates: {considered, costed, cap}, results[]: {place, detour_minutes, detour_km, along_route_position, off_route_m}}, sorted by detour. When the geocode source browsed the first-party index by category (an explicit category, or a query that is entirely category phrases (fuel, petrol station, coffee near me), which promotes automatically), the response also carries matched_categories naming the normalised tokens browsed. With the fuel-price store configured (SN_FUEL_PRICES), fuel-station results also carry fuel_prices, fuel_brand and fuel_updated_at, and the response a fuel_attribution string
FieldTypeRequiredDescription
candidatesobjectnoHow many candidates were found near the route (considered), how many had their detour computed (costed) and the cap.
charging_attributionstringnoCharge point data attribution, present when a result carries charger data.
costingstringnoThe costing the route and detours were computed with.
eta_calibrationobjectnoThe typical-delay calibration applied to the route times.
fuel_attributionstringnoFuel price attribution, present when a result carries a price.
matched_categoriesstring[]noCategories the query was understood as. Present when a category browse ran.
max_detour_minutesnumbernoThe detour ceiling applied, in minutes.
querystringnoThe query as sent.
resultsobject[]noPlaces within the detour ceiling, smallest detour first: the place, with detour_s, detour_minutes, detour_km, off_route_m and along_route_position (0 to 1).
routeobjectnoThe base route: distance_m, duration_s and length_m.
sourcestringnoWhere candidates came from: geocode (default) or places.

Example: Recorded from the hosted gateway on 2026-11-05 with a test key: POST /route/along, coffee between Trafalgar Square and St Paul's by car; lists trimmed to their first items

json
{
  "candidates": {
    "cap": 25,
    "considered": 31,
    "costed": 25
  },
  "costing": "auto",
  "eta_calibration": {
    "applied": true,
    "cells_calibrated": 51,
    "cells_not_walked": 0,
    "cells_unchanged": 0,
    "method": "gb_typical_delay_v1",
    "note": "Local roads in Great Britain carry no live traffic data, so the time on them includes the junction and congestion delay a typical car meets at this time of day, from Department for Transport statistics, on top of the routing engine's free-flowing time: the same delay POST /route adds, applied to the path each cell was costed on. It is a typical figure, not live traffic. Motorways, roads covered by National Highways traffic data and roads outside Great Britain keep the engine's own time.",
    "period": "all_day",
    "sources": [
      "Department for Transport, tables CGN0503 and CGN0504: average speed and delay on local 'A' roads in England, urban and rural, by time of day, rolling year to June 2026"
    ]
  },
  "matched_categories": [
    "cafe"
  ],
  "max_detour_minutes": 5,
  "query": "coffee",
  "results": [
    {
      "along_route_position": 0.459,
      "detour_km": 0.04,
      "detour_minutes": 0.2,
      "detour_s": 9,
      "off_route_m": 19,
      "place": {
        "label": "The Garrick, Aldwych 69, WC2B 4RR, London, Knepp Wildland, United Kingdom",
        "lat": 51.5134807,
        "lon": -0.1165232,
        "name": "The Garrick",
        "type": "cafe"
      }
    },
    {
      "along_route_position": 0.025,
      "detour_km": 0.34,
      "detour_minutes": 0.8,
      "detour_s": 49,
      "off_route_m": 42,
      "place": {
        "label": "Costa, London, Knepp Wildland, United Kingdom",
        "lat": 51.507500500000006,
        "lon": -0.1267675,
        "name": "Costa",
        "type": "cafe"
      }
    }
  ],
  "route": {
    "distance_m": 2477,
    "duration_s": 413.753,
    "length_m": 2476
  },
  "source": "geocode"
}
400Invalid request

application/problem+json · Problem

401Missing or invalid API key. Also: No key, or a missing, malformed, unknown, revoked or expired one (unauthorized); the body carries signup, docs and a one-call hint for a free key

application/problem+json · Problem

402Beyond the included volume with no way to pay this call: an x402 body naming how to pay (provisional key past its allowance, prepaid balance below the price, or a rejected X-PAYMENT). Not problem+json

application/json · X402PaymentRequired

403The key may not call this: a browser key outside its scope (scope-insufficient), a request from an origin the key does not allow (origin-not-allowed), or an account restriction (forbidden)

application/problem+json · Problem

404source: "places" on a gateway without customer places

application/problem+json · Problem

413The request declares a body larger than 1048576 bytes (plain text, not problem+json)

text/plain

429Quota or rate limit exceeded. Also: Per-key rate limit (rate-limited, with Retry-After), or monthly quota exhausted with no payment path (quota-exceeded)

application/problem+json · Problem

501source: "geocode" on a gateway without a geocoder (SN_PHOTON_URL unset), or an explicit category on a gateway without the first-party geocode index (SN_GEOCODE_DIR unset; urn:sn-gateway:problem:reverse-filtering-not-enabled, the same feature-detect status GET /geocode/reverse uses for its first-party-only filters). A category *promoted* from the query degrades to free-text search instead of failing

application/problem+json · Problem

502Upstream routing engine or geocoder failed

application/problem+json · Problem

504The request did not finish within the gateway's request deadline (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_along