idpc find & resolve

Address autocomplete in two steps. find returns suggestions and spends no lookup. resolve turns one suggestion into a full address and costs a lookup. Use them to pin a specific address from partial information.

find is not a free standalone resource. Keys that make repeated autocomplete requests without resolving any are rate limited, then suspended. Narrow searches with --filter rather than paging through many queries.

To list every address at a known postcode, use idpc postcode instead.

idpc find <query>​

GET /autocomplete/addresses.

FlagDescription
--country <iso3>Search one country, by ISO-3 code (for example GBR, USA). An unsupported code falls back to GBR
--limit <n>Maximum suggestions, 1 to 100 (default 10)
--filter <key=value>Return only suggestions that match. Repeatable
--bias <key=value>Rank matching suggestions first without excluding the rest. Repeatable

Keys are the API parameter names. An unknown or repeated key fails with invalid_input and lists the allowed keys in details.allowed.

Filter keys​

KeyExample
postcodepostcode=BR87RE
postcode_outwardpostcode_outward=BR8
postcode_sectorpostcode_sector=BR8 7
postcode_areapostcode_area=BR
post_townpost_town=Swanley
postcode_typepostcode_type=S (small user) or L (large user)
su_organisation_indicatorsu_organisation_indicator=Y
uprnuprn=50002012147 (one value only)
countrycountry=England
datasetdataset=paf,mr (comma separated)
boxbox=-0.2,51.5,0.1,51.4 (top-left lon, lat, bottom-right lon, lat)
postal_codeFull non-UK postal code, for a US address the ZIP+4 (941051234)
postal_code_2Postal code prefix, for a US address the three digit ZIP prefix (941)
postal_code_3Short postal code, for a US address the five digit ZIP (94105)
city, state, state_codeNon-UK locality, e.g. city=San Francisco, state_code=CA
is_pobox, is_businesstrue or false

A comma separated value matches any of its terms, for example postcode_outward=BR8,DA1. Different filters combine with AND. The API takes up to 8 filter terms and 5 bias terms.

Bias keys​

Give bias keys without the bias_ prefix; the CLI adds it.

KeyExample
postcode, postcode_outward, postcode_sector, postcode_areapostcode_outward=BR8
post_townpost_town=London
thoroughfarethoroughfare=Malyons Road
countrycountry=Wales
lonlatlonlat=0.1779,51.4118,1000 (longitude, latitude, radius in metres up to 50000)
ipip=true (bias by the caller's IP location)
postal_code, postal_code_2, postal_code_3, city, state, state_codeNon-UK equivalents

See the autocomplete API reference for how each parameter matches.

Output​

TTY (human): prints a numbered list of suggestions with their ids.

Non-TTY (agent): emits suggestions as JSON:

{
  "count": 2,
  "suggestions": [
    {
      "id": "mr_55556910",
      "suggestion": "Flat 58, Heronbank, Gibbet Hill Road, Coventry, CV4",
      "udprn": 5770157,
      "umprn": 55556910,
      "urls": {
        "udprn": "/v1/udprn/5770157",
        "umprn": "/v1/umprn/55556910"
      }
    },
    {
      "id": "paf_2670849",
      "suggestion": "9 Malyons Road, Hextable, Swanley, BR8",
      "udprn": 2670849,
      "urls": {
        "udprn": "/v1/udprn/2670849"
      }
    }
  ]
}
  • The id prefix names the dataset: paf_ for Royal Mail PAF, mr_ for Multiple Residence, pafa_ for PAF Alias. Multiple Residence suggestions also carry a umprn.
  • A UK suggestion ends at the outward code (BR8), not the full postcode. Resolve it, or filter by postcode, to pin the full postcode.

idpc resolve <id>​

GET /autocomplete/addresses/{id}/gbr. Costs a lookup.

Returns the resolved address as result, in UK format for addresses in any country. On a TTY, prints the address lines.

Agent pattern​

Check the top suggestion before you resolve it. When there is no exact match, suggestions[0] can be a different premise whose number starts with yours, such as unit 2905 for house 290. Compare the house number, or narrow with --filter, so you don't spend a lookup on the wrong address.

# Narrow to a postcode, then resolve the top hit
ID=$(idpc find "9 malyons" --filter postcode=BR87RE | jq -r '.suggestions[0].id')
idpc resolve "$ID"

# Search a wider area, favouring one town
idpc find "high street" --filter postcode_area=BR --bias post_town=Swanley --limit 20