API reference
Plan an EV road trip with charging stops, and look up chargers. These are the endpoints the embeddable planner itself calls. No API key and no sign-in: every endpoint is public and rate-limited per caller IP. Every error response is JSON with a single error string that is safe to show to a person.
The basics
- Base URLs:
/(production). The embed widget calls the same paths on whichever site serves it. - No API key or sign-in. Limits are per caller IP and reset on their own.
- Errors are JSON,
{ "error": "..." }, with a message that is safe to show to a person. A 429 always says whether it was this caller’s limit or a shared provider’s daily quota. - Distances are kilometres, times are hours unless a field says minutes, battery levels are percentages from 0 to 100.
- Machine-readable OpenAPI 3.1 description: /api/openapi.json (import it into Postman, Insomnia or a client generator).
Plan a trip
post/api/plan
Geocodes the origin, destination and any waypoints, routes between them, finds chargers along the way that the chosen vehicle can plug into, and returns three plans: optimal (shortest total time), fewer and fewest (fewer charging stops). Routes and chargers are cached for 7 days per origin/destination pair, so repeat trips are fast. Set ephemeralPlan: true for a driver-started update that must not read or write the route cache.
Send Accept: application/x-ndjson to stream the answer instead: one JSON object per line, in order route, chargers, plan (each with a stage field and the same fields as the combined response), so the route can be drawn before the charging plan is ready. In a stream, a failure after the response has started arrives as a final {"stage":"error","error":"..."} line with status 200.
- Rate limit
- 20 plan units per 5 minutes per IP. A request costs 1 unit plus 1 per waypoint. Trips that need new routing also draw on the free providers' shared daily quotas; when those run out the response is a 429 naming the daily limit.
- Cross-origin
- Yes, callable from a page on any origin (CORS).
Request body
| Field | Type | Description |
|---|---|---|
originQueryrequired | string | Where the trip starts: an address or place name. |
destinationQueryrequired | string | Where the trip ends. |
vehicleModelIdrequired | string | Which car, from the built-in catalogue.One of 33 values, for example |
startSoCPercentrequired | number | Battery at departure, 0-100. |
minSoCAtChargerPercentrequired | number | Never arrive at a charger below this battery level. |
minSoCAtDestinationPercentrequired | number | Arrive at the destination with at least this much battery. |
relativeSpeedPercent | number | Drive faster or slower than the speed limit, as a percentage of it. (default 100) |
outsideTempC | number | Outside temperature in Celsius. Defaults to a seasonal estimate. |
useWeatherForecast | boolean | Use forecast temperature along the route instead of outsideTempC. A dated departure enables this automatically. (default false) |
departureAt | string | Departure date and clock time with an explicit UTC offset. Forecast samples are taken at approximate drive-time arrival along the route; unavailable portions use the manual or seasonal temperature. |
ephemeralPlan | boolean | Skip route-cache reads and writes for this request, including its coordinates. (default false) |
batteryHealthPercent | number | Usable capacity as a percentage of new. (default 100) |
realConsumptionWhPerKm | number | The driver's own measured consumption, overriding the model's. |
maxChargeLimitPercent | number | Never charge above this battery level at a stop. (1 to 100, default 100) |
chargerFilters | ChargerFilters | Which chargers the planner may use. |
avoidTollways | boolean | (default false) |
avoidHighways | boolean | (default false) |
avoidFerries | boolean | (default false) |
avoidBorders | boolean | (default false) |
waypoints | Waypoint[] | Up to 5 stops between origin and destination, in order. (at most 5 items) |
includeRoundTrip | boolean | Also check whether the driver can get home from the destination without charging there first, using the return leg's own route, elevation and available forecast weather. Adds one more routing lookup. (default false) |
excludedChargerIds | string[] | Charger ids the driver explicitly replaced; the optimizer will not select them again. (at most 20 items) |
ChargerFilters
| Field | Type | Description |
|---|---|---|
preferredNetworks | string[] | Network names, as in a charger's networkName. (at most 50 items) |
networkFilterMode | "include" | "exclude" | Use only preferredNetworks, or avoid them. |
minStallCount | number | (at least 0) |
minChargerPowerKw | number | (at least 0) |
Waypoint
| Field | Type | Description |
|---|---|---|
query | string | An address or place name. |
pinnedCharger | Charger | |
targetSoCPercent | number | Charge up to this level at a pinned charger. (default 100) |
dwellMinutes | number | Time spent at an address stop, added to the trip time. |
Example request
curl -X POST '//api/plan' \
-H 'Content-Type: application/json' \
-d '{"originQuery":"Los Angeles, CA","destinationQuery":"Las Vegas, NV","vehicleModelId":"tesla:model3:2024:lr:awd","startSoCPercent":90,"minSoCAtChargerPercent":10,"minSoCAtDestinationPercent":10}'Response 200
The trip plan.
| Field | Type | Description |
|---|---|---|
originrequired | GeocodedPlace | |
destinationrequired | GeocodedPlace | |
waypointsrequired | GeocodedPlace[] | Where each requested waypoint geocoded to. |
routerequired | Route | |
chargersrequired | Charger[] | Every charger found along the route, before plug filtering. |
planrequired | object | The three plans, one per objective. |
batteryProfiles | object | Battery level along the route for each plan, for a chart. |
steepGradientSegment | object | null | The longest steep climb on the route, if any. |
legElevationEffects | object | Climb and descent per leg between stops, for each plan. |
weatherNote | object | null | The most notable forecast temperature, when useWeatherForecast is on. |
weatherCoverage | "complete" | "partial" | "unavailable" | Coverage of the five route weather samples. Missing forecast segments use the manual or seasonal temperature. |
batteryInsights | object | Elevation-and-battery highlights for each plan: major summits and the lowest predicted battery point. |
regenSummary | object | Route-wide climb/regen energy effect (one value, shared across every plan - it depends only on the route and vehicle). |
reserveTradeoff | object | null | A third trade-off beside stop count: the optimal plan re-run with a higher destination reserve, and the actual difference in time, stops and arrival battery. |
roundTrip | object | null | Present only when the request set includeRoundTrip. |
roundTrips | object | Return-route battery checks for each outbound objective, using that objective's arrival battery. roundTrip is the optimal check for compatibility. |
roundTripStatus | "available" | "unavailable" | "not-applicable" | Present when a round-trip check was requested. The check may be unavailable even when the outbound plan succeeds. |
roundTripWeatherCoverage | "complete" | "partial" | "unavailable" | Weather coverage on the independently routed return leg, when weather-aware planning is enabled. |
roundTripElevationAvailable | boolean | Whether elevation was available on the independently routed return leg. |
planningOutsideTempC | number | The temperature actually used by the energy model, including forecast mode. |
GeocodedPlace
| Field | Type | Description |
|---|---|---|
latrequired | number | (-90 to 90) |
lonrequired | number | (-180 to 180) |
displayNamerequired | string |
Route
| Field | Type | Description |
|---|---|---|
coordinatesrequired | number[][] | The route line as [lon, lat] pairs. |
edgesrequired | object[] | One entry per pair of consecutive coordinates. |
totalDistanceKmrequired | number | |
totalDurationHoursrequired | number | Driving time, without charging. |
elevationAvailablerequired | boolean | False when every elevation provider failed and the plan assumed flat ground. |
usingFallbackRoutingrequired | boolean | True when the backup routing provider was used. |
elevationsrequired | number[] | Metres, one per coordinate. |
Charger
| Field | Type | Description |
|---|---|---|
idrequired | string | |
namerequired | string | |
latrequired | number | (-90 to 90) |
lonrequired | number | (-180 to 180) |
distanceAlongRouteKm | number | |
maxPowerKwrequired | number | (at least 0) |
networkName | string | |
address | string | |
hours | string | |
priceText | string | |
lastConfirmed | string | |
sources | "openchargemap" | "afdc"[] | |
fieldSources | object | |
stallCount | integer | null | |
connections | object[] | |
source | "openchargemap" | "afdc" | "mock" |
TripPlan
| Field | Type | Description |
|---|---|---|
objectiverequired | "optimal" | "fewer" | "fewest" | |
feasiblerequired | boolean | False when no plan meets the battery limits; see warning. |
stopsrequired | ChargingStop[] | Charging stops, in order. |
waypointsrequired | object[] | Where the trip passes each address waypoint. |
totalDriveTimeHoursrequired | number | |
totalChargeTimeHoursrequired | number | |
totalTripTimeHoursrequired | number | |
finalArrivalSoCPercentrequired | number | |
totalDwellTimeHours | number | |
speedAdjustment | object | Present when driving slower would make the trip possible. |
warning | object |
{
"origin": {
"lat": 34.05,
"lon": -118.24,
"displayName": "Los Angeles, Los Angeles County, California, United States"
},
"destination": {
"lat": 36.17,
"lon": -115.15,
"displayName": "Las Vegas, Clark County, Nevada, United States"
},
"waypoints": [],
"route": {
"coordinates": [
[
-118.24,
34.05
],
[
-115.15,
36.17
]
],
"edges": [
{
"distanceKm": 0.05,
"durationHours": 0,
"elevationGainM": 0.75,
"elevationLossM": 0,
"cumulativeDistanceKm": 0.05
}
],
"totalDistanceKm": 434.89,
"totalDurationHours": 4.48,
"elevationAvailable": true,
"usingFallbackRouting": false,
"elevations": [
100.75,
101.5
]
},
"chargers": [
{
"id": "ocm-97637",
"name": "Baker, Ca Supercharger",
"lat": 35.26,
"lon": -116.08,
"distanceAlongRouteKm": 283.45,
"maxPowerKw": 250,
"networkName": "Tesla (Tesla-only charging)",
"stallCount": 40,
"connections": [
{
"plugType": "NACS",
"powerKw": 150
},
{
"plugType": "NACS",
"powerKw": 250
}
],
"source": "openchargemap"
}
],
"plan": {
"optimal": {
"objective": "optimal",
"feasible": true,
"stops": [
{
"chargerId": "ocm-97637",
"chargerName": "Baker, Ca Supercharger",
"plugType": "NACS",
"distanceAlongRouteKm": 283.45,
"arrivalSoCPercent": 20.57,
"departureSoCPercent": 50,
"chargeDurationMinutes": 13.87,
"arrivalTripTimeHours": 2.92
}
],
"waypoints": [],
"totalDriveTimeHours": 4.48,
"totalChargeTimeHours": 0.23,
"totalTripTimeHours": 4.71,
"finalArrivalSoCPercent": 11.22
},
"fewer": {
"objective": "fewer",
"feasible": true,
"stops": [
{
"chargerId": "ocm-97637",
"chargerName": "Baker, Ca Supercharger",
"plugType": "NACS",
"distanceAlongRouteKm": 283.45,
"arrivalSoCPercent": 20.57,
"departureSoCPercent": 50,
"chargeDurationMinutes": 13.87,
"arrivalTripTimeHours": 2.92
}
],
"waypoints": [],
"totalDriveTimeHours": 4.48,
"totalChargeTimeHours": 0.23,
"totalTripTimeHours": 4.71,
"finalArrivalSoCPercent": 11.22
},
"fewest": {
"objective": "fewest",
"feasible": true,
"stops": [
{
"chargerId": "ocm-97637",
"chargerName": "Baker, Ca Supercharger",
"plugType": "NACS",
"distanceAlongRouteKm": 283.45,
"arrivalSoCPercent": 20.57,
"departureSoCPercent": 50,
"chargeDurationMinutes": 13.87,
"arrivalTripTimeHours": 2.92
}
],
"waypoints": [],
"totalDriveTimeHours": 4.48,
"totalChargeTimeHours": 0.23,
"totalTripTimeHours": 4.71,
"finalArrivalSoCPercent": 11.22
}
},
"batteryProfiles": {
"optimal": [
{
"cumulativeDistanceKm": 0,
"socPercent": 90
},
{
"cumulativeDistanceKm": 434.89,
"socPercent": 11.22
}
],
"fewer": [
{
"cumulativeDistanceKm": 0,
"socPercent": 90
},
{
"cumulativeDistanceKm": 434.89,
"socPercent": 11.22
}
],
"fewest": [
{
"cumulativeDistanceKm": 0,
"socPercent": 90
},
{
"cumulativeDistanceKm": 434.89,
"socPercent": 11.22
}
]
},
"steepGradientSegment": null,
"legElevationEffects": {
"optimal": [
{
"fromKm": 0,
"toKm": 283.45,
"elevationGainM": 2111.42,
"elevationLossM": 1929.5,
"extraConsumptionPercent": 12.64
},
{
"fromKm": 283.45,
"toKm": 434.89,
"elevationGainM": 1497.83,
"elevationLossM": 1160.5,
"extraConsumptionPercent": 17.76
}
],
"fewer": [
{
"fromKm": 0,
"toKm": 283.45,
"elevationGainM": 2111.42,
"elevationLossM": 1929.5,
"extraConsumptionPercent": 12.64
},
{
"fromKm": 283.45,
"toKm": 434.89,
"elevationGainM": 1497.83,
"elevationLossM": 1160.5,
"extraConsumptionPercent": 17.76
}
],
"fewest": [
{
"fromKm": 0,
"toKm": 283.45,
"elevationGainM": 2111.42,
"elevationLossM": 1929.5,
"extraConsumptionPercent": 12.64
},
{
"fromKm": 283.45,
"toKm": 434.89,
"elevationGainM": 1497.83,
"elevationLossM": 1160.5,
"extraConsumptionPercent": 17.76
}
]
},
"weatherNote": null,
"planningOutsideTempC": 20
}Errors
| Status | When | Example body |
|---|---|---|
| 400 | The request is malformed: a required field is missing, the vehicle id is unknown, there are more than 5 waypoints, an address could not be found, or the combined route is too long. | { "error": "Could not find a location for \"Atlantis\"." } |
| 422 | There is no driving route between these places (for example, to Hawaii). Retrying gives the same answer. | { "error": "No driving route between Los Angeles, CA and Honolulu, HI." } |
| 429 | Either this caller's rate limit, or a routing/charger provider's free daily quota, has been reached. | { "error": "Too many requests. Try again in a few minutes." } |
| 500 | An unexpected error in this app. Details are in the server log, never in the response. | { "error": "Something went wrong planning this trip. Please try again." } |
| 503 | A routing, charger or geocoding provider is down or timed out. Try again in a few minutes. | { "error": "The trip-planning service is temporarily unavailable upstream. Please try again in a few minutes." } |
Chargers in a map area
get/api/chargers
Every charger inside a bounding box, for a map layer. Below zoom 6 it returns an empty list with zoomTooLow: true and calls nothing upstream. Results are capped at 500; cappedByResultLimit says when the cap was hit, so zooming in shows the rest.
- Rate limit
- Charged per map tile the area covers that is not already cached on the server: 120 tiles per minute and 80 tiles per day per IP. Areas that are fully cached are free. A shared daily Open Charge Map budget also applies; when it runs out the response is a 429.
- Cross-origin
- Same origin only.
Parameters
| Field | Type | Description |
|---|---|---|
minLonrequired | number | West edge. (-180 to 180) |
minLatrequired | number | South edge. (-90 to 90) |
maxLonrequired | number | East edge. Must be greater than minLon. (-180 to 180) |
maxLatrequired | number | North edge. Must be greater than minLat. (-90 to 90) |
zoomrequired | number | The map's current zoom level. |
Example request
curl '//api/chargers?minLon=-116.2&minLat=35.2&maxLon=-116&maxLat=35.3&zoom=12'Response 200
Chargers in the area.
| Field | Type | Description |
|---|---|---|
chargersrequired | AreaCharger[] | |
cappedByResultLimitrequired | boolean | |
zoomTooLowrequired | boolean |
AreaCharger
| Field | Type | Description |
|---|---|---|
idrequired | string | |
namerequired | string | |
latrequired | number | (-90 to 90) |
lonrequired | number | (-180 to 180) |
maxPowerKwrequired | number | |
networkName | string | |
stallCount | integer | null | |
plugTypesrequired | PlugType[] | |
address | string | |
costText | string | |
sourcerequired | "openchargemap" |
{
"chargers": [
{
"id": "ocm-97637",
"name": "Baker, Ca Supercharger",
"lat": 35.26,
"lon": -116.08,
"maxPowerKw": 250,
"networkName": "Tesla (Tesla-only charging)",
"stallCount": 40,
"plugTypes": [
"NACS"
],
"address": "71808 Baker BLVD, Baker, CA",
"costText": "$0.26/kWh; other tariffs for older cars",
"source": "openchargemap"
}
],
"cappedByResultLimit": false,
"zoomTooLow": false
}Errors
| Status | When | Example body |
|---|---|---|
| 400 | A parameter is missing, not a number, or the box is inverted. | { "error": "minLon, minLat, maxLon, maxLat and zoom are required." } |
| 429 | This caller's tile limit, or the shared daily Open Charge Map budget, has been reached. | { "error": "Too many requests. Try again shortly." } |
| 502 | Open Charge Map failed or timed out. | { "error": "Could not load chargers for this area." } |
Nearby station amenities
get/api/chargers/amenities
Amenities within 200 metres of a station from OpenRouteService POIs with one OpenStreetMap Overpass fallback, looked up after planning. An unknown status means neither source confirmed a result; an empty known list means no matching amenities were listed.
- Rate limit
- 12 per minute per IP, plus a shared 1,000-per-day amenities budget.
- Cross-origin
- Yes, callable from a page on any origin (CORS).
Parameters
| Field | Type | Description |
|---|---|---|
latrequired | number | Station latitude in degrees. (-90 to 90) |
lonrequired | number | Station longitude in degrees. (-180 to 180) |
Example request
curl '//api/chargers/amenities?lat=undefined&lon=undefined'Response 200
Nearby amenity categories or an explicit unknown status.
| Field | Type | Description |
|---|---|---|
amenitiesrequired | object |
Errors
| Status | When | Example body |
|---|---|---|
| 400 | Coordinates are missing or outside valid ranges. | { "error": "Invalid coordinates." } |
| 429 | The caller's minute budget was reached. | { "error": "Too many requests. Try again shortly." } |
One charger's details
get/api/chargers/{id}
The full record for one charger: address, network, pricing text, connectors, status, photos and user comments. Use the id from a plan or area response. Known details are retained in the shared server cache and dated if old; browser caching depends on amenity confidence.
- Rate limit
- 30 per minute and 150 per day per IP, counted only for an upstream Open Charge Map call. A shared 600-per-day budget also applies; cached results cost neither budget.
- Cross-origin
- Yes, callable from a page on any origin (CORS).
Parameters
| Field | Type | Description |
|---|---|---|
{id}required | string | A charger id as returned by the other endpoints, ocm- followed by digits. |
Example request
curl '//api/chargers/ocm-97637'Response 200
The charger.
| Field | Type | Description |
|---|---|---|
chargerrequired | ChargerDetail |
ChargerDetail
| Field | Type | Description |
|---|---|---|
idrequired | string | |
namerequired | string | |
latrequired | number | (-90 to 90) |
lonrequired | number | (-180 to 180) |
networkName | string | |
networkUrl | string | |
address | string | |
phone | string | |
usageType | string | |
usageCost | string | |
accessComments | string | Free text; where Open Charge Map records opening hours. |
generalComments | string | |
statusTitle | string | |
isOperational | boolean | |
dateLastVerified | string | |
detailFetchedAt | string | When this full Open Charge Map record was last fetched. |
dateLastStatusUpdate | string | |
stallCount | integer | |
connectionsrequired | object[] | |
photosrequired | object[] | |
commentsrequired | object[] | |
sourceUrlrequired | string | The charger's page on openchargemap.org. |
amenities | object | Nearby amenities from OpenRouteService POIs, OpenStreetMap (Overpass), or explicit Open Charge Map notes. status is "unknown" when the lookup wasn't attempted or failed - never treat that as "none nearby". |
{
"charger": {
"id": "ocm-97637",
"name": "Baker, Ca Supercharger",
"lat": 35.262655,
"lon": -116.08074,
"networkName": "Tesla (Tesla-only charging)",
"address": "71808 Baker BLVD, Baker, CA, 92309-0000",
"usageType": "Public",
"usageCost": "$0.26/kWh; other tariffs for older cars",
"statusTitle": "Operational",
"isOperational": true,
"dateLastVerified": "2024-06-06T12:05:00Z",
"detailFetchedAt": "2026-11-30T12:00:00Z",
"stallCount": 40,
"connections": [
{
"title": "NACS / Tesla Supercharger",
"plugType": "NACS",
"powerKw": 250,
"quantity": 24,
"currentType": "DC",
"status": "Operational"
}
],
"photos": [],
"comments": [],
"sourceUrl": "https://openchargemap.org/site/poi/details/97637"
}
}Response 202
Full details did not arrive within five seconds; the lookup continues in the background.
| Field | Type | Description |
|---|---|---|
errorrequired | string | What went wrong, safe to show to a person. |
{
"error": "Full charger details are still loading. Try again shortly."
}Errors
| Status | When | Example body |
|---|---|---|
| 400 | The id is not an ocm-<digits> id. | { "error": "Unknown charger id." } |
| 404 | Open Charge Map has no charger with this id. | { "error": "Charger not found." } |
| 429 | This caller's limit, or the shared daily Open Charge Map budget, has been reached. | { "error": "Too many requests. Try again shortly." } |
| 503 | Open Charge Map is temporarily unavailable and no known detail was cached. | { "error": "Full charger details are temporarily unavailable." } |
Health check
get/api/health
Confirms the app is up and its database answers. Calls no outside provider, so it is cheap enough to poll; the scheduled uptime check uses it every 15 minutes.
- Rate limit
- None.
- Cross-origin
- Same origin only.
Example request
curl '//api/health'Response 200
The app and its database are up.
| Field | Type | Description |
|---|---|---|
okrequired | boolean |
{
"ok": true
}Errors
| Status | When | Example body |
|---|---|---|
| 503 | The database did not answer. | { "ok": false } |