Some postcodes (e.g. large organisations with a dedicated postcode) may return only a single address.
Response Format
StableDetailed breakdown of the SnapAddress API response object and address fields.
Top-level response
Every successful response from the /v1/postcodes/{postcode} endpoint returns a JSON object with these fields:
| Field | Type | Description |
|---|---|---|
postcode | string | The postcode in its correctly formatted form (e.g. "SW1A 2AA") |
addresses | array | Array of address objects at this postcode |
count | number | Number of addresses in this response (this page) |
page | number | Current page number (starts at 1) |
limit | number | Addresses per page (default and maximum 100) |
total | number | Total number of addresses at this postcode, across all pages |
next_page | number | null | The next page number, or null on the last page |
Example:
{
"postcode": "SW1A 2AA",
"addresses": [...],
"count": 1,
"page": 1,
"limit": 100,
"total": 1,
"next_page": null
}Address object
Each entry in the addresses array is a structured object with the following fields:
| Field | Type | Description |
|---|---|---|
line_1 | string | Primary address line (building name, number, or organisation) |
line_2 | string | Secondary address line (street name) |
line_3 | string | Tertiary address line (locality or additional detail) |
town | string | Post town |
county | string | County, derived from the postcode area. Best-effort: where an area spans two counties, the more common one is used. Empty for BFPO (BF) postcodes. |
postcode | string | Postcode for this address |
country | string | Country within the UK: "England", "Scotland", "Wales", or "Northern Ireland". Empty ("") for BFPO (BF) postcodes, which have no home nation. |
udprn | string | Royal Mail UDPRN (Unique Delivery Point Reference Number) — a stable identifier for this address |
formatted_address | string | Full address as a single comma-separated string |
organisation | string | Organisation name |
department | string | Department within the organisation |
sub_building | string | Flat or unit, e.g. "Flat 2" |
building_name | string | Building name |
building_number | string | Building number |
street | string | Street (thoroughfare) |
dependent_street | string | Dependent street |
locality | string | Dependent locality |
double_locality | string | Double dependent locality |
po_box | string | PO box number |
parent_udprn | string | null | null for standard addresses; reserved for flat-level data |
type | string | "residential" or "commercial" |
label | string | A ready-to-print postal label, lines separated by \n |
barcode | string | Royal Mail customer barcode data, e.g. "(SW1A2AA1AM)"; empty when unavailable |
Example:
{
"line_1": "Prime Minister & First Lord Of The Treasury",
"line_2": "10 Downing Street",
"line_3": "",
"town": "LONDON",
"county": "Greater London",
"postcode": "SW1A 2AA",
"country": "England",
"udprn": "23747771",
"formatted_address": "Prime Minister & First Lord Of The Treasury, 10 Downing Street, LONDON, SW1A 2AA",
"organisation": "Prime Minister & First Lord Of The Treasury",
"department": "",
"sub_building": "",
"building_name": "",
"building_number": "10",
"street": "Downing Street",
"dependent_street": "",
"double_locality": "",
"locality": "",
"po_box": "",
"parent_udprn": null,
"type": "commercial",
"label": "Prime Minister & First Lord Of The Treasury\n10 Downing Street\nLONDON\nSW1A 2AA\nUNITED KINGDOM",
"barcode": "(SW1A2AA1AM)"
}Empty fields
Fields that do not apply to a given address are returned as empty strings (""). The one exception is parent_udprn, which is null for standard addresses. You can also use the formatted_address field directly, or build your own:
const fullAddress = [
address.line_1,
address.line_2,
address.line_3,
address.town,
address.county,
address.postcode,
].filter(Boolean).join(", ");Multiple addresses
Most postcodes return multiple addresses. The addresses array is ordered as delivered by Royal Mail PAF. A typical residential postcode may return 10-30 addresses, while a business postcode may return fewer.
Note
Pagination
Results are paginated. total is the number of addresses at the postcode and count the number on this page; page and limit describe the page you received, and next_page is the page to request next, or null on the last page. Follow next_page rather than counting pages: a page beyond the last one returns no addresses and is not charged. The default limit is 100 (also the maximum), so most postcodes return everything in one call. Request further pages with the page and limit query parameters:
curl -H "x-api-key: YOUR_API_KEY" \
"https://api.snapaddress.io/v1/postcodes/SW1A2AA?page=2&limit=50"Mapping to form fields
A common use case is populating an address form. Here is a typical mapping:
| Form field | Source |
|---|---|
| Address line 1 | line_1 |
| Address line 2 | line_2 |
| City / Town | town |
| County | county |
| Postcode | postcode |
| Country | country |
line_3 can be appended to line 2 or placed in a separate field depending on your form layout. The udprn field is useful for deduplication or as a stable identifier when storing addresses.
Autocomplete response
The /v1/autocomplete endpoint returns a different shape. The top-level object is:
| Field | Type | Description |
|---|---|---|
query | string | The query you sent |
count | number | Number of suggestions returned |
suggestions | array | Array of suggestions (see below) |
Each suggestion represents either a postcode (for postcode-shaped queries — many addresses grouped under one postcode) or a single address (for street, building, or business-name queries):
| Field | Type | Description |
|---|---|---|
type | string | "postcode" or "address" |
postcode | string | The postcode of this suggestion |
summary | string | Display label. For postcode suggestions: "<postcode> - <street>, <town>". For individual addresses: the full formatted address. |
address_count | number | Number of addresses represented — greater than 1 for postcode suggestions, always 1 for individual addresses |
udprn | string | null | The address's UDPRN for "address" suggestions; null for "postcode" suggestions |
Example:
{
"query": "SW1A",
"suggestions": [
{
"type": "postcode",
"postcode": "SW1A 1RJ",
"summary": "SW1A 1RJ - Arlington Street, LONDON",
"address_count": 57,
"udprn": null
}
],
"count": 1
}A street, building or business-name query returns "address" suggestions instead, each with its own udprn:
{
"type": "address",
"postcode": "E6 6WP",
"summary": "10 Downings, LONDON, E6 6WP",
"address_count": 1,
"udprn": "7944730"
}When the user selects a suggestion:
"postcode"— call/v1/postcodes/{postcode}to list its addresses."address"— call/v1/addresses/{udprn}to fetch that one address. Two calls from typing to a full address.