APIs
Routing API
A routing API answers how to get from one point to another along a transport network: how far it is, how long it takes and which way to go. oslew routes by car, on foot, by bicycle and along railway track, each on a network of its own, and times every route at free-flow speeds — the posted limit or a speed for the road’s class, with nothing added for congestion. It is on the Routing plan at $299 a month for 5 requests a second sustained, burst 25, with no monthly quota.
Last reviewed
A route is one request, GET /v1/route?from=lat,lon&to=lat,lon, and one answer: whether a path was found, its length in metres along the road, its duration in seconds, the path itself, where each end was placed on the network, and which engine produced it. Everything else on this page is about reading those fields correctly.
Five profiles on four networks
The profile parameter picks the network, and each one is built from the same road data read under different rules. That is why the same two points can come back with different distances as well as different times, and why a slow walk is not simply a slow drive.
| Profile | What it may use | How it treats direction |
|---|---|---|
driving (the default) |
Roads from motorways down to alleys, under the access rules for vehicles and cars | One-way streets are one-way |
walking |
Every road except motorways and trunk roads, plus footways, pedestrian streets, paths, steps and tracks | Every way can be walked in both directions |
cycling |
Roads and paths, but no motorways, trunk roads or steps; footways at walking pace | One-way streets are one-way |
rail |
Railway track rather than roads, at posted or line speeds | As the track allows |
live |
The driving network, with any operator traffic feed applied | As driving |
The rail profile answers how long a train takes along the line; it knows nothing of timetables. For when the next train leaves and how to reach it by public transport, use the transit API. Profile names are exact and lowercase: common aliases such as car or bike are refused with HTTP 400 rather than guessed at.
What the duration means
Each road segment’s time is its length at the profile’s speed on it: the posted limit for driving and rail where the data gives one, otherwise a default speed for the road’s class, and the class speed always on foot and by bicycle. The route’s duration is the sum. Nothing is added for turning, waiting at a signal or queuing behind other traffic, so the figure is a free-flow time.
For comparing options — which depot is nearer, which of two routes is quicker — that is usually what you want, because every option is measured the same way. For telling a customer when a van will arrive during the evening peak it is a best case, and should be shown as a window. Free-flow versus traffic-aware routing sets out where the line falls.
A driving route can be timed on current road speeds only where an operator has applied a traffic feed, which is the Enterprise operator product described under operator feeds. Send profile=live or traffic=live and read engine on the answer: base/hierarchy means the release’s free-flow speeds answered, and the two live/… values mean a feed did. Asking for live speeds where none are applied is not an error — the answer quietly comes back free-flow, and engine is the only field that tells you so.
Where a route begins and ends
The coordinates you send are rarely on a road. Each is moved to the nearest point on a road in the profile’s network — a point part-way along a segment, not the nearest junction, which from the middle of a block can be half a block away. The route pays only for the part of that segment it travels. snapped_from and snapped_to report the landing point, how far it moved in distance_m, the segment’s two junctions, how far along it the point sits, and whether the segment runs both ways.
Snapping looks only at distance. It does not know which side of a divided road you are on or which way you are facing, so a point beside a dual carriageway can land on the carriageway going the other way, and the route then drives on to find a place to turn. When that matters, move the point to the side you mean before routing. A point with no road anywhere near it is refused with HTTP 400.
Two failures come back differently, and a client should handle them differently. A request that cannot be answered — a coordinate that does not parse, an unknown profile, no road near an end — is a 400 with an error sentence, and retrying will not help. Two ends that are both on the network with nothing joining them — an island with no bridge in the data, a one-way trap — is a 200 with found: false, null distance and duration, and the snapped ends still present so you can show where the route would have started.
Access rules that are and are not applied
Unconditional rules are applied: one-way streets, and roads closed to cars, bicycles or pedestrians outright. Rules with a condition attached — a time of day, a vehicle’s weight or height, a purpose such as deliveries only — are not. A street closed to cars at night is routed as open all day, and a restriction on lorries does not close the road to anything. That also means there is no truck profile: a route for a heavy vehicle will happily use a bridge with a weight limit, so it is not suitable for routing lorries.
The path, junction to junction
geometry is a list of [lat, lon] pairs: the snapped start, every junction the route passes through, and the snapped end. The points are junctions, not the shape of the road between them, so a road that curves between two junctions is drawn as a straight line. That is fine for showing a route at city zoom and wrong for measuring along; distance_m is measured along the road’s real shape. Send geometry=false when you need only the numbers — the path is most of the bytes of a long route, and nothing else in the answer changes.
GeoJSON and most map libraries want [lon, lat], so swap each pair once, where the answer enters your code. Build the map feature on your server and send that to the browser: the service sends no CORS headers, and a key belongs only in a server’s Authorization header.
curl -H "Authorization: Bearer $OSLEW_KEY" \
"https://api.oslew.com/v1/route?from=19.4406,-99.2047&to=19.4326,-99.1332&profile=walking&geometry=false"Read the answer in this order: found, then each snapped end’s distance_m, then engine, and only then the distance and duration. The routes and profiles guide has the full response with every field.
What it costs
Routing is its own product with its own rate, separate from address lookups, and it is not on the Free or Address plans. The Routing plan is $299 a month: 5 requests a second sustained, burst 25 for routing and 20 requests a second sustained, burst 100 for geocoding. The routing rate is the lower of the two because a route takes more server work than an address lookup. The Platform plan raises routing to 20 requests a second sustained, burst 100 and Scale to 100 requests a second sustained, burst 300. A request inside the rate is already paid for; going faster returns HTTP 429 with a Retry-After header. The pricing page lists every plan.
For many points at once, a distance matrix answers every pair in one request, and route optimisation puts a list of stops in order.
The licence on every answer
Routes are computed on Overture’s transportation data, which derives from OpenStreetMap and carries ODbL-1.0. The provenance block names the dataset and release on every answer. A route shown to the public in your application needs only attribution; distributing a database of stored routes or times brings share-alike, because the ODbL is share-alike. The licensing page covers what that means for each layer.
Limits, stated plainly
- Times are free-flow unless an Enterprise operator has applied a traffic feed, and there is no departure-time parameter or time-of-day model.
- A route joins exactly two points. There are no via points and no alternative routes; route each leg separately, or use the optimiser for a list of stops.
- The answer carries no turn-by-turn instructions and no street names — it is a line and two numbers, not navigation.
- Conditional access rules are ignored, and there is no profile for lorries or other restricted vehicles.
- How complete the network is, and how many roads carry a posted limit, depends on the road data loaded for the area: ⟦pending:coverage.roads.extent⟧.
Bottom line
Use this endpoint when you need the distance, a free-flow time and a drawable path between two points, on a network that matches how the trip is made. Check found and the snapped distances before trusting the numbers, check engine before calling anything live, and keep the ODbL attribution with any routes you store.
Questions
Does the routing API take traffic into account?
Not by default. Every route is timed at free-flow speeds: the posted limit where the road data carries one, otherwise a speed for the road’s class, with no time added for signals, junctions or queues. A driving route can use a traffic feed only where an Enterprise operator has applied one, and the engine field on the answer says whether it did.
Which travel modes can I route?
Driving, walking, cycling and rail, plus live, which is the driving network with any operator traffic feed applied. Each profile reads the road data its own way — which roads it may use, how fast it goes on each, which direction rules bind it — so a walking route can cut along a pedestrian street or against a one-way street that a car must respect.
Why does the route start somewhere other than the coordinate I sent?
Each end is moved to the nearest point on a road in the chosen profile’s network, part-way along that road rather than at a junction. The answer reports where each end landed and how far it moved, in snapped_from and snapped_to. A large distance there means the point was nowhere near a road the profile may use.
Can I store the routes the API returns?
Yes, with a condition. Routes derive from ODbL road data, so you may keep them for your own use, but a database built from them that you share with others must be offered under the same licence, with attribution. The licence is stated on every answer, so the obligation can be read off the response.
Why does the Routing plan allow fewer routing requests a second than address requests?
Because a route costs more to compute than an address lookup. The Routing plan pairs 20 requests a second sustained, burst 100 for addresses with 5 requests a second sustained, burst 25 for routing, and the Platform plan lifts routing to 20 requests a second sustained, burst 100. A matrix, an isochrone or a visit order is still one request against that rate, whatever its size.