Store your API key as an environment variable (e.g. SNAPADDRESS_API_KEY). Never commit it to version control.
Getting Started
StableSign up, get your API key, and make your first address lookup in under five minutes.
Create your account
Head to snapaddress.io/signup and create a free account. No credit card required — you get 100 free lookups to start, valid for 3 months.
You will receive a magic link via email. Click it to confirm your account and access the dashboard.
Get your API key
During signup, an API key is automatically generated and displayed on the welcome screen. Copy it immediately — it is only shown once in full.
You can create additional keys from the API Keys page in the dashboard.
Tip
Make your first request
Send a GET request with your postcode and API key:
curl -H "x-api-key: YOUR_API_KEY" \
"https://api.snapaddress.io/v1/postcodes/SW1A2AA"You will receive a JSON response containing all addresses at that postcode:
{
"postcode": "SW1A 2AA",
"count": 1,
"page": 1,
"limit": 100,
"addresses": [
{
"line_1": "Prime Minister & First Lord Of The Treasury",
"line_2": "10 Downing Street",
"line_3": "",
"town": "LONDON",
"county": "",
"postcode": "SW1A 2AA",
"country": "England",
"udprn": "23747771",
"formatted_address": "Prime Minister & First Lord Of The Treasury, 10 Downing Street, LONDON, SW1A 2AA"
}
]
}Using the API in your code
JavaScript / Node.js
const postcode = "SW1A 2AA";
const response = await fetch(
`https://api.snapaddress.io/v1/postcodes/${encodeURIComponent(postcode)}`,
{ headers: { "x-api-key": process.env.SNAPADDRESS_API_KEY } }
);
const data = await response.json();
console.log(data.addresses);Python
import os
import requests
postcode = "SW1A 2AA"
api_key = os.environ["SNAPADDRESS_API_KEY"]
response = requests.get(
f"https://api.snapaddress.io/v1/postcodes/{postcode}",
headers={"x-api-key": api_key}
)
data = response.json()
print(data["addresses"])PHP
$postcode = 'SW1A 2AA';
$apiKey = getenv('SNAPADDRESS_API_KEY');
$url = "https://api.snapaddress.io/v1/postcodes/" . urlencode($postcode);
$opts = ["http" => ["header" => "x-api-key: " . $apiKey]];
$response = json_decode(file_get_contents($url, false, stream_context_create($opts)), true);
print_r($response['addresses']);Address autocomplete
The autocomplete endpoint lets users search by partial postcode, street, or organisation. It requires a minimum of 2 characters — single-character queries return a 400 error.
Enforce this client-side to avoid wasted API calls and a poor user experience:
const API_KEY = process.env.SNAPADDRESS_API_KEY;
function handleInput(text) {
if (text.length < 2) {
// Show a hint like "Keep typing for results..." instead of calling the API
return;
}
fetch(
`https://api.snapaddress.io/v1/autocomplete?q=${encodeURIComponent(text)}`,
{ headers: { "x-api-key": API_KEY } }
)
.then((res) => res.json())
.then((data) => {
// data.suggestions contains matching postcodes
// Use the postcode from a suggestion to fetch full addresses:
// GET /v1/postcodes/{postcode}
});
}Next steps
- Read the API Reference for full endpoint documentation
- See the Response Format for a complete field breakdown
- Setting up WooCommerce? See the WooCommerce Plugin guide