Autocomplete API for countries, cities and airports
In this article describe how to work with Travelpayouts 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
Example of response
[
{
"code": MOW,
"main_airport_name": null,
"country_cases": null,
"index_strings":[
maskava,
moscow
],
"weight": 1006321,
"cases": {
"da": "Москве",
"tv": "Москвой",
"vi": "в Москву",
"pr": "Москве",
"ro": "Москвы"
},
"country_name": "Россия",
"type": city,
"country_code": RU,
"coordinates": {
"lon": 37.617633,
"lat": 55.755786
},
"name": "Москва",
"state_code": 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