/route Turn-by-turn directions between two or more locations. Full GeoJSON shape_format, step instructions, distance, and duration in a single REST call.
Built on the Farun routing engine with road graph data derived from OpenStreetMap. Supports car, truck, walking, cycling, motorcycle, scooter, bus, and taxi costing modes, plus alternates and route-shape options.
curl -X POST "https://YOUR-RAPIDAPI-HOST/route" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
-H "Content-Type: application/json" \
-d '{
"locations":[
{ "lon": 18.4241, "lat": -33.9249 },
{ "lon": 18.8602, "lat": -33.9321 }
],
"costing": "auto",
"shape_format": "polyline6"
}' Returns
GeoJSON shape_format
Profiles
auto · walking · cycling
Waypoints
2 - 25 per request
Response anatomy
One request returns the full picture, shape_format for the map, instructions for the driver, and leg-level data for your backend logic.
{
"routes": [{
"distance_m": 1423600, // 1,423 km
"duration_s": 50940, // ~14.1 hours
"shape_format": { // GeoJSON LineString
"type": "LineString",
"coordinates": [[77.209, 28.613], ...]
},
"legs": [{
"distance_m": 1423600,
"duration_s": 50940,
"steps": [{
"instruction": "Head south on NH-48",
"distance_m": 4200,
"duration_s": 312,
"maneuver": "depart"
}, ...]
}, ...]
}, ...],
"locations": [{ // snapped coordinates
"lon": 77.2091, "lat": 28.6138
}, ...]
} routes[].shape_format GeoJSON LineString The full route path as a GeoJSON LineString. Pass directly to MapLibre GL as a source, or to Leaflet as a polyline. Coordinates are [longitude, latitude] in EPSG:4326.
routes[].distance_m number Total route distance in metres. Divide by 1000 for kilometres. Accurate to the road graph resolution not straight-line distance.
routes[].duration_s number Estimated travel time in seconds based on road speed limits and classification. Does not account for live traffic use this as the baseline for ETA calculation.
routes[].legs[].steps array Turn-by-turn instruction array. Each step includes a human-readable instruction string, distance, duration, maneuver type, and bearing. Use for driver display or voice prompt generation.
locations[].lon/lat number Snapped waypoint coordinates. The routing engine snaps your input coordinates to the nearest navigable road. Use these in your UI rather than the raw input coordinates for accurate map pin placement.
Who uses it
The Routing API is the backbone of any application where real-world navigation matters from last-mile delivery dispatch to field service scheduling to maritime passage planning.
Unlike cloud-first providers, Farun's routing is designed to work at the edge on-device in the GPS Navigator, or via API in environments with intermittent connectivity.
Fleet & Logistics
Calculate routes for each vehicle in a dispatch queue. Return shape_format for the driver's map view and step instructions for turn-by-turn guidance. Pair with the Optimized Route API to reorder multi-stop runs.
Field Services
Route field engineers between job sites, calculate ETA for customer notifications, and log actual vs planned route adherence. The leg-level breakdown lets you attribute travel time to individual site visits.
Agriculture
Route between farm gates, collection points, and processing facilities across rural road networks that urban-centric APIs handle poorly. Farun's road graph includes rural tracks and agricultural access roads.
Emergency Services
Calculate fastest routes for emergency response teams based on current position. The shape_format and step data can feed directly into CAD systems and mobile MDT displays without an additional mapping layer.
Travel & Tourism
Build multi-day road trip itineraries with per-leg distance and duration. Show route lines on a trip planning map. Generate auto directions for guided tour apps without paying per-map-load fees.
Insurance & Telematics
Generate the planned route for a given trip and compare it against GPS telemetry logs from the vehicle. Deviation scoring, excess mileage detection, and route adherence reporting for fleet insurance products.
Endpoint reference
https://YOUR-RAPIDAPI-HOST/route Request body (JSON)
locations
req
costing
req
shape_format alternates steps language Response codes
200 application/json Route calculated successfully. Returns routes array with shape_format and legs. 400 Bad request Invalid locations, unsupported costing, or malformed request body. 401 Unauthorized Missing or invalid RapidAPI key. 422 Unroutable No valid route found between the given locations. Check coordinates are on a navigable road. 429 Rate limited Exceeded plan request rate. Upgrade on RapidAPI. Integration example
import requests, json
# Build route for a dispatch job
res = requests.post(
f"https://YOUR-RAPIDAPI-HOST/route",
headers={
"X-RapidAPI-Key": API_KEY,
"X-RapidAPI-Host": "YOUR_RAPIDAPI_HOST"
},
json={
"locations": [
{"lon": 77.2090, "lat": 28.6139},
{"lon": 72.8777, "lat": 19.0760}
],
"costing": "auto",
"shape_format": "polyline6"
}
)
route = res.json()["routes"][0]
# Store for driver display
dispatch_job.update({
"shape_format": route["shape_format"],
"distance_km": route["distance_m"] / 1000,
"eta_mins": route["duration_s"] // 60
}) Method
POST
Body format
application/json
Profiles
auto · walking · cycling
Max stops
25 locations per request
Geometry
GeoJSON or polyline6
Languages
en, hi, fr, de, es, ar
Navigation API family
Turn-by-turn routes between locations with full shape_format and instructions.
Solve the Travelling Salesman Problem to find the most efficient stop order.
Compute many-to-many travel times and distances in a single batched request.
Generate reachability polygons based on travel time or physical distance.
Often used together
Reorder multi-stop itineraries for minimum total distance or time before routing each leg.
Show what areas are reachable in a given time from a depot or hub before dispatching.
Render the route shape_format on a styled map, overlay GeoJSON LineString on your tile layer.
Start routing
The Starter plan on RapidAPI includes 500 routing requests per month at no cost. Enough to build and test a full dispatch or navigation integration before committing to Pro.