List Locations
Search locations with boat counts and geographic aggregation
Endpoint
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.
Search and list locations with boat and POI counts. Returns both individual locations (marinas, anchorages) and aggregated geographic results (cities, states, countries) when a search query matches higher-level regions.
Named sailing regions — "Dalmatia", "the Dodecanese", "the Cyclades" — are also returned (in boats mode only), as type: 'region'. These are not administrative areas and have no location row of their own: they span whichever marinas fall inside the region, including the mainland ports charters depart from. Pass a region row's id as the l parameter on the site, or its name as location_type=text&location_value=… to /api/boats.
Results are cached for 5 minutes.
Authentication
From your server, send X-API-Key: YOUR_API_KEY on every call, like every other Operator API endpoint — without it Cloudflare bot protection answers with an HTML 403 page, not JSON. This exact path (GET /api/locations, not its sub-routes) is also the one read route that answers cross-origin browser calls (Access-Control-Allow-Origin: *) without a key — that is what powers the embeddable search widget's location box. See Authentication.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | No | Search query (minimum 2 characters). Ignored when ids is supplied |
limit | number | No | Max results (default: 20, max: 200) |
ids | string | No | Comma-separated numeric location IDs to fetch directly (returns the { "locations": [...] } shape). Slugs are not accepted here |
mode | string | No | Which count drives ranking: boats (default), places (POI count), or trips (trip count — returned in the poi_count field) |
boat_type | string | No | When set (in boats mode), counts only that boat type and drops marinas with 0 of it |
Example Requests
Search by Name
Fetch by IDs
Example Response (Search)
Aggregate rows (country/state/municipality/city) carry boat_count: 0 and poi_count: 0 — use location_count to gauge their size. Marina rows carry the real boat_count.
region rows are the exception: they carry a real boat_count, and are only returned when it is greater than zero.
Aggregate ids are built from the row's state and country, and a place whose state is missing gets the literal text null in that slot (city:Municipal Unit of Lefkada:null:gr above). Treat aggregate ids as opaque keys — don't parse them, and don't assume a missing state is rendered as an empty segment.
Example Response (IDs)
When ids is supplied the endpoint returns an object with a locations array (unpublished locations are left out). Each row includes the slug (use it to build /locations/{slug} links), the raw count JSON (boat_counts, poi_counts, trip_counts) alongside the derived boat_count / poi_count scalars.
Response Fields (Search)
| Field | Type | Description |
|---|---|---|
id | number|string | Location ID (number) or aggregate key (e.g. municipality:Lefkada Municipality:Ionian Islands:gr) |
type | string | Result type: marina, city, municipality, state, country, or region |
name | string | Location or region name |
lat | number | Latitude (center point for aggregates) |
lon | number | Longitude (center point for aggregates) |
city | string|null | City name |
state | string|null | State or region |
country | string|null | Country name |
country_code | string|null | ISO country code (lowercase, e.g. gr) |
location | string | Formatted location string |
boat_count | number | Number of published boats (0 on aggregate rows; 0 on marina rows outside boats mode) |
poi_count | number | Points of interest in places mode, trips in trips mode, 0 in boats mode (always 0 on aggregate rows) |
harbour_category | string|null | Type of harbour (marina type only) |
location_count | number | Number of locations in this region (aggregate types only) |
Sorting
Results are sorted by:
- Type: country, region, state, municipality, city, then marina
- Within a type, by the mode's count descending —
boat_countinboatsmode,poi_countinplaces/tripsmode
With boat_type set (in boats mode), marina rows with none of that type are dropped.