UK Bank Account Checker JSON API

The API returns a validation code, a validation description and account properties in JSON 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://www.bankaccountchecker.com/listener.php?key=<your_api_key>&password=<your_password>&output=json&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 JSON:
{
   "resultCode":"01",
   "resultDescription":"Sortcode and Bank Account are valid",
   "accountProperties":{
      "institution":"BANK OF ENGLAND",
      "branch":"LONDON",
      "fast_payment":"true",
      "bacs_credit":"false",
      "bacs_direct_debit":"true",
      "chaps":"true",
      "cheque":"true"
   }
}
This is a another sample of the output you will get in JSON with the optional Branch Properties set on your account. This is a new functionality requiring further setup and come at an additional cost:
{
   "resultCode":"01",
   "resultDescription":"Sortcode and Bank Account are valid",
   "accountProperties":{
      "institution":"BANK OF ENGLAND",
      "branch":"LONDON",
      "fast_payment":"true",
      "bacs_credit":"false",
      "bacs_direct_debit":"true",
      "chaps":"true",
      "cheque":"true"
   }
   "branchProperties":{
      "address":"National Counties Hse, Church St, Epsom, KT17 4NL, Surrey",
      "address_line1":"National Counties Hse",
      "address_line2":"Church St",
      "address_line3":"Epsom",
      "address_line4":"KT17 4NL",
      "address_line5":"Surrey",
      "address_line6":"",
      "address_line7":"",
      "city":"Epsom",
      "country":"England",
      "postcode":"KT17 4NL",
      "latitude":"51.329986044209100",
      "longitude":"-0.259857286548163",
      "phone":"01372742211"
   }
}
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.

Javascript example
In this example, we are using a simple form data capture and use jquery to perform the call to the validation listener. You can download this jQuery version of the script as well from our download page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <title>BankAccountChecker :: Javascript Json API</title>
   <meta http-equiv="content-type" content="text/html;charset=utf-8" />
   <link rel="shortcut icon" href="https://www.bankaccountchecker.com/favicon.ico" />
   <script type="text/javascript" language="javascript" src="https://www.bankaccountchecker.com/js/jquery-1.10.2.min.js"></script>
   <script type="text/javascript">
 
     $(document).ready(function(){
        $("#testResult").hide();
        })
 
     function callListener() {
        var apiKey      = 'apiTest'; // Replace with your own key
        var apiPassword = 'apiTest'; // Replace with your password
        var sortcode = $('#sortcode').val();
        var bankaccount = $('#bankaccount').val();
        var postData = 'key=' + apiKey + '&password=' + apiPassword + '&output=json&type=uk&sortcode=' + sortcode + '&bankaccount=' + bankaccount;
 
        // Cross-Domain javascript call
        $.getJSON("https://www.bankaccountchecker.com/listener.php?" + postData + "&callback=?",
           function(data) {
                $("#testResult").show();
                $("#resultCode").text(data.resultCode);
                $("#resultDescription").text(data.resultDescription);
           });
        }
 
   </script>
</head>
<body>
  <table border='0'>
    <tr><td>Sortcode</td><td><input id='sortcode' type='text' value='180002' /></td></tr>
    <tr><td>Bank Account</td><td><input id='bankaccount' type='text' value='00000190' /></td></tr>
  </table>
  <input type='button' value='Test' onclick='callListener()' />
  <div id='testResult'>
     Result Code : <span id='resultCode'></span><br />
     Result Description : <span  id='resultDescription'></span>
  </div>
<script type="text/javascript">
</script>
</body>
</html>
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://www.bankaccountchecker.com/";
$service = "listener.php";
 
// Define parameters for all tests
$key         = "apiTest";
$password    = "apiTest";
$output      = "json";
$type        = "uk_bankaccount";
 
// Start callAPI
callAPI("1","Pass modulus 10 check.","01",$key,$password,$output,$type,"089999","66374958");
callAPI("2","Pass modulus 11 check.","01",$key,$password,$output,$type,"107999","88837491");
callAPI("3","Pass modulus 11 and double alternate checks.","01",$key,$password,$output,$type,"202959","63748472");
callAPI("4","Exception 10 & 11 where first check passes and second check fails.","01",$key,$password,$output,$type,"871427","46238510");
callAPI("5","Exception 10 & 11 where first check fails and second check passes.","01",$key,$password,$output,$type,"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,$type,"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,$type,"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,$type,"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,$type,"827999","73988638");
callAPI("10","Exception 3. As c6 or 9 perform both checks pass.","01",$key,$password,$output,$type,"827101","28748352");
callAPI("11","Exception 4 where the remainder is equal to the checkdigit.","01",$key,$password,$output,$type,"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,$type,"118765","64371389");
callAPI("13","Exception 6 where the account fails standard check but is a foreign currency account.","01",$key,$password,$output,$type,"200915","41011166");
callAPI("14","Exception 5 where the check passes.","01",$key,$password,$output,$type,"938611","07806039");
callAPI("15","Exception 5 where the check passes with substitution.","01",$key,$password,$output,$type,"938600","42368003");
callAPI("16","Exception 5 where both checks produce a remainder of 0 and pass.","01",$key,$password,$output,$type,"938063","55065200");
callAPI("17","Exception 7 where passes but would fail the standard check.","01",$key,$password,$output,$type,"772798","99345694");
callAPI("18","Exception 8 where the check passes.","01",$key,$password,$output,$type,"086090","06774744");
callAPI("19","Exception 2 & 9 where the first check passes and second check fails.","01",$key,$password,$output,$type,"309070","02355688");
callAPI("20","Exception 2 & 9 where the first check fails and second check passes with substitution.","01",$key,$password,$output,$type,"309070","12345668");
callAPI("21","Exception 2 & 9 where a?0 and g?9 and passes.","01",$key,$password,$output,$type,"309070","12345677");
callAPI("22","Exception 2 & 9 where a?0 and g=9 and passes.","01",$key,$password,$output,$type,"309070","99345694");
callAPI("23","Exception 5 where the first checkdigit is correct and the second incorrect.","02",$key,$password,$output,$type,"938063","15764273");
callAPI("24","Exception 5 where the first checkdigit is incorrect and the second correct.","02",$key,$password,$output,$type,"938063","15764264");
callAPI("25","Exception 5 where the first checkdigit is incorrect with a remainder of 1.","02",$key,$password,$output,$type,"938063","15763217");
callAPI("26","Exception 1 where it fails double alternate check.","02",$key,$password,$output,$type,"118765","64371388");
callAPI("27","Pass modulus 11 check and fail double alternate check.","02",$key,$password,$output,$type,"203099","66831036");
callAPI("28","Fail modulus 11 check and pass double alternate check.","02",$key,$password,$output,$type,"203099","58716970");
callAPI("29","Fail modulus 10 check.","02",$key,$password,$output,$type,"089999","66374959");
callAPI("30","Fail modulus 11 check.","02",$key,$password,$output,$type,"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,$type,"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,$type,"070116","34012583");
callAPI("33","Exception 12/13 where fails the modulus 11 check, but passes the modulus 10 check.","01",$key,$password,$output,$type,"074456","11104102");
callAPI("34","Exception 14 where the first check fails and the second check passes.","01",$key,$password,$output,$type,"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");
 
    $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";
 
    // Display result
    $resultJson = json_decode($result);
 
    switch (json_last_error()) {
        case JSON_ERROR_NONE:
            echo "Result Code : " . $resultJson->resultCode . "\r\n";
            echo "Result Description : " . $resultJson->resultDescription . "\r\n";
 
            if ($expectedResult != $resultJson->resultCode) {
                echo "*** ERROR ***\r\n";
            }
            echo "\r\n";
            break;
        case JSON_ERROR_DEPTH:
            echo "JSON ERROR - Maximum stack depth exceeded\r\n";
            break;
        case JSON_ERROR_STATE_MISMATCH:
            echo "JSON ERROR  - Underflow or the modes mismatch\r\n";
            break;
        case JSON_ERROR_CTRL_CHAR:
            echo "JSON ERROR  - Unexpected control character found\r\n";
            break;
        case JSON_ERROR_SYNTAX:
            echo "JSON ERROR  - Syntax error, malformed JSON\r\n";
            break;
        case JSON_ERROR_UTF8:
            echo "JSON ERROR  - Malformed UTF-8 characters, possibly incorrectly encoded\r\n";
            break;
        default:
            echo "JSON ERROR  - Unknown error\r\n";
            break;
    }
 
    //=====================================================================
    // 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 ));
 
    $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";
 
    // Display result
    $resultJson = json_decode($result);
 
    switch (json_last_error()) {
        case JSON_ERROR_NONE:
            echo "Result Code : " . $resultJson->resultCode . "\r\n";
            echo "Result Description : " . $resultJson->resultDescription . "\r\n";
 
            if ($expectedResult != $resultJson->resultCode) {
                echo "*** ERROR ***\r\n";
            }
            echo "\r\n";
            break;
        case JSON_ERROR_DEPTH:
            echo "JSON ERROR - Maximum stack depth exceeded\r\n";
            break;
        case JSON_ERROR_STATE_MISMATCH:
            echo "JSON ERROR  - Underflow or the modes mismatch\r\n";
            break;
        case JSON_ERROR_CTRL_CHAR:
            echo "JSON ERROR  - Unexpected control character found\r\n";
            break;
        case JSON_ERROR_SYNTAX:
            echo "JSON ERROR  - Syntax error, malformed JSON\r\n";
            break;
        case JSON_ERROR_UTF8:
            echo "JSON ERROR  - Malformed UTF-8 characters, possibly incorrectly encoded\r\n";
            break;
        default:
            echo "JSON ERROR  - Unknown error\r\n";
            break;
    }
 
    //=====================================================================
    // 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);
 
    $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";
 
    // Display result
    $resultJson = json_decode($result);
 
    switch (json_last_error()) {
        case JSON_ERROR_NONE:
            echo "Result Code : " . $resultJson->resultCode . "\r\n";
            echo "Result Description : " . $resultJson->resultDescription . "\r\n";
 
            if ($expectedResult != $resultJson->resultCode) {
                echo "*** ERROR ***\r\n";
            }
            echo "\r\n";
            break;
        case JSON_ERROR_DEPTH:
            echo "JSON ERROR - Maximum stack depth exceeded\r\n";
            break;
        case JSON_ERROR_STATE_MISMATCH:
            echo "JSON ERROR  - Underflow or the modes mismatch\r\n";
            break;
        case JSON_ERROR_CTRL_CHAR:
            echo "JSON ERROR  - Unexpected control character found\r\n";
            break;
        case JSON_ERROR_SYNTAX:
            echo "JSON ERROR  - Syntax error, malformed JSON\r\n";
            break;
        case JSON_ERROR_UTF8:
            echo "JSON ERROR  - Malformed UTF-8 characters, possibly incorrectly encoded\r\n";
            break;
        default:
            echo "JSON ERROR  - Unknown error\r\n";
            break;
    }
 
}
?>