Cookie

Cookie consent

We use some essential cookies to make this website work. We'd like to set additional cookies to help us measure your experience when you view and interact with the website.

Cookie policy

Sample code for address lookup

This page provides sample code to help you set up Postcoder address lookup.

You'll need an API key for these examples. Not got one? Sign up for a free trial.

Address autocomplete

This JavaScript example displays real-time suggestions as the user types in their address or postcode, and populates an address form with the selected address. It uses the autocomplete/find endpoint for the suggestions and the autocomplete/retrieve endpoint to retrieve the selected address. All countries are supported.

Address and postcode lookup

This JavaScript example displays a list of addresses that match the postcode or address entered by the user after they click the Find button, and populates an address form with the selected address. It uses the address endpoint and supports all countries.

Address lookup in other languages

These examples show how to make a request to the address endpoint to look up an address.

OS NGD autocomplete

This JavaScript example displays real-time suggestions from the OS National Geographic Database (NGD) as the user types in their address or postcode, and populates a form with the selected NGD record. It uses the ngd/find endpoint for the suggestions and the ngd/retrieve endpoint to retrieve the selected NGD record.