Skip to content
Documentation menu
docs / api / post-elevation-along
Elevation

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

What it does

Along-route elevation profile endpoint.

An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: A flat 5 calls.

Call it

bash
curl -fsS -X POST "https://api.mapmap.ai/elevation/along" \
  -H "Authorization: Bearer $MAPMAP_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json

Request body

application/json

Along-route elevation profile: a route (geometry_polyline6, or the full route response POST /route returns), and at most one of interval_m (default 100 m) or sample_count

Example: From website/public/docs/analysis.md:1006, with a polyline6 recorded from GET /route/v1 on 2026-11-05

json
{
  "geometry_polyline6": "{swfaBl_yF[gJWuBSsBM_D@sCLuBXyA^}Ap@cBb@aAb@m@^]PGb@CfANnA\\x@\\x@r@~AlCxAh@pAHfAArPsAvBs@`H}BbIwCfLsFnCmAxAsDn@[pAi@~C_BnH}CvM}ElFgBtEsBhHwCtHeCvAa@dBe@xGyBzFeB|@YdEmAdHaBrJaBbCa@`Hg@|AK|Ls@vUqAjBKpIs@vAKdFS~BKtFWpDKbE@|JNdCD`DHfA@hB@fGNvDb@b[hC`GV|BhAzI^|AHh@BpFKbBE~@AnCCfCE`BHtFRD{IBqBFgGSGe@[_@c@We@Se@Qc@Me@Ig@Eg@Cg@Ag@FkGAi@Cc@E_@I]K[K_@I[C[AYRaSBm@Hq@Nm@Ri@Vg@Xa@ZYNG",
  "interval_m": 200
}

Responses

200{samples: [{distance_m, lat, lon, elevation_m, source, resolution_m, grade_percent}], total_distance_m, total_ascent_m, total_descent_m, coverage_fraction, sample_count}. grade_percent on sample i is the percent grade of the segment ending at i (null on sample 0, and whenever either endpoint lacks elevation). total_ascent_m/total_descent_m are null (not 0) when no consecutive pair of samples both have elevation
FieldTypeRequiredDescription
coverage_fractionnumbernoShare of samples with elevation data, 0 to 1.
sample_countintegernoNumber of samples.
samplesobject[]noSamples at the requested interval: distance_m, lat, lon, elevation_m, grade_percent and resolution_m.
total_ascent_mnumbernoTotal climb, metres.
total_descent_mnumbernoTotal descent, metres.
total_distance_mnumbernoLength of the shape, metres.

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

json
{
  "coverage_fraction": 1,
  "sample_count": 6,
  "samples": [
    {
      "distance_m": 0,
      "elevation_m": 13.55,
      "grade_percent": null,
      "lat": 51.507534,
      "lon": -0.128007,
      "resolution_m": 30,
      "source": "mapzen-terrain-tiles"
    },
    {
      "distance_m": 186.9,
      "elevation_m": 17.57,
      "grade_percent": 2.2,
      "lat": 51.50632953536382,
      "lon": -0.1271426854452161,
      "resolution_m": 30,
      "source": "mapzen-terrain-tiles"
    }
  ],
  "total_ascent_m": 7.7,
  "total_descent_m": 4.1,
  "total_distance_m": 934.5
}
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

501Elevation not enabled on this deployment (SN_ELEVATION_ENABLED unset; the hosted gateway sets it true: this is a self-hosting gate for a Valhalla with no DEM tiles staged)

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 Elevation

Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_elevation_along