Search For a Person

Search the edited electoral register, the phone book, companies house data and consumer data for a person


The majority of websites, apps and CRM systems use name and address data. It’s vital that this data is as accurate as possible for many reasons such as speeding up the user journey and validating purchases.

Our API method searches for a UK person across the edited UK electoral roll, phone book data, companies house and consumer data.

How it works

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

  • a name and/or address
  • a partial name and/or address

Supplying an address only will return all occupants at that address. Additional optional parameters can also be supplied to the method such as age and gender.

Please see the Documentation section for more detailed information on all mandatory and optional parameters, as well as a list of all returned values.

Next Steps…

We will give you a unique API key to allow you to test the method using credits on your T2A account. The Demo tab will allow you to test the parameters required and view the result.

If you do not have an account you will first need to sign up

 

Let's get started

 

 

Other related API methods:

See who lives at an address
Search the Electoral Roll (edited version)
Search for a company director
Check if a person is deceased
Age Verification - check if a person is 18 or over
Person Verification – check someone exists

API method to use: person_search
|
Credits per use: 10

Searches the edited electoral register, phone book, companies house and consumer data for a UK resident.

Enter a name and/or address, or a partial name and/or address to find all UK residents matching your search criteria.

Mandatory Parameters


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

Optional Parameters


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

The person's name, for example:-

Mr John D Fawcett
J Fawcett
Fawcett
Fawcett, John

Do not specify this if you wish to do an address-only search.

T2A will parse the name into the relevant components.

name2

The name of a 2nd resident

The person_search method allows you to search for records where name and name2 are found at the same address.

T2A will parse the name into the relevant components.

forename

The person's forename, for example:-
John, J or Janet

To make the person_search more flexible we allow you to input the components of a name (forename, middleinitial and lastname) separately. Do not use these distinct parameters if you have specfied a name.

middleinitial

The person's middle initial, this will filter out any records which do not have this middle initial. Please note some data sources may not record the person's middle initial.

To make the person_search more flexible we allow you to input the components of a name (forename, middleinitial and lastname) separately. Do not use these distinct parameters if you have specfied a name.

lastname

The person's lastname, for example:-
Smith

To make the person_search more flexible we allow you to input the components of a name (forename, middleinitial and lastname) separately. Do not use these distinct parameters if you have specfied a name.

forename2

The forename of a second resident, the person_search method allows you to search for records where two names are found at the same address.

middleinitial2

The middleinitial of a second resident, the person_search method allows you to search for records where two names are found at the same address.

lastname2

The lastname of a second resident, the person_search method allows you to search for records where two names are found at the same address.

place Enter a UK place, postcode, or postcode area. Do not specify this to do a national UK search.
street The street name.
premises The house number or name.
sex

Set to m or f to specify the gender to be returned, where that gender is known.

This parameter is only applicable to electoral roll data; any results from other data sources are not filtered by this parameter.

dob_y

Enter a year element for a date of birth in the format yyyy to filter records by age

dob_m

Enter a month element for a date of birth in the format mm to filter records by age. Range of values is: 01 - 12

dob_d

Enter a day element for a date of birth in the format dd to filter records by age. Range of values: 01 - 31

min_age

Enter a minimum age to filter records by

max_age

Enter a maximum age to filter records by

use_er Set to false to NOT search the electoral register. Defaults to true.
use_osis Set to false to NOT search the phone book. Defaults to true.
use_director Set to false to NOT search for directors using Companies House. Defaults to true.
fuzzy Defaults to true. Set to false to disable fuzzy matching.

Returned Values


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

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

An array of person records.

Only one of the lists is present :-

  • If a place_list is returned, the place name is ambiguous, and the final user should be given a selection from the list.
  • If a street_list is returned, the street specified is ambiguous, and the final user should be given a selection from the list.
  • If a person_list is returned, the search has returned a list of people.
place_list An array of place records. This is present if the place name is ambiguous. No charge is made when a place_list is retuned.
street_list An array of street records. This is present if the street name is ambiguous. No charge is made when a street_list is returned.
premises_list

This is seen if the premises parameter is ambiguous or not specified; it is a free list of addresses at which there is data about the resident(s), and can be used to allow the end user to select the household to be viewed.

Use the name value from the selected premises to replace the premises input parameter value when re-invoking this method.

No charge is made when a premises_list is returned.

total_records

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

This is only used when a person_list is present.

page_number

Current page being displayed, a zero-based integer.

This is only used when a person_list is present.

er_searched Set to true if the electoral roll data was searched.
telephone_data_searched

Set to true if the telephone data was searched. Note that licensing restrictions prevent telephone data being searched if:-

  • No surname is supplied
  • No place is supplied
  • The surname is less than 3 characters long.

Error Codes


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

Free Test Mode


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

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

The free test mode for this method operates in the following manner:-

  • If the place parameter is set to leeds, a place_list is returned.
  • If the surname and place are both empty, a dummy street_list is returned.
  • If the surname is set (to anything) a dummy person_list is returned.

Example XML Response



<?xml version="1.0"?>
<people_search_res>
  <mode>test</mode>
  <t2a_version_number>1.0.0</t2a_version_number>
  <status>ok</status>
  <credit_used>0</credit_used>
  <person_list>
    <person>
      <line_1>17</line_1>
      <line_2>Imagination Gardens</line_2>
      <line_3>Virtual Road</line_3>
      <place>Heslington</place>
      <town>York</town>
      <postcode>YO91 3X0</postcode>
      <addr_single_line>17 Imagination Gardens, Virtual Road, Heslington, York, YO91 3X0</addr_single_line>
      <title>Mr</title>
      <forename>Alan</forename>
      <surname>Fiction</surname>
      <name_single_line>Mr Alan Fiction</name_single_line>
      <telephone_number>(01904) 000000</telephone_number>
      <years_list>
        <string>2009</string>
        <string>2010</string>
        <string>2011</string>
      </years_list>
	  <mobile></mobile>
	  <dob>1974-12-01</dob>
	  <email_address>alan.fiction@gmail.com</email_address>
    </person>
    <person>
      <line_1>17</line_1>
      <line_2>Imagination Gardens</line_2>
      <line_3>Virtual Road</line_3>
      <place>Heslington</place>
      <town>York</town>
      <postcode>YO91 3X0</postcode>
      <addr_single_line>17 Imagination Gardens, Virtual Road, Heslington, York, YO91 3X0</addr_single_line>
      <title>Mrs</title>
      <forename>Anne</forename>
      <middle_initial>J</middle_initial>
      <name_single_line>Mrs Anne J</name_single_line>
      <telephone_number>(01904) 000000</telephone_number>
      <years_list>
        <string>2009</string>
        <string>2010</string>
        <string>2011</string>
      </years_list>
	  <mobile></mobile>
	  <dob>1980-06-08</dob>
	  <email_address>anne.j@gmail.com</email_address>	  
    </person>
  </person_list>
  <er_searched>true</er_searched>
  <telephone_data_searched>true</telephone_data_searched>
</people_search_res>

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.

Note: examples below show a restricted result set with a maximum of 3 results per search

API key


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

    <div class="form-group">
          <label for="surname">Person's Name</label>
          <input type="text" class="form-control" id="name" placeholder="Person's name e.g John Fawcett">
      </div>

    <div class="form-group">
          <label for="surname">Place</label>
          <input type="text" class="form-control" id="place" placeholder="Place, postcode or postcode area">
      </div>

    <div class="form-group">
          <label for="surname">Street</label>
          <input type="text" class="form-control" id="street" placeholder="Street name">
      </div>

    <div class="form-group">
          <label for="surname">Premises</label>
          <input type="text" class="form-control" id="premises" placeholder="Building name or number">
      </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>
                
.person-search-example, .results {
  margin: 20px auto;
  width: 400px;
}

form.person-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(){ 	
    $(".person-search-form").submit(function(e) {
        e.preventDefault();	

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

        var name = $("#name");        var place = $("#place");        var street = $("#street");        var premises = $("#premises");        if($('.error', $(this)).length) {	
            $('.error', $(this)).first().next('input').focus();
        } else {
    
            $.ajax({
                url: 'https://api.t2a.io/rest/rest.aspx',
                dataType: 'json',
                data: {
                    'method'   : "person_search",
                    'api_key'  : '-o-0adCG4Rph7zkcdYlTtTmyQ48L0YA9sv2qVJErVt_B',
                    'name' : name.val(),
                    'place' : place.val(),
                    'street' : street.val(),
                    'premises' : premises.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.person_list !== "undefined") {
                            result.person_list.forEach(function(person_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 person_list_item) {
                                    if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                        var keyName = key.replace('_', ' ');
                                        $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + person_list_item[key] + '</p>');
                                    }
                                }
                                i++;
                            });
                        }
                        var i = 0;
                        if(typeof result.place_list !== "undefined") {
                            result.place_list.forEach(function(place_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 place_list_item) {
                                    if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                        var keyName = key.replace('_', ' ');
                                        $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + place_list_item[key] + '</p>');
                                    }
                                }
                                i++;
                            });
                        }
                    }
                    $('.person-search-example').hide();
                    $('.results').show(); 
               }
            });
        }
    });
    
    $('.results-return').on('click', function(e){
        e.preventDefault();
        $('#results-output').empty();
        
        $('.person-search-example').show();
        $('.results').hide();
    });
});

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

Javascript key


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

    <div class="form-group">
          <label for="surname">Person's Name</label>
          <input type="text" class="form-control" id="name" placeholder="Person's name e.g John Fawcett">
      </div>

    <div class="form-group">
          <label for="surname">Place</label>
          <input type="text" class="form-control" id="place" placeholder="Place, postcode or postcode area">
      </div>

    <div class="form-group">
          <label for="surname">Street</label>
          <input type="text" class="form-control" id="street" placeholder="Street name">
      </div>

    <div class="form-group">
          <label for="surname">Premises</label>
          <input type="text" class="form-control" id="premises" placeholder="Building name or number">
      </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>
                
.person-search-example, .results {
  margin: 20px auto;
  width: 400px;
}

form.person-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(){ 	
    $(".person-search-form").submit(function(e) {
        e.preventDefault();	

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

        var name = $("#name");        var place = $("#place");        var street = $("#street");        var premises = $("#premises");        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'   : "person_search",
                                'javascript_key'  : result.javascript_key,
                                'domain' : "t2a.io", 
                                'name' : name.val(),
                                'place' : place.val(),
                                'street' : street.val(),
                                'premises' : premises.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.person_list !== "undefined") {
                                result.person_list.forEach(function(person_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 person_list_item) {
                                        if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                            var keyName = key.replace('_', ' ');
                                            $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + person_list_item[key] + '</p>');
                                        }
                                    }
                                    i++;
                                });
                            }
                            var i = 0;
                            if(typeof result.place_list !== "undefined") {
                                result.place_list.forEach(function(place_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 place_list_item) {
                                        if(!key.includes('id') && !exceptionsArray.includes(key) ) {
                                            var keyName = key.replace('_', ' ');
                                            $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + place_list_item[key] + '</p>');
                                        }
                                    }
                                    i++;
                                });
                            }
                       }
                                $('.person-search-example').hide();
                                $('.results').show(); 
                            }
                        });
                    }
                }
            });
        }
    });
    
    $('.results-return').on('click', function(e){
        e.preventDefault();
        $('#results-output').empty();
        
        $('.person-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=-o-0adCG4Rph7zkcdYlTtTmyQ48L0YA9sv2qVJErVt_B" .
            . "&domain=" . $_SERVER['HTTP_HOST'];
            . '&ip_address=' . $_SERVER['REMOTE_ADDR']
            . "&lifetime_minutes=10";

        $result = simplexml_load_file($url);

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