Charter Boats
Charter Boats API
Locations

Search Locations

Typeahead search for marinas, anchorages, and bays

Endpoint

GET /locations/search

Description

A location is an overnight stop — a marina, harbour, or anchorage where you can berth or drop anchor and spend the night aboard your boat. (Towns and regions aren't locations; they only appear as aggregated groupings.)

Fast typeahead search for locations (marinas, anchorages, bays). Uses normalized matching that handles special characters -- for example, searching "dalbora" matches "d'Albora Marina".

Returns a lightweight response suitable for autocomplete UIs.

Authentication

Send X-API-Key: YOUR_API_KEY on every call from outside charter.boats — without it Cloudflare bot protection answers with an HTML 403 page, not JSON. Call it from your server: this route sends no CORS headers (only the exact GET /api/locations index does). See Authentication.

Query Parameters

ParameterTypeRequiredDescription
qstringYesSearch query (minimum 2 characters)
limitnumberNoMax results (default: 10, max: 20)

Example Request

curl "https://charter.boats/api/locations/search?q=lefkas&limit=5" \
  -H "X-API-Key: YOUR_API_KEY"

Example Response

[
  {
    "id": 11335,
    "osm_id": 119160915,
    "name": "Lefkas Main Port",
    "lat": 38.8302965,
    "lon": 20.7114541,
    "city": "Municipal Unit of Lefkada",
    "state": "Ionian Islands",
    "country": "Greece",
    "harbour_category": "marina"
  },
  {
    "id": 21214,
    "osm_id": -61040274,
    "name": "Lefkas, Lygia Marina",
    "lat": 38.789125,
    "lon": 20.722885,
    "city": "Municipal Unit of Lefkada",
    "state": "Ionian Islands",
    "country": "Greece",
    "harbour_category": "marina"
  },
  {
    "id": 11336,
    "osm_id": 119160925,
    "name": "D-Marin Lefkas",
    "lat": 38.8289054,
    "lon": 20.7113582,
    "city": "Municipal Unit of Lefkada",
    "state": "Ionian Islands",
    "country": "Greece",
    "harbour_category": "marina"
  }
]

Response Fields

FieldTypeDescription
idnumberLocation ID
osm_idnumber|nullOpenStreetMap node ID
namestringLocation name
latnumberLatitude
lonnumberLongitude
citystring|nullCity name
statestring|nullState or region
countrystring|nullCountry name
harbour_categorystring|nullType of harbour (e.g. marina, harbour, anchorage)

Notes

  • Returns an empty array if q is missing or shorter than 2 characters.
  • Matching ignores case, accents and punctuation. A location matches when its name contains the query, when its city/region/country text contains it, or — for a multi-word query — when every word appears somewhere in the name, city, region or country, in any order ("marina frapa rogoznica").
  • Results are ordered: names that start with the query first, then names that contain it, then city/region/country text matches, then all-words matches; ties are alphabetical by name. There is no popularity or boat-count ranking here — use List Locations for that.
  • Only published locations are searched, and places without a name are never returned (an unnamed anchorage is not matched through its town's name).

On this page