Use this guide to autocomplete the names of airports, cities, or countries in the search.
In this article describe how to work with Aviasales autocomplete API.
To autocomplete cities or airports in your search, use a GET request of the following form:
http://autocomplete.travelpayouts.com/places2?term=Mos&locale=en&types[]=country&callback=function
- term — Text for searching (the main parameter)
- locale — The output language (the list of supported languages at the end of the article)
- types[] — An array that specifies the type of autocomplete search (city, airport, country)
- callback — A parameter for backward compatibility of clients running on jsonp
Request example
https://autocomplete.travelpayouts.com/places2?locale=en&types[]=airport&types[]=city&term=lond
Response example
[ { "type": "airport", "code": "LHR", "name": "London Heathrow Airport", "country_code": "GB", "country_name": "United Kingdom", "city_code": "LON", "city_name": "London", "state_code": null, "coordinates": { "lon": -0.453566, "lat": 51.469604 }, "index_strings": [ "aeroportul heathrow din londra", "bandar udara internasional london heathrow" ], "weight": 11439, "cases": null, "city_cases": null, "country_cases": null } ]
Response parameters
- code — IATA city/airport code
- main_airport_name — Airport name (if available)
- country_cases — Service parameter
- index_strings — Variants of queries in different languages and in different layouts
- weight — Service parameter
- cases — The name of the city in various cases (only for ru locale)
- country_name — name of the country
- type — Type of object (city / airport / country)
- country_code — IATA country code
- coordinates — An object’s coordinates
- name — The name of the city / airport
- state_code — State code (if available)
Supported languages
- ar — Arabic
- bg — Bulgarian
- cs — Czech
- da — Danish
- de — German
- el — Greek
- en — English
- es — Spanish
- fa — Persian
- fi — Finnish
- fr — French
- he — Israeli
- hi — Indian
- hr — Croatian
- hu — Hungarian
- id — Indonesian
- it — Italian
- ja — Japanese
- ka — Georgian
- ko — Korean
- lt — Italian
- lv — Latvia
- ms — Malaysian
- nl — Dutch
- no — Norwegian
- pl — Polish
- pt — Portuguese
- ro — Romanian
- ru — Russian
- sk — Slovak
- sl — Slovenian
- sr — Serbian
- sv — Swedish
- th — Thai
- tl — Filipino
- tr — Turkish
- uk — Ukrainian
- vi — Vietnamese
- zh-Hans — Chinese traditional
- zh-Hant — Chinese simplified