OSRM Routing API
Free OSRM routing API with no key: driving, cycling and walking routes with distance, duration, turn-by-turn steps and geometry from OpenStreetMap. Tested.
Endpoint tested and returned HTTP 200 on 2026-08-20
What is the OSRM Routing API?
OSRM (Open Source Routing Machine) is a free, key-free routing API that calculates routes over OpenStreetMap data, returning distance, duration, turn-by-turn directions and route geometry for driving, cycling and walking.
Routing is one of the harder geospatial problems and commercial APIs charge accordingly. OSRM is open source, extremely fast, and its demo server is publicly available without a key — making real route calculation accessible for free.
Coordinates go in the URL as `longitude,latitude` pairs separated by semicolons, which is the reverse of the usual convention and the single most common source of nonsensical routes. Get that order wrong and OSRM will happily route you somewhere unexpected.
Quick facts
- Base URL
https://router.project-osrm.org- Authentication
- No API key on the demo server. It is explicitly for testing — self-host for production.
- Rate limit
- The demo server is a courtesy with no guarantees; heavy use should be self-hosted.
- Pricing
- Free and open source. Data is ODbL, requiring OpenStreetMap attribution.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the OSRM Routing API
Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.
1. Calculate a driving route
GET https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407?overview=false
curl 'https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407?overview=false'const res = await fetch("https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407?overview=false");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407?overview=false", timeout=20)
res.raise_for_status()
print(res.json()){
"code": "Ok",
"routes": [
{
"legs": [
{
"steps": [],
"weight": 262.7,
"summary": "",
"duration": 260.4,
"distance": 1888
}
],
"weight_name": "routability",
"weight": 262.7,
"duration": 260.4,
"distance": 1888
}
],
"waypoints": [
{
"hint": "wgEKgJoqn4ULAAAAAwAAAAAAAAAPAAAAuFtKQYXNK0AAAAAAIMuBQQsAAAADAAAAAAAAAA8AAAB1JQEAFEzMAKpYIQM8TMwArVghAwAA3woAAAAA",
"location": [
13.38882,
52.517034
],
"name": "Friedrichstraße",
"distance": 2.73531597
},
{
"hint": "1kbfgTw6kYcGAAAACQAAAAAAAABeAAAAz-ONQIv-tkAAAAAAeYZHQgYAAAAJAAAAAAAAAF4AAAB1JQEAfm7MABmJIQOCbswA_4ghAwAATwUAAAAA",
"location": [
13.39763,
52.529433
],
"name": "Torstraße",
"distance": 2.905919634
}
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
route/v1/<profile>/<coords> | path | Required | Profile and semicolon-separated lon,lat pairs. route/v1/driving/13.38,52.51;13.42,52.50 |
overview | string | Optional | full, simplified or false — controls geometry detail. false |
steps | boolean | Optional | Include turn-by-turn instructions. true |
alternatives | boolean | Optional | Return alternative routes. true |
geometries | string | Optional | polyline, polyline6 or geojson. geojson |
Response fields
codestring- Ok on success, or an error code such as NoRoute.
routes[].distancenumber- Route distance in metres.
routes[].durationnumber- Estimated duration in seconds.
routes[].geometrystring|object- Route shape as an encoded polyline or GeoJSON.
routes[].legs[].stepsarray- Turn-by-turn instructions, when steps=true.
waypointsarray- The snapped positions of your input coordinates.
What you can build with the OSRM Routing API
- Calculate driving distance and time between addresses
- Add turn-by-turn directions to a delivery or logistics app
- Draw a route line on a map
- Estimate travel times for scheduling
Common errors and how to fix them
Nonsensical route
Coordinates are lon,lat — the reverse of the usual order.
Fix: Write longitude first. This is the most common OSRM mistake by a wide margin.
code: NoRoute
No path exists between the points for that profile.
Fix: Check the points are on the routable network; a coordinate in the sea or a pedestrian-only zone cannot be driven to.
Demo server unavailable
It is a courtesy service with no uptime guarantee.
Fix: Self-host OSRM for production — it is designed for that and is very fast.
OSRM Routing API — frequently asked questions
Is OSRM free?
Yes, it is open source with a publicly available demo server requiring no API key. The demo server is explicitly for testing — self-host for production.
Why is my route completely wrong?
Coordinates must be longitude,latitude — the reverse of the usual convention. Writing latitude first is by far the most common OSRM mistake.
Which travel modes are supported?
The demo server supports driving. A self-hosted instance can be built with cycling or walking profiles from the same OpenStreetMap data.
Can I get turn-by-turn directions?
Yes, pass steps=true and each leg includes instruction steps with manoeuvre types and street names.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Unit Converter
Convert between units of length, weight, temperature, area, volume, speed, time and data storage instantly, with a swap button and common conversion tables.
OSRM Routing is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.