To validate UK addresses via API, send a postcode or address to the AutoPostcode validation endpoint with your API key as a Bearer token; it checks the input against Royal Mail PAF and returns whether the address is deliverable, the correctly formatted version, and a UPRN. AutoPostcode validates against ~31M UK delivery points across ~1.8M postcodes.
How do I authenticate with the API?
Pass your API key as a Bearer token on every request, and keep it server-side:
const headers = {
Authorization: "Bearer " + process.env.AUTOPOSTCODE_KEY,
};How do I look up addresses for a postcode?
A lookup returns all PAF addresses for a postcode so the user can pick the exact one:
const res = await fetch(
"https://autopostcode.com/api/public/lookup?postcode=SW1A1AA",
{ headers }
);
if (!res.ok && res.status !== 404) throw new Error("Lookup HTTP " + res.status);
const addresses = res.status === 404 ? [] : await res.json();How do I validate a full address?
Compare the supplied premise, street and town with candidates at that postcode. Ask the user to confirm a suggested match or permit manual entry if the address is missing or ambiguous.
How should I handle errors?
Branch on the HTTP status so failures are graceful and rate limits are respected:
| Status | Meaning | Action |
|---|---|---|
| 200 | Success | Use the result |
| 401 | Invalid key | Check the Bearer token |
| 429 | Rate limited | Back off and retry |
| 400 | Bad request | Validate your input |
What are the integration best practices?
- Keep the API key server-side, never in the browser
- Cache stable postcode lookups to cut repeat calls
- Store the UPRN as a permanent address identifier
- Soft-warn on failed validation instead of hard-blocking
See the endpoint-level UK address validation API overview, start fast with the API quickstart, and read every parameter in the REST API reference.
A modern, UK-first alternative
AutoPostcode uses the same Royal Mail PAF data as Loqate, Fetchify and Ideal Postcodes, with a clean REST API and an affordable per-lookup price — get your API key and integrate today.
Frequently asked questions
How do I validate UK addresses with an API?
Send a full UK postcode to the AutoPostcode lookup endpoint with a website key. Compare Royal Mail PAF delivery point candidates with the supplied address and ask the user to confirm the match.
What data does a UK address validation API check against?
AutoPostcode resolves candidate delivery points using Royal Mail PAF. A match gives you a structured address to confirm with the user.
What's the difference between validation and autocomplete?
Autocomplete helps a user find and select an address as they type; validation confirms a given address is real and deliverable. Most checkouts use autocomplete for entry and validation as a safety net on submit.
How do I authenticate with the address validation API?
Pass your API key as a Bearer token in the Authorization header of every request. Keep the key server-side so it never reaches the browser.
How should I handle validation errors and rate limits?
Check the HTTP status: 401 means an invalid key, 429 means you exceeded the rate limit, and 200 returns the result. Back off and retry on 429, and surface a helpful message on 4xx.
Can I validate addresses in bulk?
The lookup API accepts one postcode per request. Discuss data licensing, usage and volume with support before batch processing.
We'll beat any like-for-like UK address lookup price
Send us your current quote or invoice and we'll come back the same working day with a better price — plus free migration and integration support.
- Beat any like-for-like UK quote, monthly or annual
- Free migration + hands-on integration support
- No setup fees, no lock-in, cancel any time
Ready to get started?
Add Royal Mail PAF-verified UK address lookup to your site in minutes — start free, no card required.
