Find a company, telephone number and company details
Search the phone book and companies house data by business name and/or location to find a UK business, telephone number and company details.
This method gives users of your website, or staff accessing internal systems, the ability to find a company in the UK, their telephone number and other details. This can be especially useful for sales and marketing teams operating in Business to Business markets who wish to make contact with prospective customers.
With our data updated daily, you won’t find a more up-to-date source of UK company information available. Plus, with our ‘fuzzy matching’, the method will still return a result of the closest possible matches even if the company name is inaccurate or has been entered incorrectly.
API method to use: business_search
An additional amount of company information can also be obtained by combining this method with company_details.
How it works
The method searches the UK Phone Book and Companies House data to return a company or business and it’s listed telephone number, address and website. A result is achieved when the following data is supplied:
- Company Name
- City, town or postcode (optional location to narrow results)
- Business type (optional, can be combined with location if company name not known to find particular types of businesses in a certain area).
If an exact match to a company name cannot be found, our ‘Fuzzy-matching’ will return a set of closest matches to the details entered.
All the mandatory and optional parameters, together with returned values, can be found in the Documentation section.
Search the phone book and companies house for a business.
Updated daily, you won't find a more up to date source of company/business information.
We employ a method of 'fuzzy-matching' when performing searches, meaning that even if a name or address is inaccurate or entered incorrectly, we will search the closest possible matches. If there is information on a company/business available, we'll find it.
Most limited and non-limited companies return a company number/ID which can be used with the company_details method to obtain full information on that organisation.
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. |
name or company_number |
You must specify the business name or a company number. |
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. |
use_non_company | Set to false to NOT search phone book data. Defaults to true. |
use_company | Set to false to NOT search company data. Defaults to true. |
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. |
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 building number or name. |
max_records |
The maximum number of records to be returned. The default value is 200. The absolute maximum number of records allowed is 10,000. |
fuzzy |
Defaults to true. Set to true to enable fuzzy matching. |
records_per_page |
The number of records returned on the current page. Defaults to 200. Set to a factor of 200, such as 10,20 or 25 to return the <person> records in smaller chunks. Each block of 200 records is chargeable, so, for example, if your search returns 250 records, and your records_per_page is 25, pages 0-7 (parameter page_num, is zero-based) are already paid for, but if the 9th page of results is viewed, a credit value is debited. |
Returned Values
The XML response is contained within a <business_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. |
business_list |
An array of business records. |
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. |
total_records |
The total number of records, irrespective of the number displayed on any page. This is only used when a |
page_number |
Current page being displayed, a zero-based integer. This is only used when a |
The values in the <business>
element.
Name |
Type |
Description |
---|---|---|
line_1 |
string |
Address line 1 |
line_2 |
string |
Address line 2 |
line_3 |
string |
Address line 3 |
place |
string |
The place. If the address is in a named area within a large town, this will be that area, otherwise it will be the town. place is never empty if town is set. |
town |
string |
The town; only used if the address is in a named area within that town. |
postcode |
string |
The UK postal code, formatted to include the space. |
addr_single_line |
string |
The address, formatted as a single line. Commas are inserted between the major elements, and the postcode is included, if available. |
name |
string |
The business name |
telephone_number |
string |
Telephone number |
web |
string |
The company website domain |
previous_name |
string |
Previously known as |
company_number |
string |
The Companies House number |
classification |
string |
The company’s classification |
Error Codes
Name |
Description |
---|---|
missing_name |
A business name, class code or company number MUST be supplied. |
See the common error codes.
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, aplace_list
is returned. - If not, a dummy
business_list
is returned.
Example XML Response
<business_search_res> <mode>test</mode> <status>ok</status> <credit_used>0</credit_used> <t2a_version_number>3.3.8.0</t2a_version_number> <business_list> <business> <line_1>The IT Centre</line_1> <line_2>York Science Park</line_2> <line_3>Innovation Way</line_3> <place>Heslington</place> <town>York</town> <postcode>YO10 5NP</postcode> <addr_single_line> The IT Centre, York Science Park, Innovation Way, Heslington, York, YO10 5NP </addr_single_line> <name>Simunix Ltd</name> <telephone_number>(01904) 217765</telephone_number> <web>simunix.com</web> <classification>Business and domestic software development</classification> <previous_name>ukphonebook Ltd</previous_name> <company_number>03684982</company_number> </business> </business_list> </business_search_res>
Method Limits
- The default max_records value is to 200
- The max_records parameter may be set to up to 10,000. Each block of 200 records is chargeable.
Result Caching
When a chargeable result is found (a list of businesses) , the list is cached on our server for 60 minutes. If the successful search is repeated during that time, the list is displayed, but there is no charge.
Charging Policy
The method only charges when a valid name etc has been supplied.
A credit charge is then levied for every new consecutive block of 200 records viewed.
The following events are not chargeable for this method
- Invalid place
- Invalid input
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="business-search-example"> <form class="business-search-form"> <div class="form-group"> <label for="surname">Business Name</label> <input type="text" class="form-control" id="name" placeholder="Business Name e.g Simunix"> </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>
.business-search-example, .results { margin: 20px auto; width: 400px; } form.business-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(){ $(".business-search-form").submit(function(e) { e.preventDefault(); $('.error', $(this)).remove(); var name = $("#name"); if(!name.val()) { errorBefore("Please enter a business 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' : "business_search", 'api_key' : 'sandbox', '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.business_list !== "undefined") { result.business_list.forEach(function(business_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 business_list_item) { if(!key.includes('id') && !exceptionsArray.includes(key) ) { var keyName = key.replace('_', ' '); $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + business_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++; }); } } $('.business-search-example').hide(); $('.results').show(); } }); } }); $('.results-return').on('click', function(e){ e.preventDefault(); $('#results-output').empty(); $('.business-search-example').show(); $('.results').hide(); }); }); function errorBefore(msg, insertBefore) { $('<p class="error">' + msg + '</p>').insertBefore(insertBefore); }
Javascript key
<div class="business-search-example"> <form class="business-search-form"> <div class="form-group"> <label for="surname">Business Name</label> <input type="text" class="form-control" id="name" placeholder="Business Name e.g Simunix"> </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>
.business-search-example, .results { margin: 20px auto; width: 400px; } form.business-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(){ $(".business-search-form").submit(function(e) { e.preventDefault(); $('.error', $(this)).remove(); var name = $("#name"); if(!name.val()) { errorBefore("Please enter a business 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' : "business_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.business_list !== "undefined") { result.business_list.forEach(function(business_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 business_list_item) { if(!key.includes('id') && !exceptionsArray.includes(key) ) { var keyName = key.replace('_', ' '); $('#results-output').append('<p class="output"><span>' + keyName + ':</span> ' + business_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++; }); } } $('.business-search-example').hide(); $('.results').show(); } }); } } }); } }); $('.results-return').on('click', function(e){ e.preventDefault(); $('#results-output').empty(); $('.business-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; }