This is the core pattern for a fast UK address search box using plain JavaScript and the autocomplete API.
Build it in five steps
- Add a postcode input and an empty suggestions list element
- Debounce the input event so you call the API ~300ms after typing stops
- Fetch suggestions through your server proxy and render them
- On click, populate address, town, county and postcode fields
- Validate on submit and offer manual entry as a fallback
Framework versions
For component frameworks, see React address autocomplete. To get a key, start with the API quickstart.
Next steps
Read the REST API reference and plan for error handling.
Frequently asked questions
How do I build address autocomplete in JavaScript?
Listen to the postcode input, debounce it, call the autocomplete API, render the returned addresses as a list, and on click populate your form fields with the selected PAF-verified address.
Do I need a framework?
No — plain JavaScript with fetch works. The same pattern applies in React, Vue or Svelte.
How do I keep my API key safe?
Proxy requests through your own server endpoint so the key is never exposed in browser code.
Ready to get started?
Add Royal Mail PAF-verified UK address lookup to your site in minutes — start free, no card required.
