AutoPostcode
Guide · Developer

How to add postcode lookup to a website

Adding UK postcode lookup to any website takes three steps and a single REST call. This guide gives you copy-paste code to get from zero to a working PAF-verified address finder in minutes.

No card required · Royal Mail PAF-verified data

Trusted UK address intelligence

3 steps
to a working lookup
1 endpoint
REST + JSON
31M+
PAF addresses
PAF-verified address lookup
Fast REST API & no-code plugins
GDPR-friendly, UK-hosted

To add postcode lookup to a website, complete three steps: get an API key, call the AutoPostcode REST endpoint with the user's postcode, and render the returned Royal Mail PAF addresses into your form. The data covers ~31M UK delivery points across ~1.8M postcodes, and any language that can make an HTTP request can integrate in minutes.

~31M
UK addresses in PAF
~1.8M
UK postcodes
99.9%
lookup uptime

Step 1 — How do I get an API key?

Create a free account and generate an API key from your dashboard. No card is required to start, and the same key works across the postcode lookup API and autocomplete endpoints.

Step 2 — How do I call the lookup endpoint?

Make a single authenticated GET request with the postcode. Proxy it through your backend so your key stays secret:

// server-side handler
const res = await fetch(
  "https://api.autopostcode.com/v1/lookup?postcode=" + encodeURIComponent(postcode),
  { headers: { Authorization: "Bearer " + process.env.AUTOPOSTCODE_KEY } }
);
const { addresses } = await res.json();
// addresses: [{ line1, line2, town, postcode, uprn }, ...]

Step 3 — How do I render the results?

Drop a postcode field and a results dropdown into your form and populate it from the response:

<label>Postcode <input id="pc" /></label>
<button id="find">Find address</button>
<select id="results"></select>

<script>
document.getElementById("find").onclick = async () => {
  const pc = document.getElementById("pc").value;
  const r = await fetch("/api/lookup?postcode=" + encodeURIComponent(pc));
  const { addresses } = await r.json();
  const sel = document.getElementById("results");
  sel.innerHTML = addresses
    .map(a => "<option>" + a.line1 + ", " + a.town + ", " + a.postcode + "</option>")
    .join("");
};
</script>
Keep your API key on the server. Calling the API directly from the browser is fine for a quick prototype, but proxy it in production to avoid exposing the key.

Should I use lookup or autocomplete?

PatternBest forUX
Postcode lookupSimple formsEnter postcode, pick address
Search-as-you-typeHigh-traffic checkoutType a few chars, pick instantly

For the second pattern, follow the JavaScript autocomplete tutorial, or start with the API quickstart.

A UK-first, affordable alternative

AutoPostcode uses the same Royal Mail PAF data as Loqate, Fetchify and Ideal Postcodes, with a developer-friendly REST API and clearer pricing.

Frequently asked questions

How do I add postcode lookup to a website?

Add postcode lookup in three steps: get an API key, call the AutoPostcode REST endpoint with the user's postcode, and render the returned Royal Mail PAF addresses into your form. Any language or framework that can make an HTTP request works.

Do I need a backend to add postcode lookup?

Not necessarily. You can call the API from the browser for prototypes, but for production it's best to proxy the request through your own backend so your API key stays secret.

What data does the lookup return?

Each lookup returns a JSON array of matching UK addresses from Royal Mail PAF — line1, line2, town, postcode and a UPRN — covering ~31M delivery points across ~1.8M postcodes.

How fast is a postcode lookup?

Lookups typically resolve in milliseconds over a fast REST API with 99.9% uptime, so the experience feels instant as the user types or clicks 'Find address'.

Can I add postcode lookup without coding?

Yes. AutoPostcode offers no-code plugins for platforms like WordPress/WooCommerce and Shopify, so non-developers can add lookup without writing code.

Is the address data Royal Mail PAF?

Yes. AutoPostcode is built on Royal Mail PAF, the authoritative UK address file, so every returned address is real and correctly formatted.

Ready to get started?

Add Royal Mail PAF-verified UK address lookup to your site in minutes — start free, no card required.