Get the actual road-following route geometry between any set of waypoints in a single API call
Powered by OSRM and OpenStreetMap.
β No credit card required πͺπΊ Hosted in the EU π Open source, no lock-in
Get Free API KeyAlways free for small projects. $10/mo covers most apps
A maplines API returns the actual road-following geometry of a route β a sequence of coordinates that traces the real road network between your waypoints. Instead of drawing a straight line between A and B, you get the path a driver would actually take, ready to render on any map.
Draw accurate driving routes on your map. Show customers or drivers exactly where the vehicle will travel, not just a crow-flies line.
Animate a delivery vehicle along the real road path. Feed route geometry into your frontend map to show live or planned progress.
Embed turn-by-turn ready route data in your app. The response includes distance, duration, and step-by-step maneuver instructions.
3 NYC landmarks. Click Run Demo to fetch the real road route from the API.
# Route geometry: Times Square β Central Park β Brooklyn Bridge
curl "https://api.simplerouting.io/osrm/route/v1/driving/-73.9855,40.7580;-73.9718,40.7678;-73.9969,40.7061?overview=full&geometries=geojson"
This is a live demo β no account required to get started.
Sign up for a free key, then drop it into this curl command:
# Times Square β Central Park β Brooklyn Bridge
curl "https://api.simplerouting.io/osrm/route/v1/driving/-73.9855,40.7580;-73.9718,40.7678;-73.9969,40.7061?overview=full&geometries=geojson" \
-H "Authorization: Bearer YOUR_API_KEY"
Coordinates are longitude,latitude pairs separated by semicolons. Add ?overview=full&geometries=geojson to get the full route geometry as a GeoJSON LineString you can pass directly to Leaflet, Mapbox, or any mapping library.
The default response carries an encoded polyline. Decode it, draw it on Leaflet (or MapLibre), and build an "open in maps" link from the same waypoints:
// npm install @mapbox/polyline leaflet import polyline from '@mapbox/polyline'; const stops = [[40.7580, -73.9855], [40.7678, -73.9718], [40.7061, -73.9969]]; // lat, lng const coords = stops.map(([lat, lng]) => `${lng},${lat}`).join(';'); const res = await fetch(`https://api.simplerouting.io/osrm/route/v1/driving/${coords}?overview=full`, { headers: { Authorization: 'Bearer YOUR_API_KEY' }, }); const { routes } = await res.json(); // 1. Draw the road-following line const line = L.polyline(polyline.decode(routes[0].geometry)).addTo(map); map.fitBounds(line.getBounds()); // 2. Deep links for turn-by-turn in the user's own maps app const fmt = ([lat, lng]) => `${lat},${lng}`; const [origin, destination] = [stops[0], stops.at(-1)]; const via = stops.slice(1, -1).map(fmt).join('|'); const googleMapsUrl = 'https://www.google.com/maps/dir/?api=1&travelmode=driving' + `&origin=${fmt(origin)}&destination=${fmt(destination)}` + (via ? `&waypoints=${encodeURIComponent(via)}` : ''); const appleMapsUrl = `https://maps.apple.com/?saddr=${fmt(origin)}&daddr=${fmt(destination)}&dirflg=d`;
Using MapLibre instead? Request geometries=geojson and pass routes[0].geometry straight to map.addSource(). Apple Maps links take a single destination, so intermediate stops are dropped there.
If all you need from Google is the line on the map and the distance and duration that go with it, this does the same job at a flat monthly price instead of a per-request bill. See the cost comparison →
No overages β your plan is your bill.
Hitting the limits, want more countries, or need a bespoke solution? Email [email protected] β we'll figure it out.
The API returns a JSON object with a routes array. Each route has a geometry (GeoJSON LineString or encoded polyline), distance (meters), duration (seconds), and a legs array with per-segment steps and maneuver details.
Request with geometries=geojson and pass routes[0].geometry directly to L.geoJSON() in Leaflet, or map.addSource() in Mapbox GL JS. No coordinate decoding needed.
/route API?Yes. The endpoint follows the standard OSRM Route Service specification. If you are already using a self-hosted OSRM instance, switching is a one-line URL change plus an Authorization header.
The free tier covers North America and Europe. Need more regions? Email [email protected] β coverage is added based on demand.