Skip to content
Documentation menu
docs / api / post-locate
Routing

POST/locate

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.
Price1 call per request. Class: standard, or premium for truck and ADR work. Published as unit_rules.default in /pricing.json.
PremiumWhen the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true

What it does

Snaps each location to the road graph.

An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: 1 call per request.

Call it

bash
curl -fsS -X POST "https://api.mapmap.ai/locate" \
  -H "Authorization: Bearer $MAPMAP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"costing":"auto","locations":[{"lat":51.5074,"lon":-0.1278}],"verbose":true}'

Request body

application/json

Valhalla locate request JSON: locations, costing, optional costing_options, verbose (default false) and units. Each location may carry heading (degrees clockwise from north) and heading_tolerance (degrees either side, default 60): only edges whose direction of travel at the point is within the tolerance are reported, so at a junction the heading picks the road and direction you are on. When no edge is within the tolerance the location's edges list is empty (no fallback to the nearest edge). radius (metres) and search_filter narrow or widen the search as on /route. exclude_locations on /route, /matrix and /isochrone are matched by the same search and take the same fields: with heading an exclusion closes one direction only, and a point within about 5 m of a junction closes every road at that junction

Example: From website/public/docs/api-reference.md:2240

json
{
  "costing": "auto",
  "locations": [
    {
      "lat": 51.5074,
      "lon": -0.1278
    }
  ],
  "verbose": true
}

Responses

200One entry per input location: the closest edges (way id, correlated point, side of street, percent along) and, in verbose mode, nodes with a dense administrative/access/geometry attribute tree. A location with no nearby graph edges (open sea, an unmapped area) answers an entry with empty edges/nodes arrays, never an error

Example: Recorded from the hosted gateway on 2026-11-05 with a test key: POST /locate with the request example; lists trimmed to their first items

json
[
  {
    "edges": [
      {
        "access_restrictions": [],
        "bounding_circle": {
          "lat": 51.507498,
          "lon": -0.127905,
          "radius": 9
        },
        "correlated_lat": 51.507478,
        "correlated_lon": -0.127964,
        "distance": 14.3,
        "edge": {
          "access": {
            "HOV": true,
            "bicycle": true,
            "bus": true,
            "car": true,
            "emergency": false,
            "moped": true,
            "motorcycle": true,
            "pedestrian": true,
            "taxi": true,
            "truck": true,
            "wheelchair": true
          },
          "access_restriction": false,
          "bike_network": true,
          "bridge": false,
          "classification": {
            "classification": "primary",
            "internal": false,
            "link": false,
            "surface": "paved_smooth",
            "use": "road"
          },
          "country_crossing": false,
          "cycle_lane": "none",
          "deadend": false,
          "destination_only": false,
          "destination_only_hgv": false,
          "end_node": {
            "id": 297350,
            "level": 0,
            "tile_id": 3194,
            "value": 9977410380752
          },
          "end_restriction": {
            "HOV": false,
            "bicycle": false,
            "bus": false,
            "car": false,
            "emergency": false,
            "moped": false,
            "motorcycle": false,
            "pedestrian": false,
            "taxi": false,
            "truck": false,
            "wheelchair": false
          },
          "forward": true,
          "geo_attributes": {
            "curvature": 15,
            "length": 17,
            "max_down_slope": -4,
            "max_up_slope": 0,
            "weighted_grade": -3.33
          },
          "has_sign": false,
          "lane_count": 3,
          "not_thru": false,
          "part_of_complex_restriction": false,
          "round_about": true,
          "sac_scale": "none",
          "sidewalk_left": false,
          "sidewalk_right": false,
          "speeds": {
            "constrained_flow": 0,
            "default": 32,
            "free_flow": 0,
            "predicted": false,
            "type": "tagged"
          },
          "start_restriction": {
            "HOV": false,
            "bicycle": false,
            "bus": false,
            "car": false,
            "emergency": false,
            "moped": false,
            "motorcycle": false,
            "pedestrian": false,
            "taxi": false,
            "truck": false,
            "wheelchair": false
          },
          "stop_sign": false,
          "toll": false,
          "traffic_signal": false,
          "truck_route": false,
          "tunnel": false,
          "yield_sign": false
        },
        "edge_id": {
          "id": 701784,
          "level": 0,
          "tile_id": 3194,
          "value": 23547963532240
        },
        "edge_info": {
          "bike_network": {
            "local": true,
            "mountain": false,
            "national": false,
            "regional": false
          },
          "mean_elevation": 12,
          "names": [
            "Charing Cross"
          ],
          "shape": "knwfaBv~xFe@]k@u@]i@]o@_@iA]yA",
          "speed_limit": 32,
          "speed_limit_type": "zone",
          "way_id": 43118738
        },
        "heading": 45.8,
        "inbound_reach": 50,
        "linear_reference": "K//osySgpVREAAAQAAsUVD8=",
        "live_speed": {},
        "outbound_reach": 50,
        "percent_along": 0.24819,
        "predicted_speeds": [],
        "shoulder": false,
        "side_of_street": "right"
      }
    ],
    "input_lat": 51.5074,
    "input_lon": -0.1278,
    "nodes": []
  }
]
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

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

501SN_ROUTING_ENGINE=graphhopper: GraphHopper has no locate service

application/problem+json · Problem

502Upstream routing engine 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_locate