osrmroute
Documentation

Maps, search & Studio APIs

Build with maps and location data

Authentication and errors

Send your key in the Authorization: Bearer header. Coordinates use [longitude, latitude]. Set OSRMROUTE_API_KEY locally; for dataset queries, set DATASET_ID to an owned dataset UUID. Never expose a Studio key in browser code.

401: missing or invalid key · 403: scope denied · 402: insufficient credits · 429: rate limit · 502/503: upstream unavailable. Check the HTTP status before using a response; failed charged operations release their reserved credits.

409: revision conflict. Read the latest resource and reconcile changes before retrying.

Fuel Estimate API

Estimate fuel volume and trip value from distance, loaded weight, observed empty/full consumption and your fuel price. Use it alone or include fuel in a Truck request.

Request credits
1
Required scopes
route

Standalone: 1 credit; optional Truck estimate is included in the route price and uses the returned road distance. Requires empty/full calibration at comparable operating conditions. Linear load interpolation; speed, slopes, traffic, wind and idling are not modeled. No validated error percentage. Prices are supplied by you; no currency conversion.

POST /api/v1/fuel/estimate

Request body — Fields marked * are required.
distance_km *numbermin: 0 · max: 100000
loaded_weight_t *numbermin: 0.001 · max: 100
fuel *object
fuel.empty_weight_t *numbermin: 0.001 · max: 100
fuel.full_weight_t *numbermin: 0.001 · max: 100
fuel.empty_l_per_100km *numbermin: 0.001 · max: 200
fuel.full_l_per_100km *numbermin: 0.001 · max: 200
fuel.price_per_liter *stringmaxLength: 30
fuel.currency *string

How the fuel estimate works

Supply empty and fully loaded gross weights, observed consumption in L/100 km at both weights, actual loaded gross weight, distance, price per litre and currency. Use measurements from comparable conditions. The loaded weight must stay within your calibration range; the full-load rate cannot be below the empty rate.

Calculation
load_ratio = (loaded_weight_t - empty_weight_t) / (full_weight_t - empty_weight_t)
L_per_100km = empty_l_per_100km + load_ratio * (full_l_per_100km - empty_l_per_100km)
fuel_liters = distance_km * L_per_100km / 100
fuel_cost = fuel_liters * price_per_liter

Illustrative inputs, not measured vehicle data: empty 12 t at 20 L/100 km; full 40 t at 34 L/100 km; actual 26 t; distance 500 km; price 1.10 AZN/L. Result: 27 L/100 km, 135 L and 148.50 AZN. Decimal output precision is not prediction accuracy.

For Truck Routing, add this optional fuel object to the existing request. Loaded weight comes from vehicle.weight_t and distance from the returned road route; do not send a separate fuel distance or loaded weight. Without fuel, the route response stays unchanged. Standalone REST and MCP estimates cost 1 credit; adding fuel to Truck costs no extra credits.

JSON · fuel
{
  "fuel": {
    "empty_weight_t": 12,
    "full_weight_t": 40,
    "empty_l_per_100km": 20,
    "full_l_per_100km": 34,
    "price_per_liter": "1.10",
    "currency": "AZN"
  }
}

This is a linear estimate based on your calibration. Speed, road gradient, traffic, wind, idling and driving style are excluded. No validated error percentage is available. Fuel prices are supplied by you; currencies are not converted. Results are estimates, not a payment or a guaranteed fuel bill.

MCP: estimate_fuel

Fuel Estimate API details
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/fuel/estimate" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"distance_km":500,"loaded_weight_t":26,"fuel":{"empty_weight_t":12,"full_weight_t":40,"empty_l_per_100km":20,"full_l_per_100km":34,"price_per_liter":"1.10","currency":"AZN"}}'
Response
method: user_calibrated_linear_load_v1
estimated: true
distance_km
loaded_weight_t
consumption_l_per_100km
fuel_liters
fuel_cost.amount (decimal string)
fuel_cost.currency
accuracy.validated_error_percent: null
basis
exclusions[]

Truck Routing API

Send loaded vehicle dimensions and weight with each request to calculate a truck route.

Request credits
1 credit per started block of 10 input points, including origin and destination.
Required scopes
route

2–20 points, subject to plan limits; up to 1,000 km, snapping within 250 m and 10 requests/minute/key. Height, width and length in metres; loaded total and heaviest-axle weight in metric tonnes; axle count includes trailers. Static road restrictions. Conditional bans, hazardous goods, live traffic, truck matrices and fleet optimization are outside this release. Follow posted road signs and local rules.

Supported countries: Azerbaijan, Armenia, Georgia, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Uzbekistan, Mongolia, Türkiye, Iran, Iraq, Syria, Jordan, Lebanon, Israel, Palestinian Territories, Yemen, Saudi Arabia, United Arab Emirates, Qatar, Kuwait, Bahrain, Oman, Afghanistan, Pakistan.

POST /api/v1/truck/route

Request body — Fields marked * are required.
points *array
vehicle *object
vehicle.height_m *numbermin: 0.5 · max: 10
vehicle.width_m *numbermin: 0.5 · max: 5
vehicle.length_m *numbermin: 1 · max: 35
vehicle.weight_t *numbermin: 0.1 · max: 100
vehicle.axle_load_t *numbermin: 0.1 · max: 40
vehicle.axle_count *integermin: 2 · max: 20
fuelobject
fuel.empty_weight_t *numbermin: 0.001 · max: 100
fuel.full_weight_t *numbermin: 0.001 · max: 100
fuel.empty_l_per_100km *numbermin: 0.001 · max: 200
fuel.full_l_per_100km *numbermin: 0.001 · max: 200
fuel.price_per_liter *stringmaxLength: 30
fuel.currency *string

Worldwide Truck coverage is being prepared. The supported countries listed above remain the current live coverage until the new dataset passes acceptance and is released.

How the fuel estimate works

For Truck Routing, add this optional fuel object to the existing request. Loaded weight comes from vehicle.weight_t and distance from the returned road route; do not send a separate fuel distance or loaded weight. Without fuel, the route response stays unchanged. Standalone REST and MCP estimates cost 1 credit; adding fuel to Truck costs no extra credits.

JSON · fuel
{
  "fuel": {
    "empty_weight_t": 12,
    "full_weight_t": 40,
    "empty_l_per_100km": 20,
    "full_l_per_100km": 34,
    "price_per_liter": "1.10",
    "currency": "AZN"
  }
}

This is a linear estimate based on your calibration. Speed, road gradient, traffic, wind, idling and driving style are excluded. No validated error percentage is available. Fuel prices are supplied by you; currencies are not converted. Results are estimates, not a payment or a guaranteed fuel bill.

MCP: estimate_fuel

Fuel Estimate API details
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/truck/route" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points":[[49.8671,40.4093],[49.849,40.378]],"vehicle":{"height_m":4,"width_m":2.55,"length_m":16.5,"weight_t":30,"axle_load_t":10,"axle_count":5}}'
Response
profile: truck
vehicle
routes[].distance (m)
routes[].duration (estimated seconds)
routes[].geometry (GeoJSON LineString)
waypoints[].location
waypoints[].distance (m)
attribution

Place details

Read source attributes from a retrieved suggestion or route search.

Request credits
1
Required scopes
places

One credit with places scope. Read one OpenStreetMap object by its search result ID; source cache lasts one hour. Missing phone, website, opening hours and accessibility remain null. Source update time is the object edit time, not business verification. No live opening status. 20 calls/min/key; source cache misses share 30/min.

POST /api/v1/places/details

Request body — Fields marked * are required.
id *stringmaxLength: 24
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/places/details" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"osm:N:123"}'
Response
place.details.phone
place.details.website
place.details.opening_hours
place.details.wheelchair
place.details.observed_at
place.details.source_updated_at
place.details.open_now: null

Text-to-style preview

Describe palette and layer changes, review the map, then apply.

Request credits
0
Required scopes
studio

English commands separated by semicolons. Presets, hex colors and layer visibility only. Preview never saves or publishes; Apply enters the existing draft and autosave flow.

POST /api/v1/studio/preview

Request body — Fields marked * are required.
prompt *stringmaxLength: 1000
aibooleandefault: false
designobject
design.preset *stringlight | dark | navigation | minimal
design.colors *object
design.visible *object
design.center *array
design.zoom *numbermin: 0 · max: 20
design.overlays *array
design.datasetsarray
design.allowedOriginsarray
design.brandstring
design.interactionsobject
design.categoriesobject
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/studio/preview" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"dark; water #123456; hide buildings"}'
Response
design
changes[]
saved: false
method: explicit_style_commands

Static Maps API

Export styled maps as PNG images for reports and applications.

Request credits
4
Required scopes
maps

Four palettes: light, dark, navigation and minimal. Images are 128–512 px per side; zoom is 1–14. Simplified rendering includes source attribution; custom Studio layers and effects are not rendered.

POST /api/v1/maps/static

Request body — Fields marked * are required.
center *array
zoomintegermin: 1 · max: 14 · default: 12
widthintegermin: 128 · max: 512 · default: 512
heightintegermin: 128 · max: 512 · default: 512
stylestringlight | dark | navigation | minimal
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/maps/static" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"center":[13.405,52.52],"zoom":12,"width":512,"height":512,"style":"light"}' \
  --output map.png
Response
Content-Type: image/png

Dataset Query API

Find nearby features in your own uploaded geographic datasets.

Request credits
1
Required scopes
maps

Only datasets owned by the key owner are accessible. Radius: 0–50,000 m; limit: 1–50. Results contain nearest points and estimated local distances, not road distance or original full geometries. Empty successful results also cost one credit.

POST /api/v1/maps/datasets/{id}/query

Request body — Fields marked * are required.
point *array
radiusnumbermin: 0 · max: 50000 · default: 0
limitintegermin: 1 · max: 50 · default: 10
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/maps/datasets/$DATASET_ID/query" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"point":[2.3522,48.8566],"radius":1000,"limit":10}'
Response
type: FeatureCollection
features[].geometry.type: Point
features[].properties
returned

Search Along Route API

Discover useful stops and compare their additional driving time.

Request credits
14
Required scopes
places + route

Driving routes up to 200 km. Five sampled locations and at most eight candidate detours; discovery is not exhaustive. Categories: fuel, charging_station, restaurant, cafe, parking, pharmacy. No live traffic or charger availability.

POST /api/v1/places/along-route

Request body — Fields marked * are required.
start *array
end *array
category *stringfuel | charging_station | restaurant | cafe | parking | pharmacy
max_detour_secondsnumbermin: 0 · max: 1800 · default: 600
limitintegermin: 1 · max: 8 · default: 5
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/places/along-route" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"start":[13.405,52.52],"end":[13.3777,52.5163],"category":"cafe","max_detour_seconds":600,"limit":5}'
Response
places[]
baseline.duration_seconds
baseline.distance_meters
discovery
duration_model

Structured Geocoding API

Search addresses with street, city, postcode and country components.

Request credits
1
Required scopes
geocode

Provide street, city or postcode. Country codes contain two letters; other fields allow 100 characters. Components form a text search. Matched/different/missing comparisons and source precision are not guaranteed address validation.

POST /api/v1/search/structured

Request body — Fields marked * are required.
housenumberstringmaxLength: 100
streetstringmaxLength: 100
citystringmaxLength: 100
statestringmaxLength: 100
postcodestringmaxLength: 100
countrycodestringmaxLength: 2
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/search/structured" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"street":"Friedrichstraße","city":"Berlin","countrycode":"DE"}'
Response
features[].id
features[].address
features[].precision
features[].match.components
features[].precision_basis
search_method: composed_address_query

Suggest & Retrieve API

Build place search with suggestions and a secure retrieval step.

Request credits
1 + 1
Required scopes
geocode

Each suggest and retrieve request costs one credit. Query: 1–200 characters. Retrieval tokens expire after 10 minutes and belong to the key owner. Retrieve returns the signed suggestion snapshot, not a fresh lookup.

POST /api/v1/search/suggest

Request body — Fields marked * are required.
q *stringmaxLength: 200

POST /api/v1/search/retrieve

Request body — Fields marked * are required.
token *stringmaxLength: 16384
cURL
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/search/suggest" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q":"Paris"}'
Response
suggestions[].id
suggestions[].name
suggestions[].address
suggestions[].token
expires_in_seconds: 600

retrieve → place, retrieval: signed_suggestion_snapshot
cURL · retrieve
curl --fail-with-body -X POST "https://osrmroute.com/api/v1/search/retrieve" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"token":"TOKEN_FROM_SUGGEST"}'

Studio API

Manage map styles, datasets and publication from your application.

Request credits
0
Required scopes
studio

Explicit studio scope is required, including for unrestricted keys. GET lists owned styles or dataset metadata; POST manages resources. Styles use revisions and publication confirmation. Datasets support create/delete, not in-place editing. Limits: 30 reads or 5 writes/minute/key; workspace quotas apply.

GET / POST /api/v1/studio/{resource}

Request body — Fields marked * are required.
action *stringcreate | save | autosave | duplicate | restore | publish | unpublish | delete
idstring
revisioninteger
namestringmaxLength: 80
designobject
design.preset *stringlight | dark | navigation | minimal
design.colors *object
design.visible *object
design.center *array
design.zoom *numbermin: 0 · max: 20
design.overlays *array
design.datasetsarray
design.allowedOriginsarray
design.brandstring
design.interactionsobject
design.categoriesobject
dataobject
confirmPublicboolean
confirmDeleteboolean
versioninteger
cURL
curl --fail-with-body "https://osrmroute.com/api/v1/studio/styles" \
  -H "Authorization: Bearer $OSRMROUTE_API_KEY"
Response
GET styles → styles[]
GET datasets → datasets[]
Studio actions
styles · createname, design
styles · save / autosaveid, revision, name, design
styles · duplicateid, revision, name
styles · restoreid, revision, version
styles · publishid, revision, confirmPublic: true
styles · unpublish / deleteid, revision
datasets · createname, data: GeoJSON FeatureCollection
datasets · deleteid, confirmDelete: true
POST /api/v1/studio/styles · application/json
{
  "action": "create",
  "name": "Berlin",
  "design": {
    "preset": "light",
    "colors": {
      "land": "#f1f3f5",
      "water": "#a9d8ed",
      "park": "#c9dfc6",
      "road": "#ffffff",
      "highway": "#edc779",
      "building": "#d9dee3",
      "label": "#334155"
    },
    "visible": {
      "roads": true,
      "buildings": true,
      "parks": true,
      "labels": true,
      "pois": true,
      "boundaries": true
    },
    "center": [
      13.405,
      52.52
    ],
    "zoom": 11,
    "overlays": []
  }
}
POST /api/v1/studio/datasets · application/json
{
  "action": "create",
  "name": "Paris places",
  "data": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "name": "Paris"
        },
        "geometry": {
          "type": "Point",
          "coordinates": [
            2.3522,
            48.8566
          ]
        }
      }
    ]
  }
}

OSRMRoute Support

Talk directly to our team

HERE TO HELP

How can we help?

Send a message. Ticket replies are also sent to your verified email.

Your chats

Your chats will appear here.