BSB (Bank State Branch) number is a six-digit number used to identify the individual branch of an Australian bank or financial institution. It’s much like a SWIFT code but for an Australian bank account.
A BSB number consists of 6 digits and contains the bank code (2 digits), the state code (1 digit) and the branch code (3 digits).
For example, BSB number 082-024:
- 08 - bank code
- 2 - state code
- 024 - branch code
When you send money using an invalid BSB number, the bank should reverse the transaction and return the money, but this might take some time and your bank may charge you a fee. Using our flexible and fast RESTful API you can validate a BSB number and receive all possible information about it - see whether it's valid and which bank, state and branch it belongs to, as well as branch city, address and postcode.
How to validate a BSB number
To start using our SWIFT codes API sign up here and create your API key. Pass this key either via x-api-key
HTTP header or via api_key
query param.
To validate a BSB number call /v1/bsbs/{bsb_code}
endpoint using HTTP client of your preference, i.e.:
curl 'https://swiftcodesapi.com/v1/bsbs/082-024' \
--header 'X-Api-Key: your-api-key-here' \
--header 'Accept: application/json'
# INSTALLATION
$ composer require guzzlehttp/guzzle
# REQUEST
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://swiftcodesapi.com/v1/bsbs/082-024', [
'headers' => [
'Accept' => 'application/json',
'X-Api-Key' => 'your-api-key-here',
],
]);
echo $response->getBody();
# INSTALLATION
$ python -m pip install requests
# REQUEST
import requests
url = "https://swiftcodesapi.com/v1/bsbs/082-024"
headers = {
"Accept": "application/json",
"X-Api-Key": "your-api-key-here"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
# INSTALLATION
$ npm install node-fetch --save
// REQUEST
const fetch = require('node-fetch');
const url = 'https://swiftcodesapi.com/v1/bsbs/082-024';
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));)
const options = {method: 'GET', headers: {'Accept': 'application/json', 'X-Api-Key': 'your-api-key-here'}};
fetch('https://swiftcodesapi.com/v1/bsbs/082-024', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
The response should be:
{
"success": true,
"data": {
"id": "082-024",
"branch_name": "World Square",
"address": "Shp 10-33 Upp Gnd Lvl 686 George St",
"suburb": "Sydney",
"state": "NSW",
"postcode": 2000,
"peh": "PEH",
"bank": {
"id": "6ab9a942-51ca-4e5f-ab17-32612d787ed4",
"country_id": "AU",
"code": "NAB",
"name": "National Australia Bank"
}
}
}
You can find full documentation here.