0151 355 4555



Checks if a postcode is syntactically valid, and returns the same postcode in a standard format suitable for printing as part of an address.

This method does not check whether an address actually exists at the postcode, only that the postcode is of the correct format.

If the postcode has a correct format, the IsValid part of the result is set to true and the Formatted part of the result is set to the same postcode in a standard format, e.g. "ch24ne" is converted to "CH2 4NE".

If the postcode does not have a correct format, the IsValid part of the result is set to false and the Formatted part of the result will not be specified.

View all Address validation methods

Code Samples

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="https://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">

<script type="text/javascript">

function loadIntegr8() {
  // Load the AddressCapture Integr8 service

function ValidatePostcode(licence, postcode) {
  /// <param name="licence">string. One of the following values: WebServerFull, WebClickFull, WebClickThoroughfare, InternalUserFull, InternalUserThoroughfare, SmallUserFull, SmallUserThoroughfare, Lookup, InternalServerFull, InternalServerThoroughfare, FreeTrial, FreeTrialThoroughfare, InternalUserFullArea, InternalUserThoroughfareArea, WebServerThoroughfare</param>
  /// <param name="postcode">string</param>
  var addresscapture = new data8.addresscapture();

function showValidatePostcodeResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.IsValid
    //   Indicates if the postcode is valid or not.
    // result.Formatted
    //   Contains a correctly formatted version of the supplied postcode.