Search For an Address or Postcode

Use our data to find a UK address from a postcode or vice versa


Our data is the most up-to-date source of address information you will find in the UK.

Having accurate up-to-date address and postcode data is vital for all CRM systems, and any websites and apps that require customers to create an account using their name and address.

You can use our data to facilitate the process of completing address details on customer signup/enquiry forms, making it quicker and easy for the customer, but also ensuring the information you receive is accurate, up-to-date and complete.

As a data cleansing tool our service can be used to ensure full and accurate data within CRM systems for marketing campaigns. Old addresses can be updated and incomplete addresses improved, that may be missing postcodes for example.

API method to use: address_search

How it works

We can identify a full and accurate address from a partial address and/or postcode. All you need to do is submit the information you have and or API method will complete and update.

The method returns a list of UK addresses and postcodes that match your search criteria, when the following data is supplied:

  • a partial address (when conducting a postcode search)
  • a postcode, plus optional Building name/number (when conducting an address search)

More details on mandatory and optional parameters, plus a list of returned values can be found in the Description section.

We will give you a unique API key to allow you to test the method using credits on your T2A account. If you do not have an account you will first need to sign up.

 

Get in touch

There are two ways to authenticate your application with the T2A API. The two implementation examples on this page cover each type of authentication

We recommend using an API key for internal applications and the javascript key for public facing applications where you would want to protect your API key.

Please note: The examples below run on a sandbox environment which return sample data. To quality check the data we provide, up to 3 free searches are available in the demo tab with results showing live [REDACTED] data.

API key


<div class="address-search-example">
  <form class="address-search-form">

    <div class="form-group">
          <label for="surname">Address</label>
          <input type="text" class="form-control" id="address" placeholder="Building name or number">
      </div>

    <div class="form-group">
          <label for="surname">Postcode</label>
          <input type="text" class="form-control" id="postcode" placeholder="Postcode">
      </div>

    <button type="submit" class="btn example-submit">Submit</button>
  </form>
</div>

<div class="results">
  <div id="results-output"></div>
  <a class="results-return" href="#">Back to search</a>
</div>
                
.address-search-example, .results {
  margin: 20px auto;
  width: 400px;
}

form.address-search-form, .results {
    background-color: #F6F6F6;
    border: 1px solid #CBCBCB;
    padding: 15px;
}

.example-submit {
    background-color: #F0614C;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 400;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.193em;
    width: 138px;
    height: 41px;
    margin-top: 10px;
}

.results {
  display: none;
}

.results-return {
    font-weight: 600;
    color: #F0614C;
}

#results-output span {
    font-weight: bold;
    text-transform: capitalize;
}

#results-output hr {
    border-top: 1px solid #000;
}

.error {
  font-size: 11px;
  color: #f00;
}
                
$(document).ready(function(){ 	
    $(".address-search-form").submit(function(e) {
        e.preventDefault();	

        $('.error', $(this)).remove();

        var address = $("#address");        var postcode = $("#postcode");        if($('.error', $(this)).length) {	
            $('.error', $(this)).first().next('input').focus();
        } else {
    
            $.ajax({
                url: 'https://api.t2a.io/rest/rest.aspx',
                dataType: 'json',
                data: {
                    'method'   : "address_search",
                    'api_key'  : 'sandbox',
                    'address' : address.val(),
                    'postcode' : postcode.val(),
                    'output'   : 'json'
                    },
                success: function(result){
                    if(result.status == "error") {
                        $('#results-output').append('<p class="output"><strong>Error:</strong>' + result.error_code +'</p>');
                    } else {
                        var i = 0;
                        if(typeof result.address_list !== "undefined") {
                            result.address_list.forEach(function(address_list_item){
                                if(i>0){
                                    $('#results-output').append('<hr>');
                                }
                                var exceptionsArray = ['META', 'created_details', 'years_list', 'address_key', 'organisation_key', 'dob_details'];
                                    
                                for (var key in address_list_item) {
                                    if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                        var keyName = key.replace('_', ' ');
                                        $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + address_list_item[key] + '</p>');
                                    }
                                }
                                i++;
                            });
                        }
                    }
                    $('.address-search-example').hide();
                    $('.results').show(); 
               }
            });
        }
    });
    
    $('.results-return').on('click', function(e){
        e.preventDefault();
        $('#results-output').empty();
        
        $('.address-search-example').show();
        $('.results').hide();
    });
});

function errorBefore(msg, insertBefore) {
    $('<p class="error">' + msg + '</p>').insertBefore(insertBefore);
}

Javascript key


<div class="address-search-example">
  <form class="address-search-form">

    <div class="form-group">
          <label for="surname">Address</label>
          <input type="text" class="form-control" id="address" placeholder="Building name or number">
      </div>

    <div class="form-group">
          <label for="surname">Postcode</label>
          <input type="text" class="form-control" id="postcode" placeholder="Postcode">
      </div>

    <button type="submit" class="btn example-submit">Submit</button>
  </form>
</div>

<div class="results">
  <div id="results-output"></div>
  <a class="results-return" href="#">Back to search</a>
</div>
                
.address-search-example, .results {
  margin: 20px auto;
  width: 400px;
}

form.address-search-form, .results {
    background-color: #F6F6F6;
    border: 1px solid #CBCBCB;
    padding: 15px;
}

.example-submit {
    background-color: #F0614C;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 400;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.193em;
    width: 138px;
    height: 41px;
    margin-top: 10px;
}

.results {
  display: none;
}

.results-return {
    font-weight: 600;
    color: #F0614C;
}

#results-output span {
    font-weight: bold;
    text-transform: capitalize;
}

#results-output hr {
    border-top: 1px solid #000;
}

.error {
  font-size: 11px;
  color: #f00;
}
                
$(document).ready(function(){ 	
    $(".address-search-form").submit(function(e) {
        e.preventDefault();	

        $('.error', $(this)).remove();

        var address = $("#address");        var postcode = $("#postcode");        if($('.error', $(this)).length) {	
            $('.error', $(this)).first().next('input').focus();
        } else {
            $.ajax({
                url: 'https://t2a.io/ajax/getExampleJSKey',
                dataType: 'json',
                success: function (result) {       
                        
                    if (result.status)
                    {       
                        $.ajax({
                            url: 'https://api.t2a.io/rest/rest.aspx',
                            dataType: 'json',
                            data: {
                                'method'   : "address_search",
                                'javascript_key'  : result.javascript_key,
                                'domain' : "t2a.io", 
                                'address' : address.val(),
                                'postcode' : postcode.val(),
                                'output'   : 'json'
                            },
                            success: function(result){
                        if(result.status == "error") {
                            $('#results-output').append('<p class="output"><strong>Error:</strong>' + result.error_code +'</p>');
                        } else {
                            var i = 0;
                            if(typeof result.address_list !== "undefined") {
                                result.address_list.forEach(function(address_list_item){
                                    if(i>0){
                                        $('#results-output').append('<hr>');
                                    }
                                    
                                    var exceptionsArray = ['META', 'created_details', 'years_list', 'address_key', 'organisation_key', 'dob_details'];
                                    
                                    for (var key in address_list_item) {
                                        if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                            var keyName = key.replace('_', ' ');
                                            $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + address_list_item[key] + '</p>');
                                        }
                                    }
                                    i++;
                                });
                            }
                       }
                                $('.address-search-example').hide();
                                $('.results').show(); 
                            }
                        });
                    }
                }
            });
        }
    });
    
    $('.results-return').on('click', function(e){
        e.preventDefault();
        $('#results-output').empty();
        
        $('.address-search-example').show();
        $('.results').hide();
    });
});

function errorBefore(msg, insertBefore) {
    $('<p class="error">' + msg + '</p>').insertBefore(insertBefore);
}

This example first needs to call to a file on your server, which will provide the user with an API key from your javascript key.

In our example above we have used a PHP file located at ajax/getExampleJSKey which looks like the example below

    <?php

        $url = 'https://api.t2a.io/rest/rest.aspx'
            . "?method=javascript_key"
            . "&api_key=sandbox" .
            . "&domain=" . $_SERVER['HTTP_HOST'];
            . '&ip_address=' . get_user_ip()
            . "&lifetime_minutes=10";

        $result = simplexml_load_file($url);

        if ($result->javascript_key) {
            echo (string)$result->javascript_key;
        }

Next Steps...


We will give you a unique API key to allow you to test the method using credits on your T2A account. If you do not have an account you will first need to sign up.

 

Get in touch