UK Bank Account Checker XML API

The API returns a validation code, a validation description and account properties in XML format for the bank account and sort code provided as input.

Usage
Simply perform a GET call using this url with the API parameters described below:
https://tls.bankaccountchecker.com/listener.php?key=<your_api_key>&password=<your_password>&output=xml&type=uk_bankaccount&sortcode=123456&bankaccount=12345678
If you don't have an API key yet, just follow this link to register your free API key.

API parameters
Parameter Required Default Value
key Yes N/At API key provided with your account. Alternatively, use the 'guest' key but you will be restricted by the number of call per 24 hours.
password Yes N/A Password associated with the API key.
output No json json, xml
type Yes N/A uk or uk_bankaccount
sortcode Yes N/A The Sort Code you want to check.
bankaccount Yes N/A The Bank Account you want to check.
Output
This is a sample of the output you will get in XML:
<?xml version="1.0"?>
<bankaccountchecker>
    <resultCode>01</resultCode>
    <resultDescription>Sortcode and Bank Account are valid</resultDescription>
    <accountProperties>
        <institution>BANK OF ENGLAND</institution>
        <branch>LONDON</branch>
        <fast_payment>true</fast_payment>
        <bacs_credit>false</bacs_credit>
        <bacs_direct_debit>true</bacs_direct_debit>
        <chaps>true</chaps>
        <cheque>true</cheque>
    </accountProperties>
</bankaccountchecker>
This is a another sample of the output you will get in XML with the optional Branch Properties set on your account. This is a new functionality requiring further setup and come at an additional cost:
<?xml version="1.0"?>
<bankaccountchecker>
    <resultCode>01</resultCode>
    <resultDescription>Sortcode and Bank Account are valid</resultDescription>
    <accountProperties>
        <institution>BANK OF ENGLAND</institution>
        <branch>LONDON</branch>
        <fast_payment>true</fast_payment>
        <bacs_credit>false</bacs_credit>
        <bacs_direct_debit>true</bacs_direct_debit>
        <chaps>true</chaps>
        <cheque>true</cheque>
    </accountProperties>
    <branchProperties>
        <address>National Counties Hse, Church St, Epsom, KT17 4NL, Surrey</address>
        <address_line1>National Counties Hse</address_line1>
        <address_line2>Church St</address_line2>
        <address_line3>Epsom</address_line3>
        <address_line4>KT17 4NL</address_line4>
        <address_line5>Surrey</address_line5>
        <address_line6></address_line6>
        <address_line7/>
        <city>Epsom</city>
        <country>England</country>
        <postcode>KT17 4NL</postcode>
        <latitude>51.329986044209100</latitude>
        <longitude>-0.259857286548163</longitude>
        <phone>01372742211</phone>
    </branchProperties>
</bankaccountchecker>
Why do I need to register?

We are always trying to improve on our services and to do so we need to be able to tell who is querying what data and how often. This will enable us to fully optimize our limited resources to providing a more stable and reliable service to our users.

What is this API key and do I need it?

This API key is just a random string of characters which uniquely identifies each user. This is how we can track your usage and we perform security validation.

How do I get this API key?

This API key is free for everyone. You just have to go to here to register and a unique API key will be sent to your email address.

Php example
In this example, we are running the full test case suite using different type of call (POST and GET). You can download this PHP version of the script as well from our download page.
<?php
 
// Define end point URL
$url     = "https://tls.bankaccountchecker.com/";
$service = "listener.php";
 
// Define parameters for all tests
$key         = "apiTest";
$password    = "apiTest";
$output      = "xml";
$type        = "uk_bankaccount";
 
// Start callAPI
callAPI("1","Pass modulus 10 check.","01",$key,$password,$output,"uk","089999","66374958");
callAPI("2","Pass modulus 11 check.","01",$key,$password,$output,"uk","107999","88837491");
callAPI("3","Pass modulus 11 and double alternate checks.","01",$key,$password,$output,"uk","202959","63748472");
callAPI("4","Exception 10 & 11 where first check passes and second check fails.","01",$key,$password,$output,"uk","871427","46238510");
callAPI("5","Exception 10 & 11 where first check fails and second check passes.","01",$key,$password,$output,"uk","872427","46238510");
callAPI("6","Exception 10 where in the account number ab=09 and the g=9. The first check passes and second check fails.","01",$key,$password,$output,"uk","871427","09123496");
callAPI("7","Exception 10 where in the account number ab=99 and the g=9. The first check passes and the second check fails.","01",$key,$password,$output,"uk","871427","99123496");
callAPI("8","Exception 3, and the sorting code is the start of a range. As c=6 the second check should be ignored.","01",$key,$password,$output,"uk","820000","73688637");
callAPI("9","Exception 3, and the sorting code is the end of a range. As c=9 the second check should be ignored.","01",$key,$password,$output,"uk","827999","73988638");
callAPI("10","Exception 3. As c6 or 9 perform both checks pass.","01",$key,$password,$output,"uk","827101","28748352");
callAPI("11","Exception 4 where the remainder is equal to the checkdigit.","01",$key,$password,$output,"uk","134020","63849203");
callAPI("12","Exception 1 – ensures that 27 has been added to the accumulated total and passes double alternate modulus check.","01",$key,$password,$output,"uk","118765","64371389");
callAPI("13","Exception 6 where the account fails standard check but is a foreign currency account.","01",$key,$password,$output,"uk","200915","41011166");
callAPI("14","Exception 5 where the check passes.","01",$key,$password,$output,"uk","938611","07806039");
callAPI("15","Exception 5 where the check passes with substitution.","01",$key,$password,$output,"uk","938600","42368003");
callAPI("16","Exception 5 where both checks produce a remainder of 0 and pass.","01",$key,$password,$output,"uk","938063","55065200");
callAPI("17","Exception 7 where passes but would fail the standard check.","01",$key,$password,$output,"uk","772798","99345694");
callAPI("18","Exception 8 where the check passes.","01",$key,$password,$output,"uk","086090","06774744");
callAPI("19","Exception 2 & 9 where the first check passes and second check fails.","01",$key,$password,$output,"uk","309070","02355688");
callAPI("20","Exception 2 & 9 where the first check fails and second check passes with substitution.","01",$key,$password,$output,"uk","309070","12345668");
callAPI("21","Exception 2 & 9 where a?0 and g?9 and passes.","01",$key,$password,$output,"uk","309070","12345677");
callAPI("22","Exception 2 & 9 where a?0 and g=9 and passes.","01",$key,$password,$output,"uk","309070","99345694");
callAPI("23","Exception 5 where the first checkdigit is correct and the second incorrect.","02",$key,$password,$output,"uk","938063","15764273");
callAPI("24","Exception 5 where the first checkdigit is incorrect and the second correct.","02",$key,$password,$output,"uk","938063","15764264");
callAPI("25","Exception 5 where the first checkdigit is incorrect with a remainder of 1.","02",$key,$password,$output,"uk","938063","15763217");
callAPI("26","Exception 1 where it fails double alternate check.","02",$key,$password,$output,"uk","118765","64371388");
callAPI("27","Pass modulus 11 check and fail double alternate check.","02",$key,$password,$output,"uk","203099","66831036");
callAPI("28","Fail modulus 11 check and pass double alternate check.","02",$key,$password,$output,"uk","203099","58716970");
callAPI("29","Fail modulus 10 check.","02",$key,$password,$output,"uk","089999","66374959");
callAPI("30","Fail modulus 11 check.","02",$key,$password,$output,"uk","107999","88837493");
callAPI("31","Exception 12/13 where passes modulus 11 check (in this example, modulus 10 check fails, however, there is no need for it to be performed as the first check passed).","01",$key,$password,$output,"uk","074456","12345112");
callAPI("32","Exception 12/13 where passes the modulus 11check (in this example, modulus 10 check passes as well, however, there is no need for it to be performed as the first check passed).","01",$key,$password,$output,"uk","070116","34012583");
callAPI("33","Exception 12/13 where fails the modulus 11 check, but passes the modulus 10 check.","01",$key,$password,$output,"uk","074456","11104102");
callAPI("34","Exception 14 where the first check fails and the second check passes.","01",$key,$password,$output,"uk","180002","00000190");
 
// End callAPI
 
function callAPI($testId,$testDescription,$expectedResult,$key,$password,$output,$type,$sortcode,$bankaccount) {
 
global $url,$service;
 
// Output Test details
echo "====================================================================\r\n";
echo "Test ID : $testId\r\n";
echo "Sort code : $sortcode\r\n";
echo "Bank account : $bankaccount\r\n";
echo "Test Description : $testDescription\r\n";
echo "Expected Result : $expectedResult\r\n\r\n";
 
// Call with Post with url encoded string post parameters
$ch = curl_init() ;
curl_setopt($ch, CURLOPT_URL,$url . $service);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "key=$key&password=$password&output=$output&type=$type&sortcode=$sortcode&bankaccount=$bankaccount");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
$result = curl_exec($ch);
 
if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch) . "\r\n";
    $info = curl_getinfo($ch);
    print_r($info);
    curl_close($ch);
    return;
}
 
curl_close($ch);
 
echo "Call with POST with url encoded string\r\nResult:\r\n";
echo $result . "\r\n";
 
 
// Analyse result
switch($output) {
    case "xml" :
        $resultXml = simplexml_load_string($result);
        if ($resultXml === false) {
            $resultCode = "XX";
            $resultDescription = "Invalid xml returned";
        }
        else {
            $resultCode = $resultXml->resultCode;
            $resultDescription = $resultXml->resultDescription;
        }
        break;
}
 
// Display Result
echo "Result Code : " . $resultCode . "\r\n";
echo "Result Dewscription : " . $resultDescription . "\r\n";
if ($expectedResult != $resultXml->resultCode) {
    echo "*** ERROR ***\r\n";
}
echo "\r\n";
 
//=====================================================================
// Call with Post with post parameters in array
$ch = curl_init() ;
curl_setopt($ch, CURLOPT_URL,$url . $service);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('key' => $key , 'password' => $password , 'output' => $output , 'type' => $type , 'sortcode' => $sortcode , 'bankaccount' => $bankaccount ));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Required to remove "Expect: 100-continue" from the header sent
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
 
$result = curl_exec($ch);
 
if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch) . "\r\n";
    $info = curl_getinfo($ch);
    print_r($info);
    curl_close($ch);
    return;
}
 
curl_close($ch);
 
echo "Call with POST with array\r\nResult:\r\n";
echo $result . "\r\n";
 
// Analyse result
switch($output) {
    case "xml" :
        $resultXml = simplexml_load_string($result);
        if ($resultXml === false) {
            $resultCode = "XX";
            $resultDescription = "Invalid xml returned";
        }
        else {
            $resultCode = $resultXml->resultCode;
            $resultDescription = $resultXml->resultDescription;
        }
        break;
}
 
// Display Result
echo "Result Code : " . $resultCode . "\r\n";
echo "Result Dewscription : " . $resultDescription . "\r\n";
if ($expectedResult != $resultXml->resultCode) {
    echo "*** ERROR ***\r\n";
}
echo "\r\n";
 
//=====================================================================
// Call with Get
$ch = curl_init() ;
curl_setopt($ch, CURLOPT_URL,$url . $service . "?key=$key&password=$password&output=$output&type=$type&sortcode=$sortcode&bankaccount=$bankaccount");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
$result = curl_exec($ch);
 
if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch) . "\r\n";
    $info = curl_getinfo($ch);
    print_r($info);
    curl_close($ch);
    return;
}
 
curl_close($ch);
 
echo "Call with GET\r\nResult:\r\n";
echo $result . "\r\n";
 
// Analyse result
switch($output) {
    case "xml" :
        $resultXml = simplexml_load_string($result);
        if ($resultXml === false) {
            $resultCode = "XX";
            $resultDescription = "Invalid xml returned";
        }
        else {
            $resultCode = $resultXml->resultCode;
            $resultDescription = $resultXml->resultDescription;
        }
        break;
}
 
// Display Result
echo "Result Code : " . $resultCode . "\r\n";
echo "Result Dewscription : " . $resultDescription . "\r\n";
if ($expectedResult != $resultXml->resultCode) {
    echo "*** ERROR ***\r\n";
}
echo "\r\n";
 
}
?>
 
 

by aoWare