Address Autocomplete API
Geoapify Address Autocomplete API (Place Autocomplete) is used to implement location autocomplete fields. It returns suggestions for address or places fields based on provided part of the address.
The API allows developing address input fields with built-in location validation. Moreover, You can use the API to autocomplete fields. For example, you can autofill city and state from zip code.
Try the Place Autocomplete field and its parameters in the API Playground:
Authenfication and API key
If you don't have an API key, create one from our registration page. Once you register, you can get a Geocoding API key for free! For an overview of our plans, please take a look at our price page.
How to get Address Autocomplete API key
- Register on Geoapify MyProjects page
- Create a new project.
- Go to the API Keys section. One API key is generated automatically. You can generate multiple API keys per project if required.
- Optionally, you can protect the API key by listing allowed IP addresses, HTTP referrers, origins, and CORS.
- Choose "Address Autocomplete API" and an API key to get an URL and programming code.
- Press the "Try" button to execute the API call and get the result object.
The Address Autocomplete API accepts free-form addresses and address parts as input, and delivers a JSON, GeoJSON, and XML object in response. In addition, you can specify location filters and biases to make the location search more focused.
Here are examples of the Autocomplete URLs in action:
- Simple address search (
"Lessingstraße 3, Regensburg"):
- Cities suggestions for
- German cities suggestions for
- German postcodes suggestions for
|apiKey||Required parameter for API key||apiKey=c3da27885e3573e09e550d044bc55e22|
|text||An address or part of the address to search||text=Auts|
|type||Location type. Possible values: 'country', 'state', 'city', 'postcode', 'street', 'amenity'.||type=postcode|
|lang||Result language. 2-character ISO 639-1 language codes are supported.||lang=de|
|filter||Filter places by country, boundary, circle. See the Location Filters in Geocoding API, for more details.||filter=rect:-122.569140,37.936672,-122.5324795,37.9588474|
|bias||Prefer places by country, boundary, circle, location. See the Location Bias in Geocoding API, for more details.||bias=proximity:-122.52985959,37.95335060|
|format||Response object type: 'json', 'xml', or 'geojson' (default).||format=json|
Depending on the format parameter, the API returns GeoJSON.FeatureCollection, JSON, or XML object as a result. Each returned address contains the following address details:
|country||Country component of the address|
|country_code||ISO 3166-1 alpha-2 country code|
|state||State component of the address|
|state_code||State shortcode, the shortcode might be missing for some countries and languages|
|county||County component of the address|
|county_code||County shortcode, the shortcode might be missing for some countries and languages|
|postcode||Postcode or ZIP code of the address|
|city||City component of the address|
|street||Street component of the address|
|housenumber||House number component of an address|
|lat, lon||Coordinates of the location|
|address_line1||Main part of the display address, contains building street and house number or amenity name|
|address_line2||The second part of the display address, contains address parts not included to address_line1|
|result_type||Found location type. Can take values from [
|distance||Distance in meters to given
|rank||Calculated rank for the result|
|rank.confidence||Confidence value, takes values from 0 to 1|
|rank.confidence_city_level||City-level confidence, takes values from 0 to 1. Evaluates if the city is correct.|
|rank.confidence_street_level||Street-level confidence, takes values from 0 to 1. Evaluates if the street is correct.|
|rank.match_type||Match type between requested address and result address. Can take values from [
|datasource||Contains name of data source and data specific for the data source|
|category||A place category from the list of Places API Categories|
Note! Depending on the type of returned location some fields may be missing. For example, the "Asia" continent doesn't have a specific country, state and so on.
Typically, you would have the Address Autocomplete API as a part of address input and validation forms. So in this section, we will focus more on how to implement the autocomplete functionality.
We've prepared for you Step by Step tutorial showing how to create an Address Autocomplete field from scratch and NPM-packages that let you integrate Autocomplete API into your application as a module: