Address Autocomplete API: Autofill Addresses as the User Types

Linda Koeleman, Customer Success Lead

Address Autocomplete API: Autofill Addresses as the User Types

The fastest address form is the one nobody has to fill in. Address autocomplete, sometimes called address autofill or predictive address search, replaces a stack of fields with a single box: the customer types a few characters, sees a short list of real addresses, picks theirs, and the rest of the form completes itself.

It is the highest-leverage change you can make to a checkout, because it reduces both the effort and the error rate at the same time.

How address autocomplete works

There are two calls, not one, and understanding the split explains most of the pricing models in this market.

Search. As the customer types, the front end sends the partial input to a search endpoint, which returns a list of candidate addresses. These candidates are usually abbreviated, enough to recognise but not the complete record.

Retrieve. When the customer picks one, the front end sends its identifier to a second endpoint and gets the full, structured address back.

Search is cheap and happens many times per address. Retrieve is the expensive one and happens once. Providers who advertise "free autocomplete" are almost always giving away search and billing retrieve, which is a reasonable model as long as you know that is what is happening.

Autofill in a checkout: fewer fields, fewer errors

Replacing five fields with one has three effects. The obvious one is speed. The second is a lower abandonment rate, since every field in a checkout costs you some proportion of customers. The third, and the one that pays for the API, is that the customer can no longer mistype the street, because they never type it.

Some practical guidance:

  • Start suggesting early, at around three characters, but debounce the input so you are not firing a request per keystroke.
  • Keep the list short. Five to eight suggestions is enough. A list of forty is a worse experience than a postcode field.
  • Always allow manual entry. Some addresses will not be in the data, and a customer who cannot enter theirs is a customer who leaves.
  • Show what was filled in. Populating hidden fields makes people nervous. Show the completed address and let them edit it.

Autocomplete, lookup and validation: how they fit together

These three are often sold together and are easy to confuse:

  • Autocomplete is the input layer. It suggests while the customer types.
  • Lookup is the retrieval layer. Given a postcode, or an identifier from an autocomplete suggestion, it returns the full address.
  • Validation is the checking layer. Given a complete address, it confirms the parts belong together and normalises them.

Autocomplete plus lookup gets you a clean address for anyone who uses the search box. You still want a validation step for addresses that arrive by other routes: manual entry, a CSV import, an order from a marketplace, an API call from a partner.

Building the front end

The server side of autocomplete is simple. The front end is where the work is.

Debounce the input at around 150 to 300 milliseconds. Cancel in-flight requests when the input changes, or you will get older responses arriving after newer ones and overwriting them. Keep a small client-side cache keyed on the query string, because customers backspace constantly and you should not pay for the same search twice.

Handle the empty result explicitly. "No matching addresses, enter yours manually" is a fine outcome. A spinner that never resolves is not.

Accessibility and keyboard behaviour

An autocomplete is a combobox, and it has expected behaviour that people rely on:

  • Arrow keys move through the suggestions, Enter selects, Escape closes the list and keeps what was typed.
  • The field has to be identified to assistive technology as a suggestion list, and it has to signal which option is currently highlighted.
  • Announce the number of results in a live region so a screen-reader user knows suggestions appeared.
  • The whole flow must work without a mouse, and it must remain usable if the API is slow or unavailable.

An address field that only works for sighted mouse users is an address field that loses orders and creates a compliance problem at the same time.

Where Pro6PP fits

Pro6PP provides address autocomplete and postcode lookup for England, the Netherlands, Belgium, Germany, France, Italy, Luxembourg, Denmark, Austria, Switzerland and Spain, with global reverse geocoding. Search and retrieve run against the same endpoint family in every country, so one autocomplete component serves your whole footprint.

Autocomplete is one layer of a larger picture. How postcode lookup, validation and geocoding fit together puts it in context.

Frequently asked questions

What is the difference between address autocomplete and address autofill?

They usually mean the same thing. "Autocomplete" describes the suggestions appearing as you type; "autofill" describes the remaining fields being populated once you choose one. Note that browsers also have their own autofill, based on data the user has saved, which is a separate mechanism you do not control.

How many characters before autocomplete should start?

Around three. Fewer produces a list too long to be useful and burns requests; more makes the feature feel unresponsive.

Does address autocomplete replace validation?

For addresses chosen from the suggestion list, effectively yes, because those came from the address database. It does not cover addresses that arrive through manual entry, imports or partner APIs, which still need validating.

Is address autocomplete free?

The search step often is. The retrieve step, which returns the full address, is normally what providers bill for. Check which of the two your expected volume applies to before comparing prices.

Can I use address autocomplete on a mobile app?

Yes, the API is the same. Put the key on your server rather than in the app binary, and be more aggressive with debouncing on mobile networks.

Next steps