Autocomplete

GET https://api.weatherstack.com/autocomplete?query=london

The weatherstack API's location autocomplete endpoint can be used to pinpoint one or more specific locations and their identifying response objects with the aim of later passing them to a weather data endpoint. In our example below, we are looking for London, United Kingdom.

A successful API request will return one or multiple results that match your search query. In our example, the first array object (London, United Kingdom) contains the correct result. Now that we have our identifying response objects of the target location we were looking for, we can make sure that the correct location is used by other API endpoints by using one of the available location identifiers (ideally: lat and lon) for upcoming queries.

Request Params

KeyDatatypeRequiredDescription
querystring[Required] Use this parameter to pass your location search/autocomplete query to the API in free-text.

RESPONSES

status: OK

{"request":{"query":"london","results":2},"results":[{"name":"London","country":"United Kingdom","region":"City of London, Greater London","lat":"51.517","lon":"-0.106","timezone_id":"Europe/London","utc_offset":"0.0"},{"name":"London","country":"Canada","region":"Ontario","lat":"42.983","lon":"-81.250","timezone_id":"America/Toronto","utc_offset":"-4.0"}]}