Farun API Documentation

Maps, search, routing, and elevation APIs.

This is the consumer-facing API reference for Farun on RapidAPI. Use the request URL and headers shown in your RapidAPI subscription. Do not hard-code the placeholder host.

Base URL placeholder https://YOUR-RAPIDAPI-HOST Replace it with the exact API URL and host shown in RapidAPI for your subscription.

Endpoint Index

Setup

Authentication and Content Types

Use the headers supplied by RapidAPI for this API. RapidAPI provides the exact request URL and required header values in each endpoint code snippet.

X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: YOUR_RAPIDAPI_HOST
Content-Type: application/json
Accept: application/json

Most endpoints return JSON and accept JSON request bodies for POST requests. Vector tile endpoints return binary protobuf tiles with Content-Type: application/x-protobuf.

Common HTTP Status Codes

200
Successful request.
204
Tile request succeeded but no tile exists for that coordinate.
400
Invalid request parameters or request body.
403
Missing or invalid RapidAPI authentication.
404
Requested source, document, or resource was not found.
422
Request failed validation or is outside supported coverage.
502
Upstream search backend error.
503
Service backend is not initialized or unavailable.
504
Routing backend timed out.

Schemas

Shared Data Types

Coordinates

lon
number
Required
Longitude.
lat
number
Required
Latitude.

Routing Location Object

lon
number
Required
Longitude.
lat
number
Required
Latitude.
type
string
Optional
Stop behavior: break, through, via, or break_through. Default: break.
heading
number
Optional
Preferred heading in degrees, 0 to 360.
heading_tolerance
number
Optional
Allowed heading tolerance in degrees, 0 to 180.
name
string
Optional
Human-readable location name.
street
string
Optional
Street name hint.
city
string
Optional
City hint.
waiting_secs
integer
Optional
Waiting time at this location, >= 0.
search_radius
integer
Optional
Candidate search radius, 1 to 100.
rank_candidates
boolean
Optional
Whether to rank candidate road matches.
preferred_side
string
Optional
same, opposite, or either.
{
  "lon": 18.4241,
  "lat": -33.9249,
  "type": "break",
  "name": "Cape Town"
}

Directions Options Object

units
string
Optional
kilometers or miles. Default: kilometers.
language
string
Optional
Instruction language tag. Default: en-US.
directions_type
string
Optional
none, maneuvers, or instructions. Default: instructions.
banner_instructions
boolean
Optional
Include banner instructions when supported. Default: false.
voice_instructions
boolean
Optional
Include voice instructions when supported. Default: false.

Search Result Object

id
string
Returned
Document ID.
score
number
Returned
Search relevance score.
index
string
Returned
Source index containing the result.
doc_type
string or null
Returned
Document type, commonly place or poi.
display_name
string or null
Returned
Full display name.
name
string or null
Returned
Primary name.
name_en
string or null
Returned
English name when available.
place_class
string or null
Returned
Place classification.
category
string or null
Returned
POI category when available.
importance
number or null
Returned
Ranking importance.
location
object or null
Returned
{ "lat": number, "lon": number }.
canonical_id
string or null
Returned
Canonical document ID.
source
string or null
Returned
Data source such as osm or overture.
distance_m
number
Reverse only
Distance from reverse geocode input when available.

Routing Profiles

Costing Modes and Options

Costing controls the transport mode and routing profile. Pass endpoint-specific options using costing_options. For route and optimised route requests, the API wraps the object under the selected costing mode before sending it to the routing engine.

auto
/route, /matrix, /optimised_route, /isochrone, /map_match
Fastest car route.
auto_shorter
/route
Shortest car route.
bicycle
/route, /matrix, /optimised_route, /isochrone, /map_match
Bicycle routing.
bus
/route, /map_match
Bus routing.
pedestrian
/route, /matrix, /optimised_route, /isochrone, /map_match
Walking routing.
truck
/route, /matrix, /optimised_route, /isochrone
Truck / HGV routing.
motorcycle
/route, /matrix, /isochrone, /map_match
Motorcycle routing.
motor_scooter
/route, /isochrone
Scooter routing.
taxi
/route
Taxi routing.

Supported Costing Option Fields

auto
use_highways, use_tolls, use_ferry, use_living_streets, use_tracks, service_penalty, country_crossing_penalty, shortest, height, width, exclude_unpaved, top_speed
truck
height, width, length, weight, axle_load, axle_count, hazmat, use_highways, use_tolls, use_ferry, shortest, top_speed
bicycle
bicycle_type, cycling_speed, use_roads, use_hills, use_ferry, avoid_bad_surfaces, shortest
pedestrian
walking_speed, walkway_factor, sidewalk_factor, alley_factor, driveway_factor, step_penalty, use_ferry, use_living_streets, use_tracks, use_hills, use_lit, shortest, max_hiking_difficulty
motorcycle
use_highways, use_tolls, use_ferry, use_trails, shortest
motor_scooter
Same as motorcycle

System

System Endpoints

GET /health

Health Check

Returns whether the API process is running.

Request URL: https://YOUR-RAPIDAPI-HOST/health

Example Request

curl "https://YOUR-RAPIDAPI-HOST/health" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

{
  "status": "ok",
  "uptime": "12s"
}

Tiles

Tiles Endpoints

GET /sources

List Tile Sources

Returns all available vector tile sources.

Request URL: https://YOUR-RAPIDAPI-HOST/sources

Example Request

curl "https://YOUR-RAPIDAPI-HOST/sources" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

{
  "sources": [{
    "id": "africa",
    "name": "africa",
    "format": "pbf",
    "minzoom": 0,
    "maxzoom": 14,
    "bounds": "-20,-35,55,38",
    "center": "18.4,-33.9,6",
    "tiles": "https://YOUR-RAPIDAPI-HOST/tiles/africa/{z}/{x}/{y}",
    "tilejson": "https://YOUR-RAPIDAPI-HOST/tiles/africa"
  }]
}
GET /tiles/{source}

Get TileJSON

Returns TileJSON metadata for one source.

Request URL: https://YOUR-RAPIDAPI-HOST/tiles/{source}

Parameters

source
string
Required
Tile source ID returned by /sources.

Example Request

curl "https://YOUR-RAPIDAPI-HOST/tiles/{source}" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

{
  "tilejson": "3.0.0",
  "name": "africa",
  "attribution": "OpenStreetMap contributors",
  "scheme": "xyz",
  "format": "pbf",
  "tiles": ["https://YOUR-RAPIDAPI-HOST/tiles/africa/{z}/{x}/{y}"],
  "minzoom": 0,
  "maxzoom": 14,
  "bounds": [-20, -35, 55, 38],
  "center": [18.4, -33.9, 6],
  "vector_layers": []
}
GET /tiles/{source}/{z}/{x}/{y}

Get Vector Tile

Returns a Mapbox Vector Tile as binary protobuf bytes.

Request URL: https://YOUR-RAPIDAPI-HOST/tiles/{source}/{z}/{x}/{y}

Parameters

source
string
Required
Tile source ID returned by /sources.
z
integer
Required
Zoom level, 0 to 22.
x
integer
Required
XYZ tile column, 0 to (2^z) - 1.
y
integer
Required
XYZ tile row, 0 to (2^z) - 1.

Example Request

curl "https://YOUR-RAPIDAPI-HOST/tiles/{source}/{z}/{x}/{y}" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

HTTP/1.1 200 OK
Content-Type: application/x-protobuf
Cache-Control: public, max-age=86400

<binary tile data>

A valid coordinate with no tile returns 204.

If tile bytes are gzip-compressed, the response includes Content-Encoding: gzip.

POST /tiles/{source}/cache/clear

Clear Tile Cache

Clears in-memory tile bytes for a source.

Request URL: https://YOUR-RAPIDAPI-HOST/tiles/{source}/cache/clear

Parameters

source
string
Required
Source ID whose cached tile bytes should be cleared.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/tiles/{source}/cache/clear" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json"

Example Response

{
  "cleared": 125,
  "source": "africa"
}

Routing

Routing Endpoints

POST /route

Turn-by-Turn Route

Calculates turn-by-turn directions between two or more locations.

Request URL: https://YOUR-RAPIDAPI-HOST/route

JSON Body Fields

locations
Routing Location[]
Required
Ordered route stops. Minimum 2.
costing
string
Optional
Transport mode. Default: auto.
costing_options
object
Optional
Options for the selected costing mode.
directions_options
object
Optional
Controls instruction output.
avoid_locations
object[]
Optional
Points to avoid. Radius 0 to 200.
avoid_polygons
array
Optional
Polygon areas to avoid.
alternates
integer
Optional
Number of alternate routes, 1 to 3.
date_time
object
Optional
Routing-engine date/time object.
shape_format
string
Optional
polyline6, polyline5, or geojson. Default: polyline6.
linear_references
boolean
Optional
Include linear references when supported.
elevation_interval
number
Optional
Include elevation samples along the route.

Example Request

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" \
+  -H "Accept: application/json" \
+  -d '{
  "locations": [
    {"lon": 18.4241, "lat": -33.9249},
    {"lon": 18.8602, "lat": -33.9321}
  ],
  "costing": "auto",
  "directions_options": {
    "units": "kilometers",
    "language": "en-US",
    "directions_type": "instructions"
  },
  "alternates": 2,
  "shape_format": "polyline6"
}'

Example JSON Body

{
  "locations": [
    {"lon": 18.4241, "lat": -33.9249},
    {"lon": 18.8602, "lat": -33.9321}
  ],
  "costing": "auto",
  "directions_options": {
    "units": "kilometers",
    "language": "en-US",
    "directions_type": "instructions"
  },
  "alternates": 2,
  "shape_format": "polyline6"
}
POST /matrix

Matrix

Calculates a many-to-many travel time and distance matrix between sources and targets.

Request URL: https://YOUR-RAPIDAPI-HOST/matrix

JSON Body Fields

sources
Routing Location[]
Required
Origin locations. Minimum 1.
targets
Routing Location[]
Required
Destination locations. Minimum 1.
costing
string
Optional
auto, bicycle, pedestrian, truck, or motorcycle. Default: auto.
costing_options
object
Optional
Options for the selected costing mode.
units
string
Optional
kilometers or miles. Default: kilometers.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/matrix" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "sources": [{"lon": 18.4241, "lat": -33.9249}],
  "targets": [
    {"lon": 18.8602, "lat": -33.9321},
    {"lon": 18.4770, "lat": -33.9870}
  ],
  "costing": "auto",
  "units": "kilometers"
}'

Example JSON Body

{
  "sources": [{"lon": 18.4241, "lat": -33.9249}],
  "targets": [
    {"lon": 18.8602, "lat": -33.9321},
    {"lon": 18.4770, "lat": -33.9870}
  ],
  "costing": "auto",
  "units": "kilometers"
}
POST /optimised_route

Optimised Route

Finds the best order to visit multiple stops.

Request URL: https://YOUR-RAPIDAPI-HOST/optimised_route

JSON Body Fields

locations
Routing Location[]
Required
Stops to optimize. Minimum 2.
costing
string
Optional
auto, bicycle, pedestrian, or truck. Default: auto.
costing_options
object
Optional
Options for the selected costing mode.
directions_options
object
Optional
Controls instruction output.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/optimised_route" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "locations": [
    {"lon": 18.4241, "lat": -33.9249},
    {"lon": 18.8602, "lat": -33.9321},
    {"lon": 18.4770, "lat": -33.9870}
  ],
  "costing": "auto"
}'

Example JSON Body

{
  "locations": [
    {"lon": 18.4241, "lat": -33.9249},
    {"lon": 18.8602, "lat": -33.9321},
    {"lon": 18.4770, "lat": -33.9870}
  ],
  "costing": "auto"
}
POST /isochrone

Isochrone

Returns reachability contours from one location by time or distance.

Request URL: https://YOUR-RAPIDAPI-HOST/isochrone

JSON Body Fields

locations
Routing Location[]
Required
Exactly 1 origin location.
costing
string
Optional
auto, bicycle, pedestrian, truck, motorcycle, or motor_scooter. Default: auto.
costing_options
object
Optional
Options for the selected costing mode.
contours
object[]
Required
Each item uses time or distance.
polygons
boolean
Optional
Return polygons instead of lines. Default: true.
denoise
number
Optional
0 to 1.
generalize
number
Optional
>= 0.
show_locations
boolean
Optional
Include input locations. Default: true.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/isochrone" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "locations": [{"lon": 18.4241, "lat": -33.9249}],
  "costing": "auto",
  "contours": [{"time": 15}, {"time": 30}],
  "polygons": true,
  "show_locations": true
}'

Example JSON Body

{
  "locations": [{"lon": 18.4241, "lat": -33.9249}],
  "costing": "auto",
  "contours": [{"time": 15}, {"time": 30}],
  "polygons": true,
  "show_locations": true
}
POST /map_match

Map Match

Snaps a GPS trace to the road network and returns a matched route.

Request URL: https://YOUR-RAPIDAPI-HOST/map_match

JSON Body Fields

shape
object[]
Conditional
Raw GPS trace points. Provide shape or encoded_polyline.
encoded_polyline
string
Conditional
Encoded trace polyline. Provide shape or encoded_polyline.
shape_match
string
Optional
map_snap, edge_walk, or walk_or_snap. Default: map_snap.
costing
string
Optional
auto, bicycle, pedestrian, bus, or motorcycle. Default: auto.
costing_options
object
Optional
Options for the selected costing mode.
directions_options
object
Optional
Controls instruction output.
trace_options
object
Optional
Advanced trace matching options.
units
string
Optional
kilometers or miles. Default: kilometers.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/map_match" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "shape": [
    {"lon": 18.4241, "lat": -33.9249, "time": 0},
    {"lon": 18.4300, "lat": -33.9300, "time": 30},
    {"lon": 18.4400, "lat": -33.9350, "time": 60}
  ],
  "shape_match": "map_snap",
  "costing": "auto",
  "units": "kilometers"
}'

Example JSON Body

{
  "shape": [
    {"lon": 18.4241, "lat": -33.9249, "time": 0},
    {"lon": 18.4300, "lat": -33.9300, "time": 30},
    {"lon": 18.4400, "lat": -33.9350, "time": 60}
  ],
  "shape_match": "map_snap",
  "costing": "auto",
  "units": "kilometers"
}
POST /map_match/attributes

Map Match Attributes

Snaps a GPS trace to the road network and returns edge attributes.

Request URL: https://YOUR-RAPIDAPI-HOST/map_match/attributes

JSON Body Fields

request body
object
Required
Same request body as /map_match.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/map_match/attributes" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "encoded_polyline": "ENCODED_POLYLINE_STRING",
  "shape_match": "walk_or_snap",
  "costing": "auto",
  "trace_options": {}
}'

Example JSON Body

{
  "encoded_polyline": "ENCODED_POLYLINE_STRING",
  "shape_match": "walk_or_snap",
  "costing": "auto",
  "trace_options": {}
}
GET /costings

List Costings

Returns transport modes exposed by the API.

Request URL: https://YOUR-RAPIDAPI-HOST/costings

Example Request

curl "https://YOUR-RAPIDAPI-HOST/costings" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"
GET /costing/options/{costing}

Get Costing Options Schema

Returns the JSON schema for costing options for a supported mode.

Request URL: https://YOUR-RAPIDAPI-HOST/costing/options/{costing}

Parameters

costing
string
Required
auto, bicycle, pedestrian, truck, motorcycle, or motor_scooter.

Example Request

curl "https://YOUR-RAPIDAPI-HOST/costing/options/{costing}" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

{
  "costing": "auto",
  "options": {
    "properties": {
      "use_highways": {"type": "number", "minimum": 0, "maximum": 1},
      "use_tolls": {"type": "number", "minimum": 0, "maximum": 1}
    }
  },
  "usage": "Pass as costing_options.auto in your request body"
}

Elevation

Elevation Endpoints

GET /elevation

Single-Point Elevation

Looks up elevation for one point.

Request URL: https://YOUR-RAPIDAPI-HOST/elevation?lat=-33.9249&lon=18.4241

Parameters

lat
number
Required
Latitude.
lon
number
Required
Longitude.

Example Request

curl "https://YOUR-RAPIDAPI-HOST/elevation?lat=-33.9249&lon=18.4241" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Accept: application/json"

Example Response

{
  "lat": -33.9249,
  "lon": 18.4241,
  "elevation_m": 24.7
}
POST /elevation

Batch / Route Elevation

Looks up elevation for multiple points or an encoded route shape. Accepts either shape or encoded_polyline.

Request URL: https://YOUR-RAPIDAPI-HOST/elevation

JSON Body Fields

shape
Shape Point[]
Conditional
Explicit list of points. Required when encoded_polyline is not provided.
encoded_polyline
string
Conditional
Valhalla precision-6 encoded polyline. Required when shape is not provided.
range
boolean
Optional
If true, include cumulative distance in meters per point. Default: false.

Example Request

curl -X POST "https://YOUR-RAPIDAPI-HOST/elevation" \
+  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
+  -H "X-RapidAPI-Host: YOUR_RAPIDAPI_HOST" \
+  -H "Content-Type: application/json" \
+  -H "Accept: application/json" \
+  -d '{
  "shape": [
    {"lat": -33.9249, "lon": 18.4241},
    {"lat": -33.9321, "lon": 18.8602}
  ],
  "range": false
}'

Example JSON Body

{
  "shape": [
    {"lat": -33.9249, "lon": 18.4241},
    {"lat": -33.9321, "lon": 18.8602}
  ],
  "range": false
}

Example Response

{
  "height": [24.7, 112.3]
}

Maximum points: 2000 by default. The deployed API may enforce a different configured limit.

When range is true, the response uses range_height pairs: [cumulative_distance_m, elevation_m].