Response Format

Stable

Detailed 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:

FieldTypeDescription
postcodestringThe postcode in its correctly formatted form (e.g. "SW1A 2AA")
addressesarrayArray of address objects at this postcode
countnumberNumber of addresses in this response (this page)
pagenumberCurrent page number (starts at 1)
limitnumberAddresses per page (default and maximum 100)
totalnumberTotal number of addresses at this postcode, across all pages
next_pagenumber | nullThe 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:

FieldTypeDescription
line_1stringPrimary address line (building name, number, or organisation)
line_2stringSecondary address line (street name)
line_3stringTertiary address line (locality or additional detail)
townstringPost town
countystringCounty, derived from the postcode area. Best-effort: where an area spans two counties, the more common one is used. Empty for BFPO (BF) postcodes.
postcodestringPostcode for this address
countrystringCountry within the UK: "England", "Scotland", "Wales", or "Northern Ireland". Empty ("") for BFPO (BF) postcodes, which have no home nation.
udprnstringRoyal Mail UDPRN (Unique Delivery Point Reference Number) — a stable identifier for this address
formatted_addressstringFull address as a single comma-separated string
organisationstringOrganisation name
departmentstringDepartment within the organisation
sub_buildingstringFlat or unit, e.g. "Flat 2"
building_namestringBuilding name
building_numberstringBuilding number
streetstringStreet (thoroughfare)
dependent_streetstringDependent street
localitystringDependent locality
double_localitystringDouble dependent locality
po_boxstringPO box number
parent_udprnstring | nullnull for standard addresses; reserved for flat-level data
typestring"residential" or "commercial"
labelstringA ready-to-print postal label, lines separated by \n
barcodestringRoyal 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

Some postcodes (e.g. large organisations with a dedicated postcode) may return only a single address.

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 fieldSource
Address line 1line_1
Address line 2line_2
City / Towntown
Countycounty
Postcodepostcode
Countrycountry

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:

FieldTypeDescription
querystringThe query you sent
countnumberNumber of suggestions returned
suggestionsarrayArray 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):

FieldTypeDescription
typestring"postcode" or "address"
postcodestringThe postcode of this suggestion
summarystringDisplay label. For postcode suggestions: "<postcode> - <street>, <town>". For individual addresses: the full formatted address.
address_countnumberNumber of addresses represented — greater than 1 for postcode suggestions, always 1 for individual addresses
udprnstring | nullThe 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.