Skip to main content

Lookup Postcode

GET 

/postcodes/:postcode

Returns the complete list of addresses for a postcode. Postcode searches are space and case insensitive.

The Postcode Lookup API provides a JSON interface to search UK addresses from a postcode. It can be used to power Postcode Lookup driven address searches, like Postcode Lookup.

Postcode Not Found

Lookup balance is unaffected by invalid postcodes. The API returns a 404 response with response body:

{
"code": 4040,
"message": "Postcode not found",
"suggestions": ["SW1A 0AA"]
}

Suggestions

If a postcode cannot be found, the API will provide up to 5 closest matching postcodes. Common errors will be corrected first (e.g. mixing up O and 0 or I and 1).

If the suggestion list is small (fewer than 3), there is a high probability the correct postcode is there. You may notify the user or immediately trigger new searches.

The suggestion list will be empty if the postcode has deviated too far from a valid postcode format.

Multiple Residence

A small number of postcodes will return more than 100 premises. These may require pagination. Use page to paginate the result set.

Request

Path Parameters

    postcode stringrequired

    Postcode to retrieve

    Example: SW1A 2AA

Query Parameters

    api_key string

    API Key

    Your unique identifier that allows access to our APIs.

    Begins ak_. Available from your dashboard

    Example: ak_test
    filter string

    Restrict Result Fields

    Comma separated whitelist of address elements to return.

    E.g. filter=line_1,line_2,line_3 returns only line_1, line_2 and line_3 address elements in your response

    Example: line_1,line_2,line_3
    page int32

    Possible values: <= 100

    Page

    0 indexed indicator of the page of results to receive. Virtually all postcode results are returned on page 0.

    A small number of Multiple Residence postcodes may need pagination (i.e. have more than 100 premises).

    Example: 1
    Tags string

    A comma separated list of tags to query over.

    Useful if you want to specify the circumstances in which the request was made.

    If multiple tags are specified, the response will only comprise of requests for which all the tags are satisfied - i.e. searching "foo,bar" will only query requests which tagged both "foo" and "bar".

    Example: foo,bar

Responses

Success

Schema
    result object[]required

    All addresses listed at the postcode.

    If Eircode is enabled, addreses for the Republic of Ireland will be returned in the English format.

  • Array [
  • oneOf
    id IDrequired

    Global unique internally generated identifier for an address

    dataset Datasetrequired

    Possible values: [paf]

    Indicates the provenance of an address

    country_iso ISO Country Code (3)required

    Possible values: [GBR, IMN, JEY, GGY]

    3 letter country code (ISO 3166-1)

    country_iso_2 ISO Country Code (2)required

    Possible values: [GB, IM, JE, GG]

    2 letter country code (ISO 3166-1)

    country Countryrequired

    Possible values: [England, Scotland, Wales, Northern Ireland, Jersey, Guernsey, Isle of Man]

    Full country names (ISO 3166)

    language Languagerequired

    Possible values: [en]

    Language represented by 2 letter ISO Code (639-1)

    line_1 Line 1required

    First Address Line. Often contains premise and thoroughfare information. In the case of a commercial premise, the first line is always the full name of the registered organisation. Never empty.

    line_2 Line 2required

    Second Address Line. Often contains thoroughfare and locality information. May be empty

    line_3 Line 3required

    Third address line. May be empty.

    post_town paf_post_townrequired

    Possible values: <= 30 characters

    **Filter by Town or City" A Post Town is mandatory for delivery of mail to a Delivery Point. This is not necessarily the nearest town geographically, but a routing instruction to the Royal Mail delivery office sorting mail for that Delivery Point. A Post Town will always be present in every address, and for some Localities the Post Town will be the only locality element present.

    postcode Postcoderequired

    Possible values: >= 6 characters and <= 8 characters

    Correctly formatted postcode. Capitalised and spaced.

    county Countyrequired

    Since postal, administrative or traditional counties may not apply to some addresses, the county field is designed to return whatever county data is available. Normally, the postal county is returned. If this is not present, the county field will fall back to the administrative county. If the administrative county is also not present, the county field will fall back to the traditional county. May be empty in cases where no administrative, postal or traditional county present.

    county_code County Coderequired

    Short code representing the county or province. May be empty ("")

    uprn Unique Property Reference Numberrequired

    UPRN stands for Unique Property Reference Number and is maintained by the Ordnance Survey (OS). Local governments in the UK have allocated a unique number for each land or property.

    Up to 12 digits in length.

    Multiple Residence premises currently share the same UPRN as the parent premise.

    May not be available for a small number of Great Britain addresses due to longer update cycles for Ordnance Survey's AddressBase datasets. Returns empty string "" in these instances.

    Although UPRN takes an integer format, we encode and transmit this data as strings. As a 12 digit number, the UPRN can exceed the maximum safe integer Number.MAX_SAFE_INTEGER in most browsers causing this datapoint to be corrupted.

    Take special care when storing UPRN. As a 12 digit identifier, you will need 64 bits to encode every possible UPRN value. This means applications like Excel will corrupt cells containing UPRN values.

    udprn int32required

    UDPRN stands for ‘Unique Delivery Point Reference Number’. Royal Mail assigns a unique UDPRN code for each premise on PAF. Simple, unique reference number for each Delivery Point. Unlikely to be reused when an address expires.

    Up to 8-digit numeric code.

    A new UDPRN is automatically assigned to each new Delivery Point added to PAF.

    umprn object required

    A small minority of individual premises (as identified by a UDPRN) may have multiple occupants behind the same letterbox. These are known as Multiple Residence occupants and can be queried via the Multiple Residence dataset. Simple, unique reference number for each Multiple Residence occupant.

    Note: this will be an empty string "" when not used.

    oneOf

    string

    postcode_outward Postcode Outwardrequired

    Possible values: >= 2 characters and <= 4 characters

    The first part of a postcode is known as the outward code. e.g. The outward code of ID1 1QD is ID1. Enables mail to be sorted to the correct local area for delivery. This part of the code contains the area and the district to which the mail is to be delivered, e.g. ‘PO1’, ‘SW1A’ or ‘B23’.

    postcode_inward Postcode Inwardrequired

    Possible values: >= 3 characters and <= 3 characters

    The second part of a postcode is known as the inward code. e.g. The inward code of ID1 1QD is 1QD.

    The number identifies the sector in the postal district. The number is followed by 2 letters. The letters then define one or more properties in that sector.

    dependant_locality Dependant Localityrequired

    Possible values: <= 35 characters

    When the same thoroughfare name reoccurs in a Post town, it may not be possible to make it dependant on a dependant thoroughfare. In this case the thoroughfare is dependant on a locality. For example if we want to find 1 Back Lane in Huddersfield we see that there are three.

    double_dependant_locality Double Dependant Localityrequired

    Possible values: <= 35 characters

    Used to supplement Dependant Locality. A Double Dependant Locality supplied along with a Dependant Locality if the Dependant Locality exists twice in the same locality.

    thoroughfare Thoroughfarerequired

    Possible values: <= 80 characters

    Also known as the street or road name. In general each Thoroughfare Name will have a separate Postcode. Longer Thoroughfares with high number ranges often have multiple Postcodes covering the entire length of the road, with breaks at suitable points e.g. junctions or natural breaks in the road.

    dependant_thoroughfare Dependant Thoroughfarerequired

    Possible values: <= 80 characters

    Used to supplement thoroughfare. When a thoroughfare name is used twice in the same Post Town, the dependant thoroughfare is added to uniquely indentify a delivery point.

    building_number Building Numberrequired

    Possible values: <= 4 characters

    Number to identify premise on a thoroughfare or dependant thoroughfare.

    building_name Building Namerequired

    Possible values: <= 50 characters

    Name of residential or commercial premise.

    Examples:

    • The Manor
    • 1-2
    • A
    • 12A
    • K
    • Victoria House
    sub_building_name Sub-Building Namerequired

    Possible values: <= 30 characters

    When a premise is split into individual units such as flats, apartments or business units. Cannot be present without either building_name or building_number. E.g. Flat 1, A, 10B

    po_box PO Boxrequired

    Possible values: <= 6 characters

    When the PO Box Number field is populated it will contain PO BOX nnnnnn where n represents the PO Box number. Note that the PO Box details can occasionally consist of a combination of numbers and letters. PO Box Numbers are only allocated to Large Users.

    department_name Department Namerequired

    Possible values: <= 60 characters

    Used to supplment Organisation Name to identify a deparment within the organisation.

    organisation_name Organisation Namerequired

    Possible values: <= 60 characters

    Used to supplment Organisation Name to identify a deparment within the organisation

    postcode_type Postcode Typerequired

    Possible values: [S, L, ``]

    This indicates the type of user. It can only take the values 'S' or 'L' indicating small or large respectively. Large User Postcodes. These are assigned to one single address either due to the large volume of mail received at that address, or because a PO Box or Selectapost service has been set up. Small User Postcodes. These identify a group of Delivery Points.

    On average there are 19 Delivery Points per Postcode. However this can vary between 1 and, in some cases, 100. There will never be more than 100 Delivery Points on a Postcode.

    su_organisation_indicator Small User Organisation Indicatorrequired

    Small User Organisation Indicator can have the values 'Y' or space. A value of 'Y' indicates that a Small User Organisation is present at this address.

    delivery_point_suffix Delivery Point Suffixrequired

    A unique Royal Mail 2-character code (the first numeric & the second alphabetical), which, when added to the Postcode, enables each live Delivery Point to be uniquely identified. Once the Delivery Point is deleted from PAF the DPS may be reused (although they aren’t reused until all remaining Delivery Points in the range have been allocated). The DPS for a Large User is always '1A' as each Large User has its own Postcode.

    premise Premiserequired

    Possible values: <= 84 characters

    A pre-computed string which sensibly combines building_number, building_name and sub_building_name. building_number, building_name and sub_building_name represent raw data from Royal Mail's and can be difficult to parse if you are unaware of how the Postcode Address File premise fields work together. For this reason, we also provide a pre-computed premise field which intelligently gathers these points into a single, simple premise string. This field is ideal if you want to pull premise information and thoroughfare information separately instead of using our address lines data.

    administrative_county Administrative Countyrequired

    The current administrative county to which the postcode has been assigned.

    A Unitary Authority name, where one is present. If there is no Unitary Authority, the County name is used. This information is not static, because County boundaries may change due to administrative changes. Data

    source: ONS

    postal_county Postal Countyrequired

    Postal counties were used for the distribution of mail before the Postcode system was introduced in the 1970s. The Former Postal County was the Administrative County at the time. This data rarely changes. May be empty.

    traditional_county Traditional Countyrequired

    Traditional counties are provided by the Association of British Counties. It is historical data, and can date from the 1800s. May be empty.

    district Districtrequired

    The current district/unitary authority to which the postcode has been assigned.

    ward Wardrequired

    The current administrative/electoral area to which the postcode has been assigned. May be empty for a small number of addresses.

    longitude object required

    The longitude of the postcode (WGS84/ETRS89).

    Can be a positive or negative decimal. E.g. -0.1283983

    Returns an empty string if no location data is available.

    oneOf

    string

    latitude object required

    The latitude of the postcode (WGS84/ETRS89).

    Can be a positive or negative decimal. E.g. 51.5083983.

    Returns an empty string if no location data is available.

    oneOf

    string

    eastings object required

    Eastings reference using the Ordnance Survey National Grid reference system.

    Northern Ireland Eastings uses the Irish Grid Reference System.

    Metres from origin. E.g. 550458

    Returns an empty string if no location data is available. Otherwise a number is returned.

    oneOf

    string

    northings object required

    Northings reference using the Ordnance Survey National Grid reference system

    Northern Ireland Northings uses the Irish Grid Reference System

    Metres from origin. E.g. 180458

    Returns an empty string if no location data is available. Otherwise a number is returned

    oneOf

    string

  • ]
  • code integerrequired

    Possible values: [2000]

    message stringrequired

    Possible values: [Success]

    page integerrequired

    Possible values: <= 10

    limit integerrequired

    Possible values: >= 1 and <= 100

    Default value: 100

    total integerrequired
Loading...