Search for a postcode or an address

Find out what you can do with our API...


Back to Address & Postcode

Full API method list

Demo


API method to use: address_search

Description


Searches the UK postcodes data (PAF) to find a UK address from a postcode or vice versa.

This is the most up-to-date source of address information you can find in the UK.

We can identify a full and accurate address from a partial address and/or postcode - all you need to do is enter the information you have and we will complete and update it. We know how important it is to have accurate contact information for your customers so we want to make it as easy as possible for you to have a complete and accurate customer contact database.

Save valuable time and effort by adding this service to your CRM system, website or other business application. It can be used as a data cleansing tool or can facilitate the process of filling in address details on forms to ensure that the information provided is accurate.

Mandatory Parameters


Name Description
api_key or javascript_key Use your API key if invoking server-side. If invoking from the browser via JavaScript, generate a JavaScript key using the javascript_key method.

Optional Parameters


Name Description
client You can optionally include an identifier for your final client or user. This is logged in your usage log and you will be able to view your usage statistics by client.
output Set to json for a JSON response; the default response is XML. Not applicable to the SOAP API.
callback When using JSON, specify a JSONP wrapper in which the JSON response is to be wrapped.
postcode Enter a UK postcode; you may also enter a house number as the address parameter.
address If used with a postcode, this is an optional house number; if used alone, this is the address to be searched for.
records_per_page Specify the number of records to return on the current page. We offer page caching for this method - once your search is invoked, we store the pages on our server for 60 minutes; a subsequent request for a page of results from that search is displayed from the cache, at no charge to you. See result page caching.
page_num Zero based integer - current page number to return.

Returned Values


The XML response is contained within a <address_search_res> element.

Name Description
status Returns ok if the operation has succeeded, or error if an error has occurred; Returns the error_code for error details.
error_code Returns the error code when the status is error. See below for error codes.
t2a_version_number The current API version number.
credit_used The number of credits used in order to execute the request.
mode Returns normal or test when executed in the free test mode.
address_list An array of address records.
total_records

The total number of records, irrespective of the number displayed on any page.

This is only used when a address_list is present.

page_number

Current page being displayed, a zero-based integer.

This is only used when a address_list is present.

Error Codes


See the common error codes. There are no errors which are specific to this method.

Free Test Mode


When operating in the free test mode errors are returned if mandatory parameters are missing, or it returns a dummy data response, in an identical format to a real response.

Note that the mode is returned as test when the method is operating in the free test mode.

Example XML Response



<?xml version="1.0" encoding="utf-8" ?>
<address_search_res>
  <t2a_version_number>1.0.0</t2a_version_number>
  <status>ok</status>
  <total_records>1</total_records>
  <page_number>0</page_number>
  <address_list>
    <address>
      <line_1>4 Imagination Gardens</line_1>
      <line_2>Magic Street</line_2>
      <line_3/>
      <place>Heslingdown</place>
      <town>York</town>
      <postcode>YO10 5DG</postcode>
      <addr_single_line>4 Imagination Gardens, Magic Street, Heslingdown, York, YO10 5DG</addr_single_line>
    </address>
  </address_list>
</address_search_res>

Example JSON Response


{
  "address_list":[
  {
    "line_1":"4 Imagination Gardens",
    "line_2":"Magic Street",
    "line_3":"",
    "place":"Heslingdown",
    "town":"York",
    "postcode":"YO10 5DG"
  }
  ],
  "t2a_version_number":"1.0.0",
  "status":"ok"
}