/v1/routing/directions Turn-by-turn directions between two or more waypoints. Full GeoJSON geometry, step instructions, distance, and duration in a single REST call.
Built on an OSRM-based routing engine with road graph data derived from OpenStreetMap. Supports driving, walking, and cycling profiles. Returns alternatives, snapped coordinates, and leg-level breakdown for multi-stop routes.
curl -X POST "https://api.farun.io/v1/routing/directions" \
-H "X-RapidAPI-Key: YOUR_KEY" \
-H "X-RapidAPI-Host: farun-maps.p.rapidapi.com" \
-H "Content-Type: application/json" \
-d '{
"waypoints":[
{ "lon": 77.2090, "lat": 28.6139 },
{ "lon": 72.8777, "lat": 19.0760 }
],
"profile": "driving",
"geometry": "geojson",
"alternatives": false
}' Returns
GeoJSON geometry
Profiles
driving · walking · cycling
Waypoints
2 - 25 per request
Response anatomy
One request returns the full picture, geometry 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
"geometry": { // 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"
}, ...]
}, ...]
}, ...],
"waypoints": [{ // snapped coordinates
"lon": 77.2091, "lat": 28.6138
}, ...]
} routes[].geometry 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.
waypoints[].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 geometry 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 geometry 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 driving 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://api.farun.io/v1/routing/directions Request body (JSON)
waypoints
req
profile
req
geometry alternatives steps language Response codes
200 application/json Route calculated successfully. Returns routes array with geometry and legs. 400 Bad request Invalid waypoints, unsupported profile, or malformed request body. 401 Unauthorized Missing or invalid RapidAPI key. 422 Unroutable No valid route found between the given waypoints. 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://api.farun.io/v1/routing/directions",
headers={
"X-RapidAPI-Key": API_KEY,
"X-RapidAPI-Host": "farun-maps.p.rapidapi.com"
},
json={
"waypoints": [
{"lon": 77.2090, "lat": 28.6139},
{"lon": 72.8777, "lat": 19.0760}
],
"profile": "driving",
"geometry": "geojson"
}
)
route = res.json()["routes"][0]
# Store for driver display
dispatch_job.update({
"geometry": route["geometry"],
"distance_km": route["distance_m"] / 1000,
"eta_mins": route["duration_s"] // 60
}) Method
POST
Body format
application/json
Profiles
driving · walking · cycling
Max stops
25 waypoints per request
Geometry
GeoJSON or polyline6
Languages
en, hi, fr, de, es, ar
Navigation API family
Turn-by-turn routes between waypoints with full geometry 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 geometry on a styled map, overlay GeoJSON LineString on your tile layer.
Sample elevation along the route path for gradient analysis and risk scoring.
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.