API / Search
GET /search

Search API.

Autocomplete search across addresses, streets, places, and POIs. Optimised for sub-20ms latency.

Also known as forward geocoding - takes a text query and returns ranked results with coordinates, structured address components, and confidence scores. Fuzzy-matched and proximity-aware.

Part of the Search API family alongside Reverse Search and Search Detail.

API OPERATIONAL · View status
# Address autocomplete - call on keystroke after 2 chars
curl "https://api.farun.one/search" \
  -H "X-RapidAPI-Key: YOUR_KEY" \
  -H "X-RapidAPI-Host: farun-maps.p.rapidapi.com" \
  -G \
  --data-urlencode "q=Bree Street" \
  --data-urlencode "types=address,street" \
  --data-urlencode "lat=-33.92" \
  --data-urlencode "lon=18.42" \
  --data-urlencode "size=5"

Latency

< 20ms typical

Min query

2 characters

Max results

25 per request

Search engine

Three-layer query, sub-20ms results.

The search engine runs three query layers simultaneously - edge-ngram autocomplete for typing speed, per-field matching for accuracy, and fuzzy fallback for typo tolerance. Results are ranked by a combination of text relevance, place importance, and proximity to your provided location.

Layer 1

Edge-ngram autocomplete

Matches partial word prefixes against a pre-indexed edge-ngram field. This is the primary driver, catches typing in progress ('Cape T…' → 'Cape Town') with the lowest latency.

Boost: 6x. Main driver for live search.

Layer 2

Per-field matching

Runs individual matches against street, name, suburb, city, housename, and postcode fields with field-level boosts. Exact postcode matches are boosted highest (8x) to surface administrative areas cleanly.

Boosts: street 4x, suburb 3x, postcode 8x.

Layer 3

Fuzzy typo fallback

When layers 1 and 2 don't produce confident matches, a fuzzy query with AUTO fuzziness and prefix_length=1 catches typos and transpositions. Kicks in only when needed, doesn't slow down the common case.

Fuzziness: AUTO. Prefix length: 1.

Result ranking

Cities surface above streets. Nearby results float up.

Every result is scored by a combination of text relevance, place rank, and optional proximity. Place rank weights cities and towns above raw address records so "Cape Town" appears before "12 Cape Town Street" when the query is ambiguous.

  • Rank ≤ 3 (cities, regions) 4x weight boost
  • Rank ≤ 8 (towns, suburbs) 2x weight boost
  • Rank ≤ 15 (localities) 1.3x weight boost
  • Proximity (if lat/lon provided) Gaussian decay, 15km scale, 3x weight
Example response - GET /search?q=Bree+Street 200 OK
{
  "query":   "Bree Street",
  "total":   42,
  "took_ms": 8,
  "results": [
    {
      "id":           "way/123456789",
      "score":        24.871,
      "doc_type":     "street",
      "display_name": "Bree Street, Cape Town City Bowl",
      "street":       "Bree Street",
      "suburb":       "Cape Town City Bowl",
      "city":         "Cape Town",
      "postcode":     "8001",
      "province":     "Western Cape",
      "country":      "ZA",
      "location": { "lat": -33.9249, "lon": 18.4241 },
      "osm_id":       "123456789"
    }
    // … more results
  ]
}

Note: geometry is excluded from list results. Use Search Detail to fetch GeoJSON geometry for a selected result.

Who uses it

Anywhere a user types a location.

The Search API is the entry point for any location-aware input field. It converts what a user types into a coordinate and structured address which then feeds routing, isochrones, map rendering, or any other spatial workflow downstream.

Dispatch & Logistics

Destination autocomplete

Let dispatchers or drivers type a delivery address and resolve it to a coordinate before passing to the Routing API. Use lat/lon to bias results toward the fleet's current operating region.

SaaS Products

Address input fields

Power any address input with live autocomplete. Call on every keystroke from character 2 onwards. Filter by types=address to restrict to physical addresses only, or include poi for business search.

Insurance

Policy address validation

Resolve a declared property address to coordinates and structured components at submission time. Cross-check street, suburb, and postcode fields against the form input to catch mis-declared locations.

Field Operations

POI and landmark search

Let field crews search for fuel depots, hospitals, weigh stations, or operational landmarks by name. Use types=poi to restrict results to points of interest rather than addresses.

Endpoint reference

GET https://api.farun.one/search

Query parameters

q req
string
Search query - address, place name, POI, or postcode. Minimum 2 characters.
types
string
Comma-separated filter: address · street · place · poi. Omit to search all types.
lat
float
Latitude for proximity bias. Pairs with lon. Results near this point are ranked higher.
lon
float
Longitude for proximity bias. Pairs with lat.
size
integer
Max results to return. Default: 10. Max: 25.

Response fields

id Document ID - pass to /search/detail/{id} to fetch full geometry
score Relevance score from Elasticsearch - use to rank or filter results
doc_type address · street · place · poi
display_name Full human-readable result label
location {"lat": float, "lon": float} - coordinate of the result
street Street name component
suburb Suburb / neighbourhood component
city City component
postcode Postal code
took_ms Elasticsearch internal query time in milliseconds

Response codes

200 application/json Results array. Empty array if no matches within query.
400 Bad request q missing or shorter than 2 characters.
401 Unauthorized Missing or invalid RapidAPI key.
429 Rate limited Daily pool exhausted. Upgrade on RapidAPI.
503 Service unavailable Search backend unavailable.

Integration example

Debounced autocomplete - JavaScript JavaScript
// Call via a server-side proxy - never expose key client-side
let debounce: ReturnType<typeof setTimeout>;

async function onInput(value: string, userLoc: {lat: number; lon: number}) {
  clearTimeout(debounce);
  if (value.length < 2) return;

  debounce = setTimeout(async () => {
    const params = new URLSearchParams(
      q:     value,
      lat:   String(userLoc.lat),
      lon:   String(userLoc.lon),
      size:  '7',
    );

    const res  = await fetch(`/api/search-proxy?$${params}`);
    const data = await res.json();

    renderDropdown(data.results.map(r => (
      label: r.display_name,
      lat:   r.location.lat,
      lon:   r.location.lon,
      id:    r.id,   // pass to /search/detail for geometry
    )));
  }, 180); // 180ms debounce
}

Always proxy server-side. Never call the Search API directly from client-side JavaScript, your RapidAPI key would be exposed. Route requests through your own backend.

Min query length

2 characters

Typical latency

< 20ms (ES internal)

Max results

25 per request

Doc types

address · street · place · poi

Proximity bias

Gaussian decay, 15km scale

Geometry

Excluded - use Search Detail

Search API family

Often used together

Start building

A place name to coordinates
in under 20ms.

Free tier on RapidAPI. 1,000 requests per day across all non-tile APIs combined. No credit card required.