Skip to main content

Search destinations

GET /api/destinations/search

Search for travel destinations (cities and airports) using SerpAPI Google Flights autocomplete.

Request

Authentication: None required (internal API) Query parameters:
q
string
required
Search query (minimum 2 characters)
airports_only
string
Set to "1" or "true" to return only airport results

Response

ok
boolean
required
Indicates if the request was successful
data
array
Array of destination suggestions (up to 20)
error
string
Error message if ok is false

Example request

curl "http://localhost:8080/api/destinations/search?q=paris"

Example response

{
  "ok": true,
  "data": [
    {
      "id": "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
      "name": "Paris",
      "displayName": "Paris - France",
      "type": "city",
      "iataCode": "CDG",
      "cityName": "Paris",
      "countryCode": null
    },
    {
      "id": "CDG",
      "name": "Charles de Gaulle Airport",
      "displayName": "Charles de Gaulle Airport (CDG), Paris",
      "type": "airport",
      "iataCode": "CDG",
      "cityName": "Paris",
      "countryCode": null
    },
    {
      "id": "ORY",
      "name": "Orly Airport",
      "displayName": "Orly Airport (ORY), Paris",
      "type": "airport",
      "iataCode": "ORY",
      "cityName": "Paris",
      "countryCode": null
    }
  ]
}

Example request (airports only)

curl "http://localhost:8080/api/destinations/search?q=london&airports_only=1"

Example response (airports only)

{
  "ok": true,
  "data": [
    {
      "id": "LHR",
      "name": "Heathrow Airport",
      "displayName": "Heathrow Airport (LHR), London",
      "type": "airport",
      "iataCode": "LHR",
      "cityName": "London",
      "countryCode": null
    },
    {
      "id": "LGW",
      "name": "Gatwick Airport",
      "displayName": "Gatwick Airport (LGW), London",
      "type": "airport",
      "iataCode": "LGW",
      "cityName": "London",
      "countryCode": null
    }
  ]
}

Error responses

ok
boolean
false when error occurs
error
string
Error description
Status codes:
  • 400 - SerpAPI request error
  • 503 - SerpAPI key not configured
  • 502 - SerpAPI service error
  • 500 - Internal server error
Special cases:
  • Returns empty data array for queries shorter than 2 characters
  • Excludes region-type results (only cities and airports)
  • City results include the first airport’s IATA code in iataCode field

Build docs developers (and LLMs) love