Documentation menu
POST/v1/ev/plan
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 | A flat 10 calls. Class: standard, or premium for truck and ADR work. Published as unit_rules.ev_plan in /pricing.json. |
| Premium | When the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true |
What it does
The algorithm
- Base route. One
autoroute over origin + waypoints + destination, with the request'scosting_optionsverbatim. - Leg sampling. Each manoeuvre of that route becomes one
sn_ev::LegSample: its length and its own average speed, which is finer than a leg summary and so makes the steady-state assumption insn_ev::consumption_over_legsbetter. Manoeuvre-free routes fall back to one sample per leg, and a route with more thanMAX_LEG_SAMPLESmanoeuvres has consecutive ones coalesced. - Elevation, or an honest absence. When elevation is enabled the
gateway's own height service is asked for the elevation at every leg
boundary, and each leg's gain and loss come from its two ends. When
it is not enabled, or the DEM has no coverage, the legs are built
with
sn_ev::LegSample::without_gradient, the consumption model runs flat (the only thing it can do) and the response saysgradient_data: "absent". A gradient is never silently assumed to be zero. - Direct plan.
sn_ev::consumption_over_legsover the whole route fromstart_soc. If the arrival state of charge is at or abovemin_arrival_socand the reserve was never breached, that is the plan: no charger work and no matrix call happen at all. - Candidates. Otherwise, charge points from the store are projected
onto the route (
corridor::nearest_on_route), filtered to those the vehicle can plug into at a rated power inside the corridor budget, and capped atMAX_PLAN_CANDIDATESspread along the route rather than clustered; the/v1/charging/alongcorridor machinery, with a spread instead of a power ranking, because a planner needs reach and a search needs kilowatts. - One matrix. Origin + candidates → candidates + destination, one
(n+1)²matrix through the gateway's own engine with the request's costing options, giving every hop a real driving time and distance: never a crow-flies guess. The caller's waypoints are matrix nodes too, and a hop that spans one is costed through it, because that is the drive the journey makes. - Greedy with lookahead.
crate::ev::plan_stopswalks the route choosing stops so the state of charge never breachesreserve_soc, preferring a stop that finishes the journey, then the furthest one (fewer stops), then the cheapest by driving plus charging time. A charger from which nothing further can be reached even on a full battery is refused rather than taken. At most eight passes. - Final geometry. The chosen stops are merged with the waypoints in route order and the route is recomputed through them, so the geometry returned is the journey actually described.
- Or an honest no. When no plan exists (a charger desert, a
connector mismatch, a gap wider than the vehicle's range), the answer
is a 200 with
feasible: false, the named cause, and the furthest point on the route the vehicle can actually reach. Never a fabricated plan.
Stated limitations
A hop's energy is sliced out of the base route's legs and the detour
surplus charged as one gradient-unknown leg (see
crate::ev::hop_legs); matrix cells are upper bounds on route cost,
not route costs; the consumption model's own ±15 % motorway bound and
its urban bias are stated in sn_ev; charging curves are best-case,
measured on a warm pack. The plan is a plan, not a promise.
Call it
curl -fsS -X POST "https://api.mapmap.ai/v1/ev/plan" \
-H "Authorization: Bearer $MAPMAP_KEY" \
-H "Content-Type: application/json" \
-d '{"connectors":["ccs"],"destination":{"lat":55.95,"lon":-3.19},"min_arrival_soc":0.2,"min_kw":50,"origin":{"lat":51.5,"lon":-0.12},"profile":"small_hatch","reserve_soc":0.15,"start_soc":0.9}'Request body
application/json
EV journey plan: origin + destination (+ optional waypoints), a vehicle (profile: "small_hatch" | "saloon" | "suv" | "van", or an inline object of EvProfile fields over a base), start_soc (default 0.9), min_arrival_soc (default 0.1), reserve_soc (default 0.1, the mid-route floor), a connectors filter, min_kw, ambient_temperature_c, max_detour_minutes (default 15, max 120) and Valhalla costing_options (the costing is always auto)
Example: From website/public/docs/analysis.md:1737
{
"connectors": [
"ccs"
],
"destination": {
"lat": 55.95,
"lon": -3.19
},
"min_arrival_soc": 0.2,
"min_kw": 50,
"origin": {
"lat": 51.5,
"lon": -0.12
},
"profile": "small_hatch",
"reserve_soc": 0.15,
"start_soc": 0.9
}Responses
{feasible, plan: {stops, total_drive_s, total_charge_s, total_duration_s, total_distance_m, start_soc, arrival_soc, min_arrival_soc, reserve_soc, energy_kwh}, stops[]: {charger_id, name, operator, source, lat, lon, connector: {standard, power_kw, dc, power_kw_source; derived when the feed did not publish the rating}, charger_kw, arrive_soc, depart_soc, charge_s, detour_s, along_route_position, off_route_m, status, status_live}, legs[]: {from, to, duration_s, distance_m, start_soc, end_soc, min_soc, consumed_wh, regen_wh}, soc_trace[], gradient_data: "complete" | "partial" | "absent", gradient: {legs_total, legs_with_gradient, fraction}, route: {duration_s, distance_m, length_m}, geometry_polyline6, coverage_note (ALWAYS present), sources[], availability: {live, note}, provenance: {profile, availability, consumption_model, charge_model}, charging_attribution}. When feasible is false the answer carries reason: {code, message} and furthest_reachable, never a fabricated stop list| Field | Type | Required | Description |
|---|---|---|---|
| availability | object | no | Whether statuses are live. |
| candidates | object | no | Charge points considered in the corridor, usable and costed. |
| costing | string | no | The costing used. |
| coverage_note | string | no | Which operators are covered. |
| eta_calibration | object | no | Whether a typical-delay calibration applies to the drive times. |
| feasible | boolean | no | Whether the journey can be made. When not, the plan names the cause and the furthest reachable point. |
| geometry_polyline6 | string | no | The route shape, precision-6 encoded polyline. |
| gradient | object | no | How much of the route had gradient data for the consumption model. |
| gradient_data | string | no | complete, partial or none. |
| legs | object[] | no | Drive legs between stops: distance_m, duration_s,
consumed_wh and the state of charge at each end. |
| plan | object | no | The plan: arrival_soc, energy_kwh, the floors applied and
the totals. |
| provenance | object | no | The models behind the plan: consumption, charge curve and data. |
| route | object | no | The whole route: distance_m, duration_s and length_m. |
| soc_trace | object[] | no | State of charge at the origin, each stop and the destination. |
| sources | object[] | no | Each charger data source with its count and coverage note. |
| stops | object[] | no | Charge stops in order, with the charger, arrive_soc,
depart_soc and charge_s. |
| vehicle | object | no | The vehicle profile used: name, usable_kwh and connectors. |
Example: Recorded from the hosted gateway on 2026-11-05 with a test key: POST /v1/ev/plan, Trafalgar Square to Brighton in a small hatchback; lists trimmed to their first items
{
"availability": {
"live": false,
"note": "No live availability feed is configured, so every status is the value captured when the dataset was last ingested, not what the bay is doing now. Supply your operator's OCPI feed to make these live."
},
"candidates": {
"cap": 20,
"costed": 0,
"in_corridor": 0,
"usable": 0
},
"costing": "auto",
"coverage_note": "Covers 6052 charge point(s) (6054 charging position(s)) from char.gy (on-street lamppost charging). Charge points from any operator not listed are absent from this dataset entirely, so an empty result means \"none from these operators\", never \"no chargers here\".",
"eta_calibration": {
"applied": false,
"method": "gb_typical_delay_v1",
"note": "The planner's drive times and energy use are on the routing engine's free-flowing speeds. Car times from POST /route in Great Britain include the typical delay on local roads, so in towns the drive can take longer than this plan says; charging times are unaffected.",
"travel_times": "free_flow"
},
"feasible": true,
"geometry_polyline6": "{swfaBl_yF[gJWuBSsBM_D@sCLuBXyA^}Ap@cBb@aAb@m@^]PGb@C",
"gradient": {
"fraction": 1,
"legs_total": 34,
"legs_with_gradient": 34
},
"gradient_data": "complete",
"legs": [
{
"consumed_wh": 9892.8,
"distance_m": 85766,
"duration_s": 5105,
"end_soc": 0.732,
"from": "origin",
"legs_modelled": 35,
"legs_with_gradient": 34,
"min_soc": 0.731,
"regen_wh": 142.9,
"start_soc": 0.9,
"to": "destination"
}
],
"plan": {
"arrival_soc": 0.732,
"energy_kwh": 9.75,
"feasible": true,
"min_arrival_soc": 0.2,
"reserve_soc": 0.15,
"route_duration_s": 5105,
"start_soc": 0.9,
"stops": 0,
"total_charge_s": 0,
"total_distance_m": 85766,
"total_drive_s": 5105,
"total_duration_s": 5105
},
"provenance": {
"availability": "static_snapshot",
"charge_model": "sn-ev charge-curve integration, capped by the charge point's rated power. Published curves are best case: a cold pack charges more slowly than this.",
"consumption_model": "sn-ev road-load model (UNECE GTR No. 15 decomposition); ±15 % on constant-speed motorway travel, under-reads in stop-start traffic",
"planner": "static planner over the operator feeds this deployment ingests; bring your own OCPI feed for live availability",
"profile": {
"profile": "small_hatch",
"source": "default"
}
},
"route": {
"distance_m": 85766,
"duration_s": 5105,
"length_m": 85758
},
"soc_trace": [
{
"along_route_position": 0,
"at": "origin",
"soc": 0.9
},
{
"along_route_position": 1,
"at": "destination",
"departing_soc": null,
"soc": 0.732
}
],
"sources": [
{
"chargers": 6052,
"coverage_note": "On-street lamppost charging in char.gy's partner boroughs only: no rapid hubs, no forecourts and no other operator's network.",
"licence": "Public Charge Point Regulations 2023",
"operator": "char.gy (on-street lamppost charging)",
"source_id": "chargy"
}
],
"stops": [],
"vehicle": {
"connectors": [
"type2",
"ccs2"
],
"name": "small hatchback (Volkswagen ID.3 Pro 58 kWh)",
"usable_kwh": 58
}
}application/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
application/problem+json · Problem
request-timeout)application/problem+json · Problem
Error bodies follow the shared problem model documented on API conventions.
Also under EV charging
Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_ev_plan