Full premise-level address autocomplete

Returns full UK addresses "as-you-type" an address (e.g. Allie...).

Includes the latest address data from Royal Mail, updated daily.

Lookup cost: 2 credits when the final address is selected (no charge for key presses)

Download the example

Start with the example code and then customise it using the information below.

Download PostCoder autocomplete example

2 steps to autocompleting an address

img

Step 1 - Search for matches

Input: Real-time keystrokes forming the first part of a postcode, street or address
Output: List of possible matches (e.g. a street or postal town that starts with the input)

Lookup cost: 0 credits

Request structure: http://ws.postcoder.com/pcw/[api-key]/autocomplete/v2/uk/[autocomplete-search-term]

Example: http://ws.postcoder.com/pcw/PCW45-12345-12345-1234X/autocomplete/v2/uk/allies%20compu?format=json

{
"predictions": [
        {
            "prediction": "Allies Computing Ltd, Manor Farm Barns, Fox Road, Framingham Pigot, Norwich, Norfolk, NR14...",
            "refs": "17448021",
            "complete": false
        },
        {
            "prediction": "Allied Computers International Ltd, Unit F1, Phoenix Industrial Estate, Rosslyn Crescent, Harrow, Greater London, HA1...",
            "refs": "53517590",
            "complete": false
        }
    ],
    "status": "Ok"
}

Notes

  • Each search result will include all of the individual search terms within [autocomplete-search-term]

  • Use ?fuzzy=true to return search results that contain any rather than all of the search terms

  • If you are having issues with Chrome's Auto Fill blocking your suggestions, the current fix for this is to use the autocomplete="xyz" attribute in your input tag. As Chrome ignores the autocomplete="off" attribute

Step 2 - Return a full address

Input: The refs associated with the address (also known as the UDPRN) selected in step 1
Output: The full version (including postcode) of the address selected in step 1

Lookup cost: 2 credits

Request structure: http://ws.postcoder.com/pcw/[api-key]/address/uk/[autocomplete-search-term]?udprn=[refs]

Example: http://ws.postcoder.com/pcw/PCW45-12345-12345-1234X/address/uk/allies%20compu?udprn=17448021 - View live response

[
    {
        "summaryline":"Allies Computing Ltd, Manor Farm Barns, Fox Road, Framingham Pigot, Norwich, Norfolk, NR14 7PZ",
        "organisation":"Allies Computing Ltd",
        "buildingname":"Manor Farm Barns",
        "premise":"Manor Farm Barns",
        "street":"Fox Road",
        "dependentlocality":"Framingham Pigot",
        "posttown":"Norwich",
        "county":"Norfolk",
        "postcode":"NR14 7PZ"
    }
]

Notes

  • Details on how to customise the output from the /address/ method used in step 2 can be found here »

  • Empty address fields are not returned in the response, so all fields should be treated as optional