GET /v1/places/nearby
The airports (and optionally cities) closest to a place or a coordinate pair, nearest first – for finding an alternative departure airport serving the same trip. Pass either place (a code, resolved to coordinates here) or latitude+longitude, never neither.
Operation ID: getNearbyPlaces
Parameters
| Name | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
place |
query | string | no | length 1..100 | Place code to search around (e.g. LON, LHR). Resolved to coordinates before the upstream call. |
latitude |
query | number | no | -90..90 | Latitude of the point to search around, decimal degrees (-90 to 90). Give latitude and longitude together; use either this pair or place, never both. |
longitude |
query | number | no | -180..180 | Longitude of the point to search around, decimal degrees (-180 to 180). Give latitude and longitude together; use either this pair or place, never both. |
types |
query | city | airport | state | district | hotel[] |
no | items 1..*; each of city, airport, state, district, hotel |
Place types to resolve; repeat or comma-separate to mix. |
locale |
query | string | no | length 1..35; default "en" |
Language tag for localized place names (e.g. en, ar). Defaults to en. |
pageSize |
query | integer | no | 1..50; default 50 |
Max results (1-50). Defaults to 50, the maximum, because this read wants the complete set of nearby places, not a page of it. The upstream returns roughly ten rows and ignores paging, so pageSize can only narrow that set, never reach further. |
Responses
| Status | Description |
|---|---|
200 |
Nearby places, nearest first, plus the origin they were measured from. |
400 |
Neither a place nor a coordinate pair, an out-of-range coordinate, or a place code that resolves to nothing with coordinates. |
401 |
Missing or invalid bearer token. |
429 |
Rate limit exceeded; retry after the Retry-After seconds. |
502 |
The upstream places service returned an invalid response. |
503 |
The places service is temporarily unavailable; retry after the Retry-After seconds. |
200 body
| Field | Type | Always present | Description |
|---|---|---|---|
results |
object[] | yes | The nearby places found around the origin. |
↳ id |
number | string | no | Opaque identifier, unique per place. Do not send it to other endpoints or build wego.com URLs from it: reference a place by code, or by cityCode for a hotels search. |
↳ code |
string | no | IATA-style code (airport/city), when the place has one. |
↳ name |
string | yes | Display name of the place. |
↳ type |
string | yes | Place kind: city, airport, state, district or hotel. |
↳ cityCode |
string | no | Code of the city this place belongs to. |
↳ latitude |
number | no | Latitude in decimal degrees, when known. |
↳ longitude |
number | no | Longitude in decimal degrees, when known. |
metadata |
object | yes | Pagination and the resolved origin for this nearby search. |
↳ resultCount |
integer | yes | Number of results on the current page (always <= pageSize). |
↳ totalCandidates |
integer | yes | Rows the upstream returned before this page was sliced. The upstream ignores per_page and answers with roughly ten rows, so pageSize can only narrow this, never reach further. |
↳ hasMore |
boolean | yes | True when pageSize clipped the upstream rows. |
↳ origin |
object | yes | The point the nearby search ran from, and how it was derived. |
Example
curl -s -H "Authorization: Bearer $TOKEN" \
"https://api.wego.com/v1/places/nearby"