Rest API – Manual

Contents

Introduction

This document describes the REST API for the various functions across the AFD range of products provided with our hosted service platform.
An authenticated GET request to the service with the relevant parameters will return address or bank data, or validate accountcardemail or phone details (provided the requested product is licensed). The response is returned in JSON format, or optionally in XML.

🛈 On-premise versions of most products are also available with this API, please contact Sales if this is a requirement.

If you would like to talk to one of our sales representatives about a product you are interested in or need support with the API or products, our HelpDesk is staffed Monday – Friday 08:30 to 17:30 each weekday except UK Bank Holidays see http://www.afd.co.uk/support for more details or contact us below:

ContactPhoneEmail
Sales+44 1624 811711postcode@afd.co.uk
Support+44 1624 811712support@afd.co.uk

Using the API

The API is called using the GET method, and the request itself is broken into 6 parts. In addition, authentication is required for all requests.

Below is an example for a UK address fastfind:

Example

URL partValueDescription
Service URLhttps://api.afd.co.ukLocal installed is optional
API versionv1The version of the API to use, currently only v1 is supported
DataaddressThere are a number of different product data specifiers supported, see the Data Selector section below for options.
Country ISOGBROther countries are available. See List Countries.
TaskfastfindThe task endpoint is the action being carried out (see reference sections for all supported tasks
Serial333333Supplied by AFD – used for authentication
PasswordpwdSupplied by AFD – used for authentication
UserID00000

Enables you to identify different users or systems when comparing requests to any logs you may hold

🛈

FieldsListSpecifies the fields to use (see Field Presets (Section 4))
MaxQuantity10

Specifies the maximum number of records to return

🛈

FormatJSONSpecifies the format (XML or JSON)
QuerystringLookupThe query string will be dependent on the task see the specific task section for more details

🛈 You should note that regardless of the maximum quantity setting there is a timeout setting (default 30 seconds) and a 128 KB buffer limit for the server to retain server responsiveness and prevent buffer overflows.

AFD’s performance engine doesn’t impose arbitrary field limits on data. This provides maximum compatibility and flexibility with future changes. We recommend where possible, customer applications do not set small fixed length limits for fields and use variable length fields where possible. For example in the past the Office of National Statistics provided a number of fields that were limited to between 3-5 characters. They then standardised on 9 characters which meant applications had to be updated to accommodate that, having a variable length field in the first place would have avoided that issue.

However we appreciate some development environments and database systems may require fixed length fields and in such cases our Support team can assist you in setting appropriate lengths. These can be set to accommodate the maximum possible values currently in use and add headroom for future expansion where likely.

Taking each part above, the following is the complete URL to send to the service:

https://api.afd.co.uk/v1/address/GBR/fastfind?serial=333333&password=pwd&userid=0000&fields=list&MaxQuantity=10&format=json&lookup=B6%204AA

This would then show as:

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B6 4AA",
      PostcodeFrom: "",
      List: "B6 4AA Royal Mail, Birmingham Mail Centre, St Stephens Street, BIRMINGHAM",
      Key: "3388990",
      CountryISO: "GBR"
    }
  ]
}
				
			

Data Selector

The below table shows which AFD product maps to which data selector in the API.
For example, if using the Postcode Plus product, then address data should be specified in the call with GBR as the country ISO.

ProductDataCountryISODescription
Postcode / PlotterstreetGBR

UK thoroughfare (see Section 5) (street) level address data

🛈

Postcode PlusaddressGBR

UK address level data with postcode level grids (see Section 5)

🛈

Postcode Plus BusinessbusinessGBR

UK address level data with postcode level grids and business data (see Section 5)

🛈

Eircode ValidationaddressIRL

Irish address data (see Section 5)

🛈

ZipAddressaddressUSA

USA address data (see Section 5)

🛈

WorldAddressaddressSee List

Rest of world not including GBR, USA and IRL (see Section 5)

🛈

Names & NumbersnamesGBRUK address level data with postcode level grids, business data and electoral roll information (see Section 5)
BankFinderbankGBR,IRL or ALLBACS (GBR) and IPSO (IRL) data and validation (see Section 8)
EmailemailGBRProvides access to Email validations (see Section 12)
PhonephoneALLProvides access to Phone validations (see Section 11)
RefinerrefinerGBRProvides access to Refiner (see Section 9)
NearestnearestGBRProvides access to Nearest (see Section 10)
GridgridGBRProvides access to Grid (see Section 7)
ListlistGBRProvides access to Utilities (see Section 6)

If you do not know which data is accessible to you, please use the following ListProducts Task URL: https://pce.afd.co.uk/afddata.pce?data=list&task=listproducts&serial=333333&password=pwd&format=json

Data in AFD Postcode Plus is sourced from the Royal Mail.

It is important to note that the standards regarding what is an acceptable address vary widely from country to country as do the levels of data that are available. So you must accommodate for different levels of data coming back and therefore different amounts of manual entry which may be required by users of your software to provide a complete address.

Field Presets

Some products or tasks support different field presets as output. A preset is selected by including &fields= followed by the name of the preset in the query string to specify which fields should be returned.

Fields PresetValid for Data SelectorsDescription
ListAddress (see Section 5), Names (see Section 5), Bank (see Section 8), Nearest (see Section 10)Only the bare essential fields to allow the user to select the desired result from a list box. This includes the list item and key and for Address fields also includes the Postcode and PostcodeFrom parameters to allow changed postcodes to be detected.
Standard(All)Returns all applicable fields for the data type, including a fully formatted address, as would be used on an address label, where applicable.
RawAddress (see Section 5), Names (see Section 5), Bank (see Section 8)Returns all applicable fields for the data type, but the address is included in the raw PAF format, for example house number, dependant thoroughfare and thoroughfare are returned as individual fields rather than a single Street field.
BS7666Address (see Section 5) , Names (see Section 5)Returns all applicable fields for the data type, but the address is included in a BS7666 compliant format which is useful if you require to store addresses in this form.
USAAddress (see Section 5) , Names (see Section 5)Returns fields in the format used in the USA, most useful when used with ZipAddress for looking up US addresses. However, this format will also work with UK addresses just as the UK formats will work with US addresses.
SimpleAddress (see Section 5) , Names (see Section 5)Returns only the standard UK name and address, list and key fields when you require address data only and wish to minimise the amount of data returned.
InternationalAddress (see Section 5) , Names (see Section 5)Recommended for international addresses, but also useable with UK addresses. This returns formatted address lines which provide the address in a format ready for printing on an envelope or address label, as well as component address fields.
AccountBank (see Section 8)Contains applicable fields for Account Number validation.
CardBank (see Section 8)Contains applicable fields for Card Number validation.
GeoListAddress (see Section 5)Only returns fields specifically for the task fastfindgeo, along with any special data sets.
FflistAddress (see Section 5)Can be used as a substitute for List, where the postcode is required at the end of the list box
Custom *Address (see Section 5), Names (see Section 5), Bank (see Section 8), Nearest (see Section 10), Refiner (see Section 9)You can return any of the available fields once specified.

* You can specify any of our Available Fields to be returned with an @, for example &fields=address1@address2@address3

Address Products

PostcodePlusPostcodePlotterNames & NumbersEircode ValidationZip AddressWorldAddress

This section describes the Addressing group of product tasks for retrieving address information for a wider range of countries. The &CountryISO parameter coupled with your AFD license determines which product you access.

When integrating with Address Management products the same code will work with any of our Address Management products (AFD Postcode, AFD Plotter, AFD Postcode Plus, AFD Names & Numbers, AFD Zip Address, Eircode Validation, and AFD WorldAddress).

Please see the Data Selector (See Section 3) for your licensed product. This is a table describing the available base URL’s for Address products:

ProductBase URL
AFD Postcodehttps://api.afd.co.uk/v1/street/GBR/
AFD Postcode Plushttps://api.afd.co.uk/v1/address/GBR/
AFD Postcode Plus Businesshttps://api.afd.co.uk/v1/business/GBR/
AFD Names & Numbershttps://api.afd.co.uk/v1/names/GBR/
AFD Eircode Validationhttps://api.afd.co.uk/v1/address/IRL/
AFD WorldAddresshttps://api.afd.co.uk/v1/address/FRA/
AFD ZipAddresshttps://api.afd.co.uk/v1/address/USA/

Available Fields

The fields within the Item block will be dependent on the task carried out.
Result is numeric and either indicates an error (value less than 0) or success (value > 0).
ErrorText contains a description of the error which occurred if the value for Result is less than 0.

The results are contained in Item nodes (there will be one or more nodes if the operation was successful). EmailPhone and Bank validation will only ever return 1 item node.

● = Fields returned by this product and fully searchable.
⚬ = Fields returned by this product, but not searchable.

🛈 Please note that the Field Lengths are only guidelines and are not limits.

The following shows addressing fields:

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

Postcode 🛈

10Text

PostcodeFrom 🛈

10Text  

List 🛈

512Text

Key 🛈

8Numeric

CountryISO 🛈

3Text

Organisation 🛈

120Text 

Property 🛈

120Text 

Street 🛈

120Text

Locality 🛈

70Text

Town 🛈

30Text

DPS (Delivery Point Suffix) 🛈

3Text    

UDPRN (Unique Delivery Point Reference Number) 🛈

8Numeric   

JustBuilt 🛈

10Numeric    

Phone 🛈

20Text   

PostalCounty 🛈

30Text 

Abbreviated
PostalCounty 🛈

30Text 

OptionalCounty 🛈

30Text

Abbreviated
OptionalCounty 🛈

30Text

Traditional
County 🛈

30Text

Administrative
County 🛈

30Text

NHSCode (National Health Service Code) 🛈

6Text    

NHSName (National Health Service Name) 🛈

50Text    

NHSRegion
Code (National Health Service Region Code) 🛈

3Text    

NHSRegion
Name (National Health Service Region Name) 🛈

20Text    

PCTCode (Primary Care Trust Code) 🛈

9Text    

PCTName (Primary Care Trust Name) 🛈

50Text    

WardCode 🛈

9Text    

WardName 🛈

50Text    

Constituency
Code 🛈

9Text    

Constituency 🛈

50Text    

AuthorityCode 🛈

9Text    

Authority 🛈

50Text    

LEACode (Local Education Authority Code) 🛈

3Text    

LEAName (Local Education Authority Name) 🛈

50Text    

TVRegion 🛈

30Text    

MailsortCode 🛈

5Numeric   

SubCountry
Name 🛈

20Text    

Devolved
Constituency
Code 🛈

9Text    

Devolved
Constituency
Name 🛈

50Text    

SOALower (Super Output Area Lower) 🛈

9Text    

SOAMiddle (Super Output Area Middle) 🛈

9Text    

UrbanRural
Code 🛈

2Text    

UrbanRural
Name 🛈

60Text    

EERCode (European Electoral Region Code) 🛈

9Text    

EERName (European Electoral Region Name) 🛈

40Text    

GridE (Grid East) * 🛈

10Numeric 

GridN (Grid North) * 🛈

10Numeric 

GBGridE (Great Britain Grid East) ** 🛈

10Numeric 

GBGridN (Great Britain Grid North) ** 🛈

10Numeric 

NIGridE (Northern Ireland Grid East) ** 🛈

10Numeric 

NIGridN (Northern Ireland Grid North) ** 🛈

10Numeric 

Miles 🛈

6Numeric    

Km 🛈

6Numeric    

Latitude * 🛈

10Numeric 

Longitude * 🛈

10Numeric 

PostcodeType 🛈

6Text   

CensationCode 🛈

10Text   

CensationLabel 🛈

24Text   

Affluence 🛈

30Text   

Lifestage 🛈

100Text   

Additional
CensusInfo 🛈

200Text   

AddressType 🛈

6Numeric   

AddressType
Description 🛈

55Text   

Occupancy 🛈

6Numeric   

Occupancy
Description 🛈

30Text   

Name 🛈

120Text     

Residency 🛈

6Numeric     

Household
Composition 🛈

106Text     

Business 🛈

100Text     

Size 🛈

6Text     

SICCode (Standard Industry Classification Code) 🛈

10Numeric     

LocationType 🛈

6Text     

BranchCount 🛈

6Numeric     

GroupID 🛈

6Numeric     

TurnOver 🛈

15Numeric     

NationalSize 🛈

6Text     

OnEditedRoll 🛈

6Text     

Gender 🛈

6Text     

Forename 🛈

30Text     

MiddleInitial 🛈

6Text     

Surname 🛈

30Text     

DateOfBirth 🛈

10Numeric     

Product 🛈

40Text 

Country 🛈

30Text

UPRN (Unique Postal Reference Number) ** 🛈

12Numeric     

NUTS3Code (Nomenclature of Territorial Units for Statistics 3 Code) ** 🛈

5Text     

NUTS3Name (Nomenclature of Territorial Units for Statistics 3 Name) ** 🛈

50 Text     

Council
TaxBand ** 🛈

6 Text     

GridLevel ** 🛈

1Numeric     

POLAR3Young ** 🛈

8 Numeric     

POLAR3Adult ** 🛈

8 Numeric     

POLAR4 ** 🛈

8 Numeric     

Deprivation
Rank ** 🛈

8 Numeric     

Deprivation
Decile ** 🛈

1Numeric     

LEPCode (Local Enterprise Parnership Code) ** 🛈

9Text     

LEPName (Local Enterprise Parnership Name) ** 🛈

50 Text     

LEPCode2 (Local Enterprise Parnership Code 2) ** 🛈

9Text     

LEPName2 (Local Enterprise Parnership Name 2) ** 🛈

50 Text     

AEBArea (Adult Education Budget Area) ** 🛈

50 Text     

AEBSource (Adult Education Budget Source) ** 🛈

3Numeric     

AEB
EffectiveFrom (Adult Education Budget Effective From) ** 🛈

10Text     

AEB
EffectiveTo (Adult Education Budget Effective To) ** 🛈

10Text     

Multiple
Residency
Indicator ** 🛈

1Text     

NotYetBuilt ** 🛈

1Text     

Abase (AddressBase) ** 🛈

1Text     

DXNumber ** 🛈

10Text    

DXExchange ** 🛈

30Text    

DXOrganisation ** 🛈

120Text    

DXProfession ** 🛈

30Text    

Outcode 🛈

4Text   

Incode 🛈

3Text   

* GridE/GridN and Latitude/Longitude not included in Postcode (requires at least Plotter). (Optional: International Grids)
** This is an optional data field and requires a license to return
No fixed length, so safety margin is used

Raw PAF Fields (Formatted closer to how they appear on Raw PAF, useful if your database stores fields this way)

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

Organisation
Name 🛈

60Text

Department
Name 🛈

60Text

SubBuilding 🛈

60Text

Building 🛈

60Text

Number 🛈

10Numeric

Dependant
Thoroughfare 🛈

60Text

Thoroughfare 🛈

60Text

Double
Dependant
Locality 🛈

35Text

Dependant
Locality 🛈

35Text

Town 🛈

30Text

Postcode 🛈

10Text

BS7666 Fields (Fields to help provide addresses which conform to BS 7666-5:2006)

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

Identifier 🛈

8Numeric   

BuildDate 🛈

10Text 

Administrator 🛈

20Text 

Language 🛈

5Text 

Department 🛈

60Text   

Organization 🛈

60Text  

SubUnit 🛈

60Text   

BuildingName 🛈

60Text  

BuildingNumber 🛈

10Numeric  

SubStreet 🛈

60Text   

DeliveryStreet 🛈

60Text

SubLocality 🛈

60Text  

DeliveryLocality 🛈

60Text

DeliveryTown 🛈

30Text

Code 🛈

10Text

USA Address Fields

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

ZipCode 🛈

20Text

Key 🛈

8Numeric

List 🛈

512Text

CountryISO 🛈

3Text

Recipient 🛈

120Text 

Secondary 🛈

120Text 

Primary 🛈

120Text

Urbanization 🛈

60Text

City 🛈

30Text

State 🛈

30Text

RecordType 🛈

30Text     

CarrierRouteID 🛈

4Text     

LACSStatus 🛈

2Text     

FinanceNumber 🛈

7Numeric     

Congressional
District 🛈

3Numeric     

CountyNumber 🛈

4Numeric     

CountyName 🛈

26Text     

City
Abbreviation 🛈

14Text     

Product 🛈

40Text 

Country 🛈

30Text

International Address Fields These are additional fields supplied with the standard field list

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

Address1…7 🛈

120Text

Principality 🛈

60Text  

Region 🛈

60Text  

Cedex 🛈

60Text  

Country 🛈

30Text 

CountryISO 🛈

3Text 

Alias Localities (Non-postally required Localities)

FieldnameField LengthData TypePostcodePostcode PlusNames & NumbersZip
Address
World
Address
Eircode Validation

AliasLocalities 🛈

4Text    

CountryISO 🛈

35Text    

Result Codes

The below table describes the possible result codes and error messages:

ResultDescription
1Success
-1Invalid Field spec
-2No Results Found
-4Error Loading Data Files
-7Data License Error

For the correct data option to use, please see the Data Selector section (see Section 3).

Lookup Tasks

Lookup Tasks are a group of different calls that each accepts only one search parameter, specified using a Lookup string.

FastFindV4

FastFindV4 optimises the Fast Find task for TypeAhead situations.

It is necessary to specify a &uniqueID that should remain the same for a single search. This allows our billing system to make sure that each keypress is not being charged separately. We also recommend setting the &maxquantity to a number between 5 and 7 as this will increase the responsiveness of your TypeAhead control.

DescriptionExample
UK PostcodeB11
House No. and Postcode276,B111AA
OrganisationRoyal Mail

🛈 This task allows a single text string containing search terms to be entered and is used to provide typeahead functionality (“search as you type”).
🛈 We also recommend setting the &maxquantity to a number between 5 and 7 as this will increase the responsiveness of your TypeAhead control.

https://api.afd.co.uk/v1/address/GBR/fastfindv4?serial=333333&password=pwd&uniqueID=abcd123&fields=list&format=json&lookup=ROYAL&maxquantity=1

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "AB10 1BD",
      PostcodeFrom: "",
      List: "AB10 1BD    The Royal British Legion, 46a Union Street, ABERDEEN",
      Key: "105",
      CountryISO: "GBR"
    }
  ]
}
				
			

Fast Find

To lookup matching addresses quickly from search criteria such as Commercial Street, Birmingham.

The Fast Find task accepts a single string as input, and if successful returns one or more records. The input can be a postcode, or an address element, or a combination of these separated by a comma.

DescriptionExample
UDPRN00338899
Organisation and TownRoyal Mail, Birmingham
Street and TownCommercial Street, Birmingham
Organisation and PostcodeRoyal Mail, B6 4AA

🛈 This task is highly flexible as it allows a single text string containing search terms to be entered.

https://api.afd.co.uk/v1/address/GBR/fastfind?serial=333333&password=pwd&fields=list&format=json&lookup=Royal%20Mail%2CB6%204AA&maxquantity=5

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B6 4AA",
      PostcodeFrom: "",
      List: "B6 4AA      Royal Mail, Birmingham Mail Centre, St. Stephens Street, BIRMINGHAM",
      Key: "338899",
      CountryISO: "GBR"
    }
  ]
}
				
			

Lookup

To lookup matching addresses quickly from a postcode, e.g., B11 1AA. Only a full postcode without any property information included will yield results.

By entering a single string, the user can find the results matching their lookup criteria.

  • This task should be used when the full postcode is always known.
  • It will only accept a full postcode.
  • Including a space in the postcode is optional.
  • It can return one or more results (including multiple streets when a postcode is on a multiple locality record).
DescriptionExample
UK PostcodeB6 4AA

🛈 This task should be used if you only ever intend to send a postcode as input, as it will not attempt to search for invalid input.

https://api.afd.co.uk/v1/address/GBR/lookup?serial=333333&password=pwd&fields=list&format=json&lookup=B6%204AA

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B6 4AA",
      PostcodeFrom: "",
      List: "B6 4AA      Royal Mail, Birmingham Mail Centre, St. Stephens Street, BIRMINGHAM",
      Key: "338899",
      CountryISO: "GBR"
    }
  ]
}
				
			

Property Lookup

To lookup matching addresses quickly from a postcode, which may optionally include property information to find a match, e.g., 276, B11 1AA.

  • The Property Lookup task can accept either a postcode or a postcode and property name or number.
  • It can return one or more results.
DescriptionExample
House No. and Postcode276,B111AA
Property and PostcodeFlat 2,B11 1AA

🛈 This task is useful if using input that always includes a full postcode but may also include a property or street number.

https://api.afd.co.uk/v1/address/GBR/propertylookup?serial=333333&password=pwd&fields=list&format=json&lookup=280%2CB11%201AA&maxquantity=1

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B11 1AA",
      PostcodeFrom: "",
      List: "B11 1AA     280 Stratford Road, Sparkhill, BIRMINGHAM",
      Key: "379670",
      CountryISO: "GBR"
    }
  ]
}
				
			

Search

The search function allows records to be located by searching using specific fields rather than a general lookup string. Any Available Fields are supported as the input, and if successful it returns one or more records.

For the correct data option to use, please see the Data Selector section (see Section 3).

DescriptionsExample
Searchable Field&Street=280%20Stratford%20Road&Town=Birmingham

🛈 This task should be used if the input fields conform to a rigid mapping.

https://api.afd.co.uk/v1/address/GBR/search?serial=333333&password=pwd&fields=list&format=json&Street=280%20Stratford%20Road&Town=Birmingham&maxquantity=1

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B11 1AA",
      PostcodeFrom: "",
      List: "B11 1AA     280 Stratford Road, Sparkhill, BIRMINGHAM",
      Key: "379670",
      CountryISO: "GBR"
    }
  ]
}
				
			

Retrieve

🛈 Only one item will ever be returned from a Retrieve Task as you are requesting a single item, by its key, which was earlier returned in a list.

To retrieve the record selected, you should use the key Field which will have been returned with each result.

For the correct data option to use, please see the Data Selector section (see Section 3).

DescriptionExample
Key379670

🛈 This task should be used with the specified key to retrieve the address.

https://api.afd.co.uk/v1/address/GBR/retrieve?serial=333333&password=pwd&fields=list&format=json&key=379670&maxquantity=1

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B11 1AA",
      PostcodeFrom: "",
      List: "B11 1AA     280 Stratford Road, Sparkhill, BIRMINGHAM",
      Key: "379670",
      CountryISO: "GBR"
    }
  ]
}
				
			

Geolocation

This functionality is available with an optional high-resolution license which will return the nearby addresses in the correct order.

FastFindGeo

This works in the same way as FastFindV4 (see Section 5.2); however, uses a special field preset of geolist to return location data.

https://api.afd.co.uk/v1/address/GBR/fastfindgeo?serial=333333&password=pwd&uniqueID=abcd123&fields=geolist&lookup=280%20Stratford%20Road%2CBirmingham&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "B11 1AA",
      PostcodeFrom: "",
      List: "280 Stratford Road, Sparkhill, BIRMINGHAM, B11 1AA",
      Key: "379670",
      CountryISO: "GBR",
      GridE: "408834",
      GridN: "284629",
      Latitude: "52.4596",
      Longitude: "-1.8714"
    }
  ]
}
				
			

Nearest

This accepts Latitude/Longitude coordinates as input and returns nearby addresses to the supplied location. This feature is most useful on mobile devices, such as mobile phones or other devices equipped with GPS.

JSON Format

https://api.afd.co.uk/v1/address/GBR/nearest?serial=333333&password=pwd&uniqueID=abcd123&fields=list&maxquantity=5&longitude=-1.6787&latitude=53.8507&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Postcode: "LS19 6ET",
      PostcodeFrom: "",
      List: "LS19 6ET    Welbeck House, Over Lane, Rawdon, LEEDS",
      Key: "14057846",
      CountryISO: "GBR"
    }, ...
				
			

Additional Parameters

These are parameters that you can specify for additional functionality. The detail below outlines the parameter function and the default value if the parameter is not specified.

&noAlias – the service returns alias localities as default.

OptionDescription
0Returns Alias Localities
1Returns no Alias Localities

&skip – the service does not skip any results as default.

Field ValueDescription
None (or blank)Returns all records matching the lookup or search criteria specified.
AddressOnly the first record per address (e.g. first listed resident) is returned. Only has any effect in Names & Numbers.
PostcodeOnly the first record per postcode is returned.
SectorOnly the first record in each postcode sector is returned. (A postcode sector is the portion of the postcode before the space plus the first digit after it, e.g. B11 1 is a sector).
OutcodeOnly the first record per Outcode is returned. The Outcode is the portion of the postcode before the space, e.g. B11.
TownOnly the first record per Post Town, e.g. Birmingham is returned.
AreaOnly the first record per Postcode Area is returned. A Postcode Area is the letters at the start of the postcode, e.g. B11 1AA is in Postcode Area B, IM8 is in Postcode Area IM.

&NoSort – this sort option is for Names & Numbers only.

OptionDescription
0Returns in number sorted order
1Returns sorted by DPS

&ApproxGrids – works with Address Management Products Containing Grid References only.

OptionDescription
0No approximations
1Returns an approximate grid reference for the postal town or locality of a postcode where no postcode level grid reference exists in the data.

&Postzon

OptionDescription
0Standard Grids returned
1Return Royal Mail Postzon grid references in preference to DataTalk GeoRef grids.

&crownISO – this option is for Postcode Plus only.

OptionDescription
0Default Country ISO returned for Crown Dependencies (GBR)
1Crown Dependancy ISO returned (IMN,JSY,GGY)

&pafOnly – Postcode Plus Business Only

OptionDescription
0All Business records returned
1Returns only PAF records.

DX Data

🛈 DX is available in our Postcode Plus and Names & Numbers product

DX enables you to look up and search for DX addresses just as you can do with Royal Mail postal addresses. Uniquely, the API also allows you to easily identify DX addresses associated with a PAF address to route your mail through a DX member’s box wherever possible resulting in savings over Royal Mail.

Postcode Evolution will automatically return a DXNumber and DXExchange field in the XML if you have the DX data enabled.

When results are returned following any lookup or search if the address is also a DX Member the DXNumberDXExchange, and DXProfession fields will also be returned to indicate this. You can format a DX address as follows for printing:

LabelAddress
OrganisationGateley LLP
DXNumberDX 14317
DXExchangeMANCHESTER
DXProfessionSolicitor

International Data

WorldAddress works similarly to our other address products. The difference in normal operation is the need to specify the Country or CountryISO code (as parameters in the GET request) of the country you wish to use in all lookup, search, and record retrieval operations. Furthermore, for a WorldAddress lookup, the initial request must contain the fields=list parameter.

Making use of the data returned

In the retrieve request, if you have opted to use Standard, Raw PAF, or BS7666 fields the data will be returned in the same fields as those for the UK (including the county in some cases) which you can use to store the data in your database in the same format as you do for UK addresses.

However, when it comes to generating an address label, you should note that the formatting rules for addresses vary from country to country (for example in many Western European countries the post/zip code comes before the town on the same line). Unless you have your own printing or formatting routines for the country in question, you may therefore actually prefer to use our International address format which provides both the consistent address fields (broadly the same as Raw PAF fields but also adding the Principality, Region, and Cedex which is relevant to some international addresses) as well as address label formatted fields (address1 through to address7). This enables you to both have a structure ideal for data storage and for label formatting.

If you need to store addresses in a more UK based format, but then need to format them for printing you can easily do so by carrying out a search operation specifying the address data with the International field type to obtain the address for printing at the time that you wish to generate an address label.

Utilities

List

List Countries

You can populate a drop-down list of countries in your application for the user to choose from. If you wish to have a complete list you can do so programmatically by calling the Country List function.

  • Use this Task to list the Alpha-3 Country ISO Codes.
  • Any license will show these CountryISO’s.

https://api.afd.co.uk/v1/address/FRA/listcountries?fields=list&serial=333333&password=pwd&format=json

				
					{
	Result: "1",
	ErrorText: "",
	Item: [
		{
			@value: "1",
			iso: "AFG",
			name: "Afghanistan"
		},
		{
			@value: "2",
			iso: "ALA",
			name: "Aland Islands"
		},
		{
			@value: "3",
			iso: "ALB",
			name: "Albania"
		}, ...
	]
}
				
			

List Country

https://api.afd.co.uk/v1/address/FRA/listcountry?fields=list&serial=333333&password=pwd&format=json

				
					{
    Result: "1",
    ErrorText: "",
    Item: [
		{
			@value: "1",
			List: "Afghanistan"
		},
		{
			@value: "2",
			List: "Aland Islands"
		},
		{
			@value: "3",
			List: "Albania"
		}, ...
    ]
}
				
			

List CountryISO

https://api.afd.co.uk/v1/address/FRA/listcountryiso?fields=list&serial=333333&password=pwd&format=json
				
					{
	Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "AFG"
        },
        {
            @value: "2",
            List: "ALA"
        },
        {
            @value: "3",
            List: "ALB"
        }, ...
    ]
}
				
			

List Address

List Organisation

http://api.afd.co.uk/v1/list/GBR/listorganisation?fields=list&serial=333333&password=pwd&lookup=Royal%20Parks&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "ROYAL PARKS"
        },
        {
            @value: "2",
            List: "ROYAL PARKS AGENCY"
        }
    ]
}
				
			

List Property

https://api.afd.co.uk/v1/list/GBR/listproperty?fields=list&serial=333333&password=pwd&lookup=Stratford%20park&format=json

				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "STRATFORD PARK"
        },
        {
            @value: "2",
            List: "STRATFORD PARK LEISURE CENTRE"
        }
    ]
}
				
			
https://api.afd.co.uk/v1/list/GBR/liststreet?fields=list&serial=333333&password=pwd&lookup=Stratford%20park&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "STRATFIELD PARK"
        }
    ]
}
				
			

List Locality

https://api.afd.co.uk/v1/list/GBR/listlocality?fields=list&serial=333333&password=pwd&lookup=Lee%20bank&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "LEE BANK"
        }
    ]
}
				
			

List Town

https://api.afd.co.uk/v1/list/GBR/listtown?fields=list&serial=333333&password=pwd&lookup=Birmingham&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BIRMINGHAM"
        }
    ]
}
				
			

List County

https://api.afd.co.uk/v1/list/GBR/listcounty?fields=list&serial=333333&password=pwd&lookup=Westminster&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "WESTMINSTER"
        }
    ]
}
				
			

List Mailsort Code

https://api.afd.co.uk/v1/list/GBR/listmailsortcode?fields=list&serial=333333&password=pwd&lookup=34439&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "34439"
        }
    ]
}
				
			

List Names

This function requires a Names & Numbers license.

List Forename

https://api.afd.co.uk/v1/list/GBR/listforname?fields=list&serial=333333&password=pwd&lookup=JOE&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "JOE"
        },
        {
            @value: "2",
            List: "JOE A"
        },
        {
            @value: "3",
            List: "JOE DAVID"
        }
    ]
}
				
			

List Surname

https://api.afd.co.uk/v1/list/GBR/listsurname?fields=list&serial=333333&password=pwd&lookup=BLOGGS&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BLOGGS"
        },
        {
            @value: "2",
            List: "BLOGGSY"
        }
    ]
}
				
			

List Council Tax Band

https://api.afd.co.uk/v1/list/GBR/listcounciltaxband?fields=list&serial=333333&password=pwd&lookup=A&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "A"
        }
    ]
}
				
			

List Censation

The Censation fields provide coding and descriptors based on Census information. The following List tasks will return all possible values returned within the Censation fields.

Censation classifies each postcode into one of 52 ‘segments’ each with its own 4 character Censation segment code.

The first letter indicates how rich or poor people living in a postcode are likely to be. Are your customers wealthy, prosperous, comfortable, striving or struggling?

The second letter in a Censation code indicates the life-stage of your customers. Young singles, young families, older families, families with children who have left home (empty nesters), or seniors.

The last two digits of a Censation code highlight distinctive characteristics drawn from the underlying Census, Residential or Commercial data or from research, residential, and transaction data. A short additional description is put in descending order with the strongest or most likely attribute first. Finally, a detailed supporting table with over 30 different characteristics is provided.

Further ‘unclassified’ codes are allocated to postcodes for which census data is unavailable. These mainly describe the make-up of commercial areas.

List Censation Code

https://api.afd.co.uk/v1/list/GBR/listcensationcode?fields=list&serial=333333&password=pwd&lookup=AY0&format=json

				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "AY04"
        },
        {
            @value: "2",
            List: "AY08"
        }
    ]
}
				
			

List Affluence

https://api.afd.co.uk/v1/list/GBR/listaffluence?fields=list&serial=333333&password=pwd&lookup=B&format=json

				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "B, Prosperous"
        }
    ]
}
				
			

List Lifestage

https://api.afd.co.uk/v1/list/GBR/listlifestage?fields=list&serial=333333&password=pwd&lookup=X&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "X, Older families"
        }
    ]
}
				
			

List Additional Census Info

https://api.afd.co.uk/v1/list/GBR/listadditionalcensusinfo?fields=list&serial=333333&password=pwd&lookup=11&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "11, High incomes, with many Christians, employed in finance and business services"
        }
    ]
}
				
			

List Business

https://api.afd.co.uk/v1/list/GBR/listbusiness?fields=list&serial=333333&password=pwd&lookup=Dry&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "DRY CLEANERS"
        },
        {
            @value: "2",
            List: "DRY CLEANING AND LAUNDRY SERVICES"
        },
        {
            @value: "3",
            List: "DRYSTONE WALLING"
        }
    ]
}
				
			

List Size

https://api.afd.co.uk/v1/list/GBR/listsize?fields=list&serial=333333&password=pwd&lookup=I&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item": [
        {
            @value: "1",
            List: "I: 501+"
        }
    ]
}
				
			

List SIC

JSON Format

https://api.afd.co.uk/v1/list/GBR/listsic?fields=list&serial=333333&password=pwd&lookup=841&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "84110"
        },
        {
            @value: "2",
            List: "84120"
        }
    ]
}
				
			

List Geographical

List Urban Rural Code

https://api.afd.co.uk/v1/list/GBR/listurbanruralcode?fields=list&serial=333333&password=pwd&lookup=A1&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "A1"
        }
    ]
}
				
			

List Urban Rural Name

https://api.afd.co.uk/v1/list/GBR/listurbanruralname?fields=list&serial=333333&password=pwd&lookup=Urban&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "URBAN CITY AND TOWN"
        },
        {
            @value: "2",
            List: "URBAN MAJOR CONURBATION"
        },
        {
            @value: "3",
            List: "URBAN MINOR CONURBATION"
        }
    ]
}
				
			

List TV Region

https://api.afd.co.uk/v1/list/GBR/listtvregion?fields=list&serial=333333&password=pwd&lookup=Midlands&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "MIDLANDS"
        }
    ]
}
				
			

List Health

List NHS Code

https://api.afd.co.uk/v1/list/GBR/listnhscode?fields=list&serial=333333&password=pwd&lookup=7A&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "7A1"
        },
        {
            @value: "2",
            List: "7A2"
        },
        {
            @value: "3",
            List: "7A3"
        }
    ]
}
				
			

List NHS Name

https://api.afd.co.uk/v1/list/GBR/listnhsname?fields=list&serial=333333&password=pwd&lookup=borders&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BORDERS"
        }
    ]
}
				
			

List NHS Region Code

https://api.afd.co.uk/v1/list/GBR/listnhsregioncode?fields=list&serial=333333&password=pwd&lookup=Y2&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "Y21"
        },
        {
            @value: "2",
            List: "Y22"
        },
        {
            @value: "3",
            List: "Y23"
        }
    ]
}
				
			

List NHS Region Name

https://api.afd.co.uk/v1/list/GBR/listnhsregionname?fields=list&serial=333333&password=pwd&lookup=Midlands&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "MIDLANDS AND EASTERN"
        }
    ]
}
				
			

List CCG Code

https://api.afd.co.uk/v1/list/GBR/listpctcode?fields=list&serial=333333&password=pwd&lookup=E3800000&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "E38000004"
        },
        {
            @value: "2",
            List: "E38000006"
        },
        {
            @value: "3",
            List: "E38000007"
        }
    ]
}
				
			

List CCG Name

https://api.afd.co.uk/v1/list/GBR/listpctname?fields=list&serial=333333&password=pwd&lookup=EAST%20AND%20NORTH&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "EAST AND NORTH HERTFORDSHIRE"
        }
    ]
}
				
			

List Administrative

List Ward Code

https://api.afd.co.uk/v1/list/GBR/listwardcode?fields=list&serial=333333&password=pwd&lookup=E0500002&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "E05000026"
        },
        {
            @value: "2",
            List: "E05000027"
        },
        {
            @value: "3",
            List: "E05000028"
        }
    ]
}
				
			

List Ward Name

https://api.afd.co.uk/v1/list/GBR/listwardname?fields=list&serial=333333&password=pwd&lookup=Westhill&format=json

				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "WESTHILL AND DISTRICT"
        }
    ]
}
				
			

List EER Code

https://api.afd.co.uk/v1/list/GBR/listeercode?
fields=list&serial=333333&password=pwd&lookup=E15&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "E15000001"
        },
        {
            @value: "2",
            List: "E15000002"
        },
        {
            @value: "3",
            List: "E15000003"
        }
    ]
}
				
			

List EER Name

https://api.afd.co.uk/v1/list/GBR/listeername?
fields=list&serial=333333&password=pwd&lookup=West%20Midlands&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "WEST MIDLANDS"
        }
    ]
}
				
			

List Authority Code

https://api.afd.co.uk/v1/list/GBR/listauthoritycode?
fields=list&serial=333333&password=pwd&lookup=E0800000&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "E08000001"
        },
        {
            @value: "2",
            List: "E08000002"
        },
        {
            @value: "3",
            List: "E08000003"
        }
    ]
}
				
			

List Authority

https://api.afd.co.uk/v1/list/GBR/listauthority?fields=list&serial=333333&password=pwd&lookup=birmingham&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BIRMINGHAM"
        }
    ]
}
				
			

List LEA Code

https://api.afd.co.uk/v1/list/GBR/listleacode?fields=list&serial=333333&password=pwd&lookup=330&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "330"
        }
    ]
}
				
			

List LEA Name

https://api.afd.co.uk/v1/list/GBR/listleaname?fields=list&serial=333333&password=pwd&lookup=birmingham&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BIRMINGHAM"
        }
    ]
}
				
			

List Constituency Code

https://api.afd.co.uk/v1/list/GBR/listconstituencycode?fields=list&serial=333333&password=pwd&lookup=E1400053&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "E14000530"
        },
        {
            @value: "2",
            List: "E14000531"
        },
        {
            @value: "3",
            List: "E14000532"
        }
    ]
}
				
			

List Constituency Name

https://api.afd.co.uk/v1/list/GBR/listconstituency?fields=list&serial=333333&password=pwd&lookup=Birmingham&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "BIRMINGHAM, EDGBASTON"
        },
        {
            @value: "2",
            List: "BIRMINGHAM, ERDINGTON"
        },
        {
            @value: "3",
            List: "BIRMINGHAM, HALL GREEN"
        }
    ]
}
				
			

List Devolved Constituency Code

https://api.afd.co.uk/v1/list/GBR/listdevolvedconstituencycode?fields=list&serial=333333&password=pwd&lookup=S16&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "S16000074"
        },
        {
            @value: "2",
            List: "S16000075"
        }
    ]
}
				
			

List Devolved Constituency Name

https://api.afd.co.uk/v1/list/GBR/listdevolvedconstituencyname?fields=list&serial=333333&password=pwd&lookup=Aberd&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "ABERDEEN CENTRAL"
        },
        {
            @value"2",
            List: "ABERDEEN DONSIDE"
        }
    ]
}
				
			

List Alias Locality

This Task is a per postcode lookup. This will not supply a list of Alias Localities in the UK. https://api.afd.co.uk/v1/list/GBR/listaliaslocality?fields=list&serial=333333&password=pwd&lookup=B13%200AA&format=json
				
					{
    Result: "1",
    ErrorText: "",
    Item: [
        {
            @value: "1",
            List: "Alcester Lane's End"
        },
        {
            @value: "2",
            List: "Billesley Common"
        },
        {
            @value: "3",
            List: "Springfield"
        }
    ]
}
				
			

List Products

🛈 This is not a rest API call. https://pce.afd.co.uk/afddata.pce?data=list&task=listproducts&fields=list&serial=333333&password=pwd&CountryISO=GBR&format=json
				
					{
    Result: 1,
    ErrorText: "",
    AccountDetails: {
        Serial: "113355",
        Status: "Enabled"
    },
    Products: {
        Product: [
            {
                Name: "Postcode Plus",
                Data: "address"
            },
            {
                Name: "BankFinder",
                Data: "bank"
            },
            {
                Name: "Email Validation",
                Data: "email"
            },
            {
                Name: "Phone Validation",
                Data: "phone"
            }
        ]
    }
}
				
			

Grid

🛈 This section applies to all UK address products

These functions are used to carry out operations related to grid references and latitude and longitude values. You can convert between GB and Irish based grid references and also convert to and from latitude and longitude values. The facility to convert a value in kilometers to miles and vice-versa, return an approximate grid reference for a location and also calculate the distance between two geographical locations is also included.

To carry out a grid operation you would pass the grid or latitude and longitude to the afddata.pce? URL on the Postcode Evolution server as described above.

Convert and Convert1m

ParametersDescription
&GBGridE&GBGridN Or
&NIGridE&NIGridN Or
&Latitude&Longitude Or
&TextualLatitude&TextualLongitude And/Or
&Miles/&Km
Converts a GB or NI based grid reference, or latitude and longitude value to all other grid reference types and latitude and longitude values.

The Convert1m function returns grids to a 1m resolution (6-digit), whereas Convert returns 5-digit grids. |

JSON Format

https://api.afd.co.uk/v1/grid/GBR/convert?serial=333333&password=pwd&UserID=MyApp&Fields=Standard&GBGridE=40660&GBGridN=28650&format=json

				
					{
   Result: "1",
   ErrorText: "",
   Item: [
       {
          @value: "1",
          Lookup: "",
          GBGridE: "40660",
          GBGridN: "28650",
          NIGridE: "61409",
          NIGridN: "15357",
          Latitude: "52.4764",
          Longitude: "-1.9043",
          TextualLatitude: "N 52°, 28' 35\"",
          TextualLongitude: "W 1°, 54' 15\"",
          Km: "0.0",
          Miles: "0.0",
          GBGridEFrom: "",
          GBGridNFrom: "",
          NIGridEFrom: "",
          NIGridNFrom: "",
          LatitudeFrom: "",
          LongitudeFrom: "",
          TextualLatitudeFrom: "",
          TextualLongitudeFrom: ""
        }
    ]
}
				
			

LookupLocation and LookupLocation1m

ParametersDescription
LookupLooks up a town, locality, or partial postcode specified in the Lookup field and provides an approximate grid reference and latitude and longitude values for the location if a match is found. Multiple matches may be returned if the location is ambiguous.

The LookupLocation1m function returns grids to a 1m resolution (6-digit), whereas LookupLocation returns 5-digit grids.

JSON Format

https://api.afd.co.uk/v1/grid/GBR/lookuplocation?serial=333333&password=pwd&UserID=MyApp&Fields=Standard&Lookup=Isle%20of%20man&format=json

				
					{
   Result: "1",
   ErrorText: "",
   Item: [
      {
         @value: "1",
         Lookup: "Isle of Man, IM",
         GBGridE: "23770",
         GBGridN: "47560",
         NIGridE: "42961",
         NIGridN: "32811",
         Latitude: "54.1505",
         Longitude: "-4.4866",
         TextualLatitude: "N 54°, 9' 1\"",
         TextualLongitude: "W 4°, 29' 11\"",
         Km: "",
         Miles: "",
         GBGridEFrom: "",
         GBGridNFrom: "",
         NIGridEFrom: "",
         NIGridNFrom: "",
         LatitudeFrom: "",
         LongitudeFrom: "",
         TextualLatitudeFrom: "",
         TextualLongitudeFrom: ""
      }
   ]
}
				
			

DistanceMulti

ParametersDescription
lat1lng1 and lat2lng2, etc.Addition of multiple way points

JSON Format

https://pce.afd.co.uk/afddata.pce?serial=333333&password=pwd&UserID=MyApp&Data=grid&Task=distancemulti&fields=standard&lat1=57.1496&lng1=-2.0969&lat2=55.7433&lng2=-4.1996&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Km: "248.47",
      Miles: "154.42",
      Time: "179"
    }
  ]
}
				
			

XML Format

https://pce.afd.co.uk/afddata.pce?serial=333333&password=pwd&UserID=MyApp&Data=grid&Task=distancemulti&fields=standard&lat1=57.1496&lng1=-2.0969&lat2=55.7433&lng2=-4.1996&format=xml

				
					<AFDPostcodeEverywhere>
  <Result>1</Result>
  <ErrorText/>
  <Item value="1">
    <Km>248.47</Km>
    <Miles>154.42</Miles>
    <Time>179</Time>
  </Item>
</AFDPostcodeEverywhere>
				
			

Distance and Distance1m

ParametersDescription
&GBGridE&GBGridN Or
&NIGridE&NIGridN Or
&Latitude&Longitude
AND: &GBGridEFrom&GBGridNFrom Or
&NIGridEFrom&NIGridNFrom Or
&LatitudeFrom&LongitudeFrom
Calculates the distance between a pair of grid references or latitude and longitude values specified. You will need to set a grid or latitude and longitude value in both the normal fields and those prefixed with “From” to find the distance in both Miles and Km.

The Distance1m function returns grids to a 1m resolution (6-digit), whereas Distance returns 5-digit grids.

JSON Format

https://api.afd.co.uk/v1/grid/GBR/distance?serial=333333&password=pwd&UserID=MyApp&Fields=Standard&GBGridEFrom=40650&GBGridNFrom=28550&GBGridE=40660&GBGridN=28650&format=json

				
					{
   Result: "1",
   ErrorText: "",
   Item: [
      {
         @value: "1",
         Lookup: "",
         GBGridE: "40660",
         GBGridN: "28650",
         NIGridE: "61409",
         NIGridN: "15357",
         Latitude: "52.4764",
         Longitude: "-1.9043",
         TextualLatitude: "N 52°, 28' 35\"",
         TextualLongitude: "W 1°, 54' 15\"",
         Km: "1.0",
         Miles: "0.6",
         Time: "",
         GBGridEFrom: "40650",
         GBGridNFrom: "28550",
         NIGridEFrom: "61407",
         NIGridNFrom: "15257",
         LatitudeFrom: "52.4674",
         LongitudeFrom: "-1.9057",
         TextualLatitudeFrom: "N 52°, 28' 2\"",
         TextualLongitudeFrom: "W 1°, 54' 20\""
      }
   ]
}
				
			

Bank Finder

An application programming interface to access the BankFinder data. Please see the BankFinder Manual for more information.

Available Bank Fields

● = Field returned by this product and fully searchable
⚬ = Field returned by this product, but not searchable

🛈 Please note that the Field Lengths are only guidelines and are not limits.

The following shows the banking fields.

Field NameField LengthData TypeDescriptionBankFinder
Key40NumericUnique Identifier of this record
List512TextProvides a list item formatted to be added to a list box for this record
SortCode6NumericBank’s Sort code
BankBIC8TextBank BIC Code
BranchBIC3TextBranch BIC Code
SubBranchSuffix2NumericAllows a branch to be uniquely identified where there is a cluster of branches sharing the same Sort Code
ShortBranchTitle27TextThe official title of the branch
CentralBankCountryCode2NumericThe ISO Country code for beneficiary banks in other countries
CentralBankCountryName20TextThe country name corresponding to the ISO code given
SupervisoryBodyCode1NumericIndicates the supervisory body for an institution that is an agency in any of the clearings
SupervisoryBodyName50TextThe name of the supervisory body
DeletedDate10TextSpecifies the date the branch was closed if it is not active
BranchType20TextThe branch type – Main Branch, Sub or NAB Branch, Linked Branch
BranchName35TextDefines the actual name or place of the branch
FullBranchTitle105TextExtended title for the institution
Location60TextWhere present, this field indicates the physical location of the branch
AlternativeBranchName35TextAn alternative name or place for the branch where applicable
MainBranchSortCode6NumericSet for linked branches in a cluster. It identifies the main branch for the cluster. For IPSO records this is set to the branch that would handle transactions for this sort code when the branch has been amalgamated with another
BuildingSocietyName70TextFor building society accounts requiring a roll number this will contain the name of the receiving building society as this sometimes differs from the bank branch that the payment passes through
OwnerBankShortName20TextShort version of the name of the Owning Bank
OwnerBankFullName70TextFull version of the name of the Owning Bank
OwnerBankCode4NumericThe four-digit bank code of the Owning Bank
Organisation120TextOwner Bank Full Name
Property65TextBank Postal Address: Property (Building)
Street60TextBank Postal Address: Street
Locality60TextBank Postal Address: Locality
Town30TextBank Postal Address: Town
County30TextBank Postal Address: County (Optional)
Postcode8TextThe Royal Mail Postcode for this address
Phone20NumericPhone Number for this bank
Phone220NumericAdditional Phone Number for this bank
Fax20NumericFax Number for this bank (IPSO only)
ClearingSystem25TextClearing system for this record
BACSStatus5TextIndicates the BACS Clearing Status
BACSStatusDescription60TextDate on which BACS data was last amended
BACSClosedClearing10TextIndicates the date the branch was closed in BACS clearing if applicable
BACSRedirectedFromFlag1NumericSet to R if other branches are redirected to this sort code
BACSRedirectedToSortCode6NumericThis specifies the sort code to which BACS should redirect payments addressed to this sort code if applicable
BACSSettlementBankCode4NumericBACS Bank Code of the bank that will settle payments for this branch
BACSSettlementBankShortName20TextShort form name of the settlement bank
BACSSettlementBankFullName70TextFull form name of the settlement bank
BACSSettlementBankSection2NumericNumeric data required for BACS to perform it’s settlement
BACSSettlementBankSubSection2NumericNumeric data required for BACS to perform it’s settlement
BACSHandlingBankCode4NumericBACS Bank Code of the member that will take BACS output from this branch
BACSHandlingBankShortName20TextShort form name of the handling bank
BACSHandlingBankFullName70TextFull form name of the handling bank
BACSHandlingBankStream2NumericNumeric code defining the stream of output within the Handling Bank that will be used or payments to this branch
BACSAccountNumbered1NumericSet to 1 if numbered bank accounts are used
BACSDDIVoucher1NumericSet to 1 if Paper Vouchers have to be printed for Direct Debit Instructions
BACSDirectDebits1NumericSet to 1 if branch accepts Direct Debits
BACSBankGiroCredits1NumericSet to 1 if branch accepts Bank Giro Credits
BACSBuildingSocietyCredits1NumericSet to 1 if branch accepts Building Society Credits
BACSDividendInterestPayments1NumericSet to 1 if branch accepts Dividend Interest Payments
BACSDirectDebitInstructions1NumericSet to 1 if branch accepts Direct Debit Instructions
BACSUnpaidChequeClaims1NumericSet to 1 if branch accepts Unpaid Cheque Claims
CHAPSPStatus1NumericIndicates the CHAPS Sterling clearing Status
CHAPSPStatusDescription80TextProvides a description for the status
CHAPSPLastChange10TextDate on which CHAPS Sterling data was last amended
CHAPSPClosedClearing10TextIndicates the date the branch is closed in CHAPS Sterling clearing if applicable
CHAPSPSettlementBankCode3NumericCHAPS ID of the bank that will settle payments for this branch
CHAPSPSettlementBankShortName20TextShort form of the name of the settlement bank
CHAPSPSettlementBankFullName70TextFull form of the name of the settlement bank
CCCCStatus1NumericIndicates the C&CCC clearing Status
CCCCStatusDescription40TextProvides a description for the status
CCCCLastChange6NumericDate on which C&CCC data was last amended
CCCCClosedClearing30TextIndicates the date the branch is closed in C&CCC clearing if applicable
CCCCSettlementBankCode3NumericBACS generated code of the bank that will settle payments for this branch
CCCCSettlementBankShortName20TextShort form of the name of the settlement bank
CCCCSettlementBankFullName70TextFull form of the name of the settlement bank
CCCCDebitAgencySortCode50NumericWhen the Status field is set to ‘D’ this specifies where cheque clearing is handled for this branch
CCCCReturnIndicator6NumericSet if this is the branch that other banks should return paper to. It will only be set for a sort code of a Member
CCCCGBNIIndicator1TextIndicates for C&CCC purposes if the office is in mainland Great Britain (GB) or Northern Ireland (NI)
FPSStatus1TextIndicates if the branch can accept FPS payments and whether or not it is an agency
FPSStatusDescription60TextThe description for the FPStatus field
FPSLastChange10TextThe date on which FPS data for this record was last amended
FPSClosedClearing10TextThe date when the status of the branch was set to ‘N’ (does not accept FPS payments) if applicable
FPSRedirectedFromFlag1TextIf the branch is set as the redirection sort code for one or more bank offices this will be indicated here
FPSRedirectToSortCode6NumericIf output destined for this sort code has been redirected the sort code to redirect payment too will be displayed here
FPSSettlementBankCode4NumericThe Bank code of the FPS member that settles the FPS output for this sort code
FPSSettlementBankShortName20TextThe short name that goes with the above code
FPSSettlementBankFullName70TextThe full name that goes with the above code
FPSSettlementBankConnection2NumericTwo-digit connectivity code for settlement
FPSHandlingBankCode4NumericThe Bank code of the FPS member that handles the FPS output for this sort code
FPSHandlingBankShortName20TextThe short name that goes with the above code
FPSHandlingBankFullName70TextThe full name that goes with the above code
FPSHandlingBankConnection2NumericTwo-digit connectivity code for handling
FPSAccountNumberedFlag1NumericSet to Y is bank office has transferrable account numbers. N if it does not
FPSAgencyType1TextIndicates if the Bank office is a direct agency (D) or an indirect agency (I)
FPSAgencyTypeDescription60TextThe description for the above code, i.e., the code field has D/I that has a human-readable text version

Bank Result Codes

The below table describes the possible result codes and error messages when using the bank data product:

Result CodeDescription
2Validation Not Available
1Successful
-7Data License Error
-12Sort Code Not Found
-13Invalid Sort Code
-14Invalid Account Number
-15Invalid Expiry Date
-16Card Expired
-18Invalid Card Number
-19Visa ATM Only
-20Unrecognised Card Type
-21Invalid Roll Number
-22Invalid IBAN
-23Unrecognised Country
-24IBAN Mismatch

Bank Lookup Tasks

Lookup Tasks are a group of different calls that each accepts only one search parameter, specified using a Lookup string.

Bank Lookup

  • This task should be used when the full postcode/sort code is always known.
  • It will only accept a full postcode/sort code.
  • Including a space or hyphens in the sort code are optional.
  • It can return one or more results (including multiple streets when a postcode is on a multi locality record).
DescriptionExample
GBR Sort Code401101
IRL Sort Code930008

https://api.afd.co.uk/v1/bank/ALL/lookup?serial=333333&password=pwd&fields=list&lookup=401101&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Key: "4011010",
      List: "401101    Solihull, HSBC UK Bank PLC, Birmingham"
    }
  ]
}
				
			

Bank Property Lookup

Description Example
BranchName, SortCode Pudsey,560036
https://api.afd.co.uk/v1/bank/ALL/propertylookup?serial=333333&password=pwd&fields=list&lookup=Pudsey%2C560036&format=json
				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Key: "5600366",
      List: "560036    Pudsey, Nat West Bank PLC, Bradford"
    }
  ]
}
				
			

Bank Fast Find

Used to lookup bank data from a lookup string, for example, a sort code or bank and branch name, e.g. 560036.

The Search task accepts multiple strings as input, and if successful returns one or more records. The input can be a postcode, or an address element, or a combination of these separated by a comma.

DescriptionExample
OrganisationHSBC Bank PLC
Organisation, TownHSBC, BIRMINGHAM

https://api.afd.co.uk/v1/bank/ALL/fastfind?serial=333333&password=pwd&fields=list&lookup=HSBC%2C%20BIRMINGHAM&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Key: "4011010",
      List: "401101    Solihull, HSBC UK Bank PLC, Birmingham"
    },
    {
      @value: "2",
      Key: "4011020",
      List: "401102    Birmingham, New Street, HSBC UK Bank PLC, Birmingham"
    }
  ]
}
				
			

Search Tasks are a group of different calls that each accepts multiple search parameters, specified using a Search string. It searches for matching bank records based on specific search criteria.

The Search task accepts multiple strings as input, and if successful returns one or more records. The input can be a postcode, or an address element, or a combination of these separated by a comma.

Another way to do searches is to use any of the fields when using &fields=standard.

DescriptionsExample
Searchable Field&Organisation=RBS&Town=Birmingham

🛈 Any field can be searched.

https://api.afd.co.uk/v1/bank/ALL/search?serial=333333&password=pwd&fields=list&organisation=RBS&town=Birmingham&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Key: "413590",
      List: "041359    Optimus Cards UK Limited, Optimus Cards, Birmingham"
    },
    {
      @value: "2",
      Key: "502460",
      List: "050246    Yorkshire Bank Bft 2, Yorkshire Bank"
    }
  ]
}
				
			

Bank Retrieve

A retrieve is a call that returns individual address information specified using the key value, for example, when selected from a list.

DescriptionExample
Solihull, HSBC UK Bank PLC, Birmingham4011010
International Banking Services93000890

https://api.afd.co.uk/v1/bank/ALL/retrieve?serial=333333&password=pwd&fields=list&key=4011010&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Key: "4011010",
      List: "401101    Solihull, HSBC UK Bank PLC, Birmingham"
    }
  ]
}
				
			

Account Number Validation

This task provides the ability to validate a sort code and account number. It checks that the account number is valid for the branch of the bank to which the sort code belongs. This does not guarantee that the account number exists or sufficient funds exist for any transaction but greatly cuts down on errors due to incorrectly entered numbers. The Task will also translate any non-standard account numbers (e.g. a 10-digit account number).

You can also supply a Roll Number in the case of crediting some building society accounts which require one which will also be checked.

If the account number is invalid, the Result field returned will be set to a value less than zero and the ErrorText will contain a corresponding error message.

Assuming no error occurred, you can assume the account number is valid but should read the SortCodeAccountNumberIBAN, and RollNumber (if required) and TypeOfAccount parameters in-case the number has been translated.

If the return value is 1 then the account number has been validated, if the return value is 2 then account numbers on this sort code cannot be validated and so the number should still be treated as valid. This return code is provided so you can carry out an additional check on the account number, e.g. asking a customer on the phone to repeat it, checking it has been entered from a paper form correctly, etc. if you wish to do so.

Note that the only Field type valid for validating account numbers is Standard as the result contains no address. Only a single result will ever be returned so there is no need to list results.

Should you also wish to check the branch details match those that the customer has supplied, check the transaction types allowed at this branch, or obtain the address to use for this branch (may not be the branch physical location) then you can carry out a lookup for the sort code to obtain the branch information.

DescriptionExample
SortCode, Account774814, 24782346
IBANGB58 TSBS 7748 1424 7823 46

https://api.afd.co.uk/v1/bank/ALL/account?serial=333333&password=pwd&fields=account&sortcode=774814&accountnumber=24782346&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      SortCode: "774814",
      AccountNumber: "24782346",
      RollNumber: "",
      TypeOfAccount: "0",
      ClearingSystem: "United Kingdom (BACS)",
      IBAN: "GB58 TSBS 7748 1424 7823 46"
    }
  ]
}
				
			

Credit Card Validation

This Task provides the ability to validate a card number, and optionally check that an expiry date indicates that the card is in-date. It checks that the card number is a valid one for the type of card and can indicate the card type. This does not guarantee that the card exists or that a transaction will be authorized, but greatly cuts down on errors due to incorrectly entered numbers.

If the card number is invalid, the Result field returned will be set to a value less than zero and the ErrorText will contain a corresponding error message.

Assuming no error occurred, you can assume the card number is valid. If you wish to determine the card type, the CardType field will hold this information.

DescriptionExample
Card Number4903005748392742

https://api.afd.co.uk/v1/bank/ALL/card?serial=333333&password=pwd&fields=card&cardnumber=4903%200057%204839%202742&expirydate=01%2F25&format=json

				
					{
  Result: "-19",
  ErrorText: "Visa ATM Card Only"
}
				
			

Refiner

This section describes the Refiner product tasks for cleansing address information.

Note: This is only an installed product.

Clean

This product requires a Refiner API license.

You will need to set address fields in your structure to specify the address to be cleaned. These do not need to match up to the actual fields. For example, if you have Address Line 1, Address Line 2, Address Line 3, and Postcode in your database you could set these to Property, Street, Locality, and Postcode fields in the structure and they will be cleaned and returned in the correct named fields when matched. Note that if you set any non-address fields they will be ignored (please see Input and Output table for the list of fields that Refiner will use).

The request will return a negative value (less than zero) in the case where an address cannot be fully matched. This could be because the address was unmatchable, a non-UK address, or an ambiguous result was found (see Result Codes). An address will still be returned as this will include the address with Field Placement correction, which you can use if you desire.

Where the function returns a positive value (greater than zero) this means that the address has been uniquely matched. You may still like to examine the return value as this will give details as to the level to which the address was matched (see Result Codes). Many other fields are also available with additional non-address data, which you may require.

In the case of an ambiguous or suggested result (see Result Codes), the first address returned from the function will be the original address with field placement. For non-batch processes, you may wish to present a list of addresses for the user to choose from and in this case, you can continue to call the request as above repeatedly with the same operation code as before.

Input

Refiner will take address field input in the following format:

Input FieldsDescription
Address(n)(where n is 1 to 10) which allows address data to be sent in
UDPRNwhich specifies a UDPRN number of a record
UPRNwhich specifies an OS UPRN number (optional dataset available)
Other FieldsFields which specify a list of fields to output

Output

Refiner will output the following fields:

Output FieldsDescription
Result CodeIndicates the status of the match (see Result Codes)
ClosenessIndicates how close the original address is to the one output on a percentage scale
Other FieldsFields specified in the preset which include all fields supported by Postcode Plus with the addition of Address(n) (where n is 1 to 10) as the address data output (each line in a separate field)

Fields Parameter

The possible field string, which determines what data is output in addition to the fields above: * Organisation@Property@Street@Locality@Town@PostalCounty@Postcode
Organisation@addr1:60@addr2:60@addr3:60@addr4:60@Postcode
standard
list
raw
bs7666
simple

Refiner Result Codes

The below table describes the possible result codes and error messages:

Result CodeDescription
100Complete Match – Full Address matches identically.
200Corrected Match – Address verified from the Postcode and matches a record with some correction.
201Changed Postcode Match – Address verified from a postcode that was changed due to a Royal Mail recoding and now matches.
202Assume Postcode Correct – Property Match assuming the postcode is correct.
203Assume Changed Postcode Correct – Property Match with Changed Postcode assuming the original postcode is correct.
204Postcode Match (non-matched property added in).
205Postcode Match (postcode changed and non-matched property added in).
300Full DPS Match (Different postcode returned) – Address verified with some correction, looking wider than just the specified Postcode.
301Full DPS Match – Address verified. Multiple PAF delivery point records exist for this address and the organisation could not be matched. As a result the specific DPS/UDPRN could not be returned.
400Street Match – Address verified to Street Level, i.e. the property was not matched, but a unique match to the street was identified on a single postcode.
-1No Match Found – Refiner has been unable to match this record.
-2Ambiguous Postcode – Refiner has matched this record to Street Level but cannot determine which is the correct Postcode.
-3Suggested Record – Refiner has found a unique possible match for this record but there is not enough address data to reliably match it.
-4Ambiguous Address – Refiner has given several possibilities that this address could match to.
-5International Address – This address was detected as being an International Address and therefore cannot be cleaned as data is only present for cleaning UK, Channel Isles and Isle of Man addresses.
-6No Address Data Supplied – No record data was supplied. Refiner cannot clean this address as no address data was given.
-7Data License Error

Example

https://localhost:81/v1/refiner/GBR/clean?serial=333333&password=pwd&format=json&fields=organisation%40property%40street%40locality%40town%40county%40postcode%40list%40udprn&address1=AFD%20Software%20Ltd&address2=&address3=Lezayre%2C%20Ramsey&address4=&address5=ISLE%20OF%20MAN&address6=&address7=IM7%202DZ

				
					{
  ResultCode: 200,
  Closeness: 66,
  organisation: "A F D Software Ltd",
  property: "Mountain View Innovation Centre",
  street: "Jurby Road",
  locality: "Lezayre, Ramsey",
  town: "Isle of Man",
  county: "",
  postcode: "IM7 2DZ",
  list: "IM7 2DZ     A F D Software Ltd, Mountain View Innovation Centre, Jurby Road, Lezayre, Ramsey, ISLE OF MAN",
  udprn: "53708644"
}
				
			

Refiner Additional Options

ParameterDescription
FieldName(n)=(value)(where n is 1 to 10) which allows the field name to be specified (when known) for the data, valid values are Organisation, Property, HouseNumber, Street, Locality, Town, County, and Postcode
AttachMode=1Used to simply attach data based on the postcode, doesn’t verify the address
PostcodeOnly=1If it can, it will verify an address purely using the postcode (returning only 100/200 result codes)
FullMatch=1Only returns full PAF matches, i.e. if the property is not on PAF, a street-level match will not be offered
Speed=1Skips slower portions of processing (lowers match rate but improves performance)
Interactive=1Specifies the address is being returned to a user interactively to check. (For example, when a user has entered an address manually and the suggested address is displayed). This allows results to be returned with low confidence for an automated match
Ambiguous=1This allows ambiguous matches the user can choose from
Dedupe=1Enables deduplication
DedupeFields=List of fields, separated by @ to dedupe on (e.g. Postcode|UDPRN|Name)
FormatNonMatched=1This provides a formatted result for non-matched addresses (by default only the result code is returned unless using compatibility (non-path based) calls)
POBoxLast=1Means Refiner attempts to match to a street address in preference to PO Box when both are present in the source address
RetainAlias=1Means that Refiner will retain Alias Localities if present in the source address
NoDefaultDPS=1For non-DPS matches (e.g. 400) Refiner will use a default DPS value of 9Z as that is acceptable for mailing purposes. This option means the field will instead be blank in such cases
NoOrgFill=1This means un-matched data will not be moved to the organisation from the source address. This is useful if the customer doesn’t map back an organisation field
PostcodeCorrect=1When this is specified, Refiner will assume the source postcode is correct and therefore match records with otherwise lower confidence on the same postcode. This should only be used where there is a very high confidence level about the postcode or in manual matching

Line Squeezing

This allows you to specify field lengths and a fixed town field as well as to optionally include the county which allows for more control over squeezing fields.

For example: addr1:60@addr2:60@addr3:60 squeezes the address fields (minus the postcode) into 3 fields, concatenating fields as required to do so.

The below table gives optional fields that may help in squeezing fields:

ParameterDescription
fixtown=(n)Fix the town to the (n) address field
upper(field)=1Sets the field to upper case. Eg uppertown=1 sets town to upper case
includeCounty=YIncludes the county if a dedicated county field has not already been specified
includeCounty=SThe county is included if there is space

Batch of POST Requests

To allow greater performance, batch requests are also handled by the system. Up to 100 records can be submitted at once for processing. These will be returned within a pre-set time out (default 60 seconds, URL parameter &maxTime= can reduce this).

The MaxPOSTRecs and MaxPOSTTime settings in the pceConfig.xml file allow these limits to be tweaked.

The format of the return will provide the number of records processed (as may be less than supplied if maximum time interval exceeded – those records not processed should be re-posted to the service). Each item returned represents a single record processed.

An example POST request would be:

https://api.afd.co.uk/v1/refiner/GBR/clean?serial=333333&password=pwd&fields=organisation%40property%40street%40locality%40town%40county%40postcode%40list%40udprn&format=json

With POST data:

172 Hereson Road~ramsgate~Ct117el
AFD software~mountain view~isle of man~im72dz
33 cannan avenue~kirk michael~isle of man~im61hg

Compatibility Information

A compatibility layer is provided that aliases old-style requests to new ones and provides any omitted functionality so that existing API users can migrate to the new API without any issues. All functionality, as documented in the current evolution API, should function with this in-place.

For clarity, the cleaning options from the older style relate to the following new style options:

Previous Implementation CodeNew Refiner Parameter
0Standard cleaning (no additional options unless specified)
1&postcodeonly=1
2&fullmatch=1
3&attachmode=1
T&ambiguous=1
S&interactive=1
P&poboxlast=1
L&retainalias=1
W&nodefaultdps=1
O&noorgfill=1
U&postcodecorrect=1
Fno equivalent but is taken account of
Compatibility CodesNew Refiner CodeDescription
302301Full DPS Match Limited
-101-1No Match Found
-102-2Ambiguous Postcode
-103-3Suggest Record
-104-4Ambiguous Match
-105-5International Address
-106-6No Record Data

Nearest Installed

Note: This is an installed product only.

This data parameter is used to find the Nearest in your database to a specified postcode or location.

Database Parameters for Nearest

When using Nearest you will also need to specify the following parameter to specify the database to use (this is connected too on the server-side):

ParameterDescription
DBConnectThe name of the database to connect to as defined by a name section in nearest.xml

As a security precaution, only databases specified in nearest.xml can be connected to and the settings which are used are specified in that .xml file. The nearest.xml file will already be located in your PCE install location and has a section called name where DBname is the name used in the DBConnect parameter for PCE calls.

Settings

All of the below settings can be added and amended in the Nearest XML located in the install location.

This set of sections specify each Nearest database table in use, most customers will only have one but an infinite number is supported. The settings for each database are as follows:

nameThe name used for the database via the dbconnect URL parameter.
typeThe type of database: CSV, DBASE and MYSQL are supported on Linux.
fileNameFor CSV and DBASE Only: Specifies the path to the database file.
serverFor MySQL Only: Specifies the server name or IP address of the MySQL server.
databaseFor MySQL Only: Specifies the database to connect to.
sqlFor MySQL Only: Query String to return the data, e.g. SELECT * FROM table.
uidFor MySQL Only: Provides username to connect to the MySQL instance with.
pwdFor MySQL Only: Provides password to connect to the MySQL instance with.
noHeadingsFor CSV Only: Set to 1 if the table has no field headings (field’s must be referred to by their column number in this case).
gridESpecifies the name of the Grid Easting file (or column number if numeric).
gridNSpecifies the name of the Grid Northing file (or column number if numeric).
oldGridsIf set to 1 specifies that grid fields contain 5 digit grids (as used by front-end and older databases).
listFieldsA comma separated list of database fields to output for the item when returning a Nearest record (or column numbers if numeric).
outputFieldsA comma separated list of database fields to return when standard fields are used (or column numbers if numeric).
updateFreqSpecifies the frequency in seconds to re-load  the database.  For example 300 would update the data every 5 minutes, 3600 would update it hourly.

Configuration Example

				
					<?xml version="1.0!?>
<NearestConfig>
    <updateFreq>5</updateFreq>
    <database>
        <name>Nandos</name>
        <type>ODBC</type>
        <server>*serverIP*</server>
    <database>DSN=Nandos;UID=*uid*;PWD=*password*</database>
    <sql>SELECT * FROM dbo.nandos</sql>
        <gridE>Grid_East</gridE>
        <gridN>Grid_North</gridN>
        <oldGrids>0</oldGrids>
        <listFields>Town</listFields>
        <outputFields>Postcode,Grid_East,Grid_North,Town</outputFields>
    </database>
</NearestConfig>
				
			

Phone Validation

Phone Result Codes

The below table describes the possible result codes and error messages when using the phone data product.

Result CodeDescription
1Live Number
-2Number not valid
-4Error contacting service
-7Data License Error

Live checks are performed on all UK Landline and Mobile numbers excluding 03 and 08 business numbers which are format verified. We live validate for a large number of international networks, where the live validation isn’t available for an international network we fall back to format verified.

Phone Example

https://api.afd.co.uk/v1/phone/GBR/full?serial=333333&password=pwd&fields=standard&phone=01624%20811711&format=json

				
					{
  Result: "1",
  ErrorText: ""
}
				
			

Email Validation

A simple mistake in typing an email address makes it impossible for an email to reach the right recipient.

Email Result Codes

Result code 1

Description
Format Verified
Domain and Format Verified
Format Verified, Unable to make DNS Request
Format Correct, Unable to Open Connection
Format Correct, Mail Server Refused Connection
Format Correct, Mail Server Timeout
Format Correct, Mail Server Refused Server
Format Correct, Mail Server Refused Sender
Format Correct, Mail Server Refused IP
Format Correct, Mail Server Temporarily Unavailable
Format Correct, Mail Server Invalid
Email Address Live Verified
Email Address Verified

Result Code -2

Description
Format Invalid
Unknown Top Level Domain
Domain-Specific Format Invalid
Invalid Email, Mail Server Not Found
Mail Server Rejected Email Address
Invalid Email Address. Contains whitespace.

Additional Functionality for Email

LocalChecked
Boolean value that indicates if the local part of the address has been checked (1) or not (0).

AcceptsAll
Boolean value that indicates if the actual address is verified if applicable (0) or if it accepts all emails (1).

FormatVerified
This helps add confidence for corporate email addresses where the server accepts all fields or refused the validation request. It attempts to verify if the format is in-line with those used.

ValueDescription
PresentThe email address is present on the website – therefore as good as a live validation. In this case, we will also update the other values to reflect this and give a full positive response.
FormatThe email address is in the format of those present on the website (e.g. if other emails are firstname.lastname@afd.co.uk this will return “true” for others in the same format).
FailThe email address differs from other formats found.
(blank)This field is blank if the check is unnecessary (e.g. full live verification occurred), or not possible (e.g. there is no website configured for the domain or none or too few email addresses found to verify).

Note: This is only done on email addresses that AcceptsAll=1.

Suggested
Regardless of if the email address validates this provides the suggested email address if it contains a misspelled domain name (for example gmai.com instead of gmail.com), or misformatted address, e.g. jon.@gmailcom becomes john@gmail.com

  • The data file will contain a list of known variants for large well-known domains such as gmail.com.
  • For other domains if the validation fails it will try possible single character variants to suggest an alternative and provides it if it passes validation itself.
  • If the domain is fine but the first part of the address fails and contains a possibly misspelled name it will try the corrected variant.
  • Additionally if it contains a duplicated character (e.g. two dots), or unexpected punctuation or characters it will try without those and substituting any obvious ones (e.g. characters above numbers).

Spelling
Boolean value that indicates if there is no spelling error detected (0) or if a spelling error is likely (1).

NonStandard
Boolean value that indicates if no non-standard characters are present (0) or if there are non-standard characters present in the email address (1).
Example email address: john!??{@afd.co.uk. This is a valid email address but would seem unusual.

Note: This is only for valid email addresses.

Reachable
Boolean value that indicates if the mail server is non-reachable (0) or if it is reachable (1).

Dummy
Boolean value that indicates if the address is not detected as a dummy address (0) or if it is likely to be a dummy/test email address (1).

Throwaway
These are known domains that allow accounts to be created that self-destruct after a certain time, intended for sign-ups, etc.
Boolean value that indicates if the address is not a known throwaway domain (0) or if it is (1).

Generic
Boolean value that indicates if the address is not a known generic email (0) or if it is (1).
Example email addresses: support@afd.co.ukaccounts@afd.co.uk, etc.

Validation Types

Full Example

task=full does full checks on the format of the email address, a DNS lookup for the MX record.

https://api.afd.co.uk/v1/email/GBR/full?serial=333333&password=pwd&fields=standard&email=support%40afd.co.uk&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Email: "support@afd.co.uk",
      Status: "Email Address Verified",
      LocalChecked: 0,
      AcceptsAll: 0,
      FormatVerified: "",
      Suggested: "",
      Spelling: 0,
      NonStandard: 0,
      Reachable: 0,
      Dummy: 0,
      Throwaway: 0,
      Generic: 1
    }
  ]
}
				
			

Live Example

Validate email format, top-level domain, and server response for the full email address (if enabled on the server) – task=live does the same as task=full but also does a live validation by connecting to the registered email server and testing to see if the email is accepted for that address, where the destination server allows that.

https://api.afd.co.uk/v1/email/GBR/live?serial=333333&password=pwd&fields=standard&email=support%40afd.co.uk&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Email: "support@afd.co.uk",
      Status: "Email Address Live Verified",
      LocalChecked: 1,
      AcceptsAll: 1,
      FormatVerified: "Present",
      Suggested: "",
      Spelling: 0,
      NonStandard: 0,
      Reachable: 1,
      Dummy: 0,
      Throwaway: 0,
      Generic: 1
    }
  ]
}
				
			

TLD Example

Validate email format is correct and the top-level domain exists.

https://api.afd.co.uk/v1/email/GBR/tld?serial=333333&password=pwd&fields=standard&email=support%40afd.co.uk&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Email: "support@afd.co.uk",
      Status: "Format Verified",
      LocalChecked: 0,
      AcceptsAll: 0,
      FormatVerified: "",
      Suggested: "",
      Spelling: 0,
      NonStandard: 0,
      Reachable: 0,
      Dummy: 0,
      Throwaway: 0,
      Generic: 1
    }
  ]
}
				
			

Format Example

Validates if the email address format is correct only.

https://api.afd.co.uk/v1/email/GBR/format?serial=333333&password=pwd&fields=standard&email=support%40afd.co.uk&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Email: "support@afd.co.uk",
      Status: "Format Verified",
      LocalChecked: 0,
      AcceptsAll: 0,
      FormatVerified: "",
      Suggested: "",
      Spelling: 0,
      NonStandard: 0,
      Reachable: 0,
      Dummy: 0,
      Throwaway: 0,
      Generic: 1
    }
  ]
}
				
			

Local Example

Validate email format, top-level domain and for well-known domains carry out additional checks of the local portion of the address.

https://api.afd.co.uk/v1/email/GBR/local?serial=333333&password=pwd&fields=standard&email=support%40afd.co.uk&format=json

				
					{
  Result: "1",
  ErrorText: "",
  Item: [
    {
      @value: "1",
      Email: "support@afd.co.uk",
      Status: "Domain and Format Verified",
      LocalChecked: 0,
      AcceptsAll: 0,
      FormatVerified: "",
      Suggested: "",
      Spelling: 0,
      NonStandard: 0,
      Reachable: 0,
      Dummy: 0,
      Throwaway: 0,
      Generic: 1
    }
  ]
}
				
			

Best Practice Guide

There is no one-size-fits-all approach for email validation as depending on the use of the data or the interface presented may impact decisions over design. This guide is designed to help outline best practices when using email validation.

For the vast majority of users, a simple valid or not is all that is required and if it is invalid, the user needs to check/re-enter it.

AFD only returns a -2 invalid response when we can guarantee an invalid address, any uncertainty is returned as valid. This uncertainty can be caused by a number of reasons such as temporarily being unable to connect to the server.

Depending on your individual needs you may wish to be stricter with what you do and don’t allow. In this case, we suggest that you base your validation rules not only on the Result but also on the Status. Anything more can over-complicate a system or interface.

In most cases, best practice with email validation on a website is to call the validation routines when a user enters an address. If it fails validation, then the user will be prompted to correct it. If not already doing so, it may be useful to prompt the user to double-check or re-enter the email address if the validation times out or live validation is not possible, so the address can be double checked. You may also like to reject or prompt if an address is indicated to be a dummy address (normally a test address rather than a genuine account).

If you wish to have direct contacts rather than generic addresses (e.g., not things like sales@, support@ etc.), you might want to request an alternative if that flag is set. However, outright rejection needs to be carefully considered as, for example, a small company may have that as their only business email and a single person is receiving those emails.

While systems do not always allow you to do so, it is useful to store if an email address has been fully live validated or not. This can then allow records to be manually reviewed later if feasible. For example, if an email address was not live validated or timed out, you know there is a higher chance it might be incorrect, and you might want to check it manually or if the customer calls in, etc.

Due to the complexities of email addresses, it must always be remembered that some (particularly personal email addresses) can be quite unusual but still be valid. Only if an email address is returned as invalid is it definitely invalid, and if it’s a live validation that can change at any point in time (e.g., email address is created, re-enabled, etc.).

Suggestions may want to be used to help the end user/operator see what the address might be intended to be if it fails validation or if the email address has been mistyped. However, it is important to check the suggestion with the user to ensure it is not being mis-corrected. Remember, suggestions are simply that – suggestions of what may be more likely, not corrections. The full status may be useful but depending on the level of understanding of the operator, a simple pass/failure/unable to live validate may be easier to work with.

Throwaways are temporary email addresses. If it’s for an email newsletter, then you may want to request a permanent address. However, if it’s for an online order you may decide to still accept it so you can get the order, even though you know the email address will cease to exist later – though you may want to insist on something permanent. In some systems, it may act more as a fraud flag – i.e., you don’t want to reject it at the point of entry, but you want to flag it (for example, applying for a loan with a throwaway email might be considered suspicious – perhaps the person is hoping to become un-contactable later etc.).

Please note that we do offer a service for batch email validation. If this is a service you would be interested in, please contact your AFD Account Manager who can provide details and further information.

Other Features

Determining the Product in Use

When integrating with Address Management products the same code will work with any of our Address Management products (AFD Postcode, AFD Postcode Plotter, AFD Postcode Plus and AFD Names & Numbers).

It is not normally necessary to determine which product has been used as you can integrate with one, e.g. Names & Numbers and the user can use any of our address management products – they will just have less data returned depending on the product they have. However, if for any reason, such as disabling/enabling features of your product – you can use the Product field if you wish to determine which product the user has and that has been used by the Service.

The Product field will contain one of the following values depending on the product being used:

  • AFD Postcode
  • AFD Postcode Plotter
  • AFD Postcode Plus
  • AFD Names & Numbers
  • AFD ZipAddress
  • AFD WorldAddress

Note that when carrying out a BankFinder operation AFD BankFinder will always be the product name returned.

DX Member Data

DX Members can have access to DX data from within Postcode Plus, Names & Numbers and the API. This enables you to lookup and search for DX addresses just as you can do with Royal Mail postal addresses. Uniquely, the API also allows you to easily identify DX addresses associated with a PAF address to route your mail through a DX member’s box wherever possible resulting in savings over Royal Mail.

Postcode Evolution will automatically return a DXNumber and DXExchange field in the XML if you have the DX data enabled.

Fast-find functionality works with DX data as well as postal data. For example, as well as looking up a postcode you can also carry out a fast-find for a DX number and searching for an organisaiton name with fast-find will search both postal and DX data. This allows you to easily combine your lookup’s. When searching you can either search the standard postal fields or specify the DX Number, organisation, exchange or profession to search theDX data instead. (If you only want to specify one set of search fields in your application then placing DX followed by the DX number in the normal street field will work too – town can then be used to specify the exchange if desired).

When results are returned following any lookup or search if the address is also a DX Member the DXNumberDXExchange and DXProfession fields will also be returned to indicate this. You can format a DX address as follows for printing:

LabelAddress
OrganisationGateley LLP
DXNumberDX 14317
DXExchangeMANCHESTER
DXProfessionSolicitor

International Data

Customers signed up to use our International data service can lookup and search for international addresses in exactly the same way as you do for UK based addresses. The only difference in normal operation is the need to specify the Country or CountryISO code (as parameters in the GET request) of the country that you wish to use in all lookup, search and record retrieval operations.

Making use of the data returned

If you have opted to use Standard, Raw PAF, or BS7666 fields the data will be returned in the same fields as those for the UK (including the county in some cases) which you can use to store the data in your database in the same format as you do for UK addresses.

However, when it comes to generating an address label, you should note that the formatting rules for addresses vary from country to country (for example in many Western European countries the post/zip code comes before the town on the same line). Unless you have your own printing or formatting routines for the country in question, you may therefore actually prefer to use our International address format which provides both the constituent address fields (broadly the same as Raw PAF fields but also adding the Principality, Region, and Cedex which is relevant to some international addresses) as well as address label formatted fields (address1 through to address7). This enables you to both have a structure ideal for data storage and for label formatting.

If you need to store addresses in a more UK based format, but then need to format them for printing you can easily do so by carrying out a search operation specifying the address data with the International field type to obtain the address for printing at the time that you wish to generate an address label.

Notes regarding International addressing

It is important to note that the standards regarding what is an acceptable address vary widely from country to country as do the levels of data that are available. For example, while one country may have full address data from Organisation down, another may only be at street or even locality level. So you must accommodate for different levels of data coming back and therefore differing amounts of manual entry which may be required by users of your software to provide a complete address.

mailLink mailLink

We are here to help

We serve thousands of organisations and a network of hundreds of partners across multiple industry sectors, enabling them to have full confidence in their contact data.