Not on WordPress? Use plain JavaScript to fetch verified UK address JSON. Same endpoint, same API key authentication and same request format as our WooCommerce plugin.
Log in to your dashboard, add a website and mint a live API key (it starts with ap_live_). The same key powers both the plugin and custom apps.
Paste the snippet below into your app, set your endpoint and API key, then call lookupPostcode() wherever you need addresses.
The API returns an array of structured address objects — map them into your own dropdown, form fields or autocomplete.
One GET request, authenticated with your website API key in the x-api-key header.
Copy this into your custom app, swap in your API key and call lookupPostcode().
// AutoPostcode — UK address lookup from any custom web app.
// Reuses the exact endpoint, auth header and request format the
// WordPress/WooCommerce plugin uses. Returns raw addresses JSON.
const APC_ENDPOINT = "https://autopostcode.com/api/public/lookup";
const APC_API_KEY = "ap_live_xxxxxxxxxxxxxxxx"; // your website API key
async function lookupPostcode(postcode) {
const url = APC_ENDPOINT + "?postcode=" + encodeURIComponent(postcode);
const res = await fetch(url, {
method: "GET",
headers: {
"x-api-key": APC_API_KEY,
},
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error || "Lookup failed (" + res.status + ")");
}
// Raw array of address objects.
return res.json();
}
// Usage
lookupPostcode("BH31 6EL")
.then((addresses) => console.log(addresses))
.catch((e) => console.error(e));[
{
"postcode": "BH31 6EL",
"line1": "1 Example Street",
"line2": "",
"line3": "",
"town": "Verwood",
"county": "Dorset",
"country": "United Kingdom"
}
]curl "https://autopostcode.com/api/public/lookup?postcode=BH31%206EL" \
-H "x-api-key: ap_live_xxxxxxxxxxxxxxxx"Your ap_live_ key is scoped to a single website and every lookup is logged against it. Use a key per site so usage and access stay isolated, and rotate a key any time from your dashboard if it leaks.
Create an account, mint a key and start returning verified UK addresses in minutes.