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.

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
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 *string
idstring
revisioninteger
namestringmaxLength: 80
designobject
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
          ]
        }
      }
    ]
  }
}
Support team

OSRMRoute Support

Talk directly to our team

HERE TO HELP

How can we help?

Ask about integration, billing or your account. Our replies appear in this conversation.

Your chats

Your chats will appear here.