Unofficial The Commonwealth Bank of Australia NetBank API wrap for Node.js
npm install node-cba-netbank -g
$ cba-netbank --helpCBA Netbank CLIUsage: cba-netbank <command> [args]Commands:list List accountsdownload Download transactions history
There are 3 commands,
Username and password can be given via the arguments,
--password, as well as the environment variables,
You can use
list command to see the account list, and use
download command to download the transaction history in given format, there are more arguments for
$ cba-netbank download --helpcba-netbank downloadOptions:-u, --username client number [string] [required] [default: $NETBANK_USERNAME]-p, --password password [string] [required] [default: $NETBANK_PASSWORD]--help Show help [boolean]-a, --account account name or number [string] [required]-f, --from history range from date [string] [default: "03/04/2017"]-t, --to history range to date [string] [default: "03/07/2017"]-o, --output output file name[string] [default: "[<name>](<number>) [<from> to <to>].<ext>"]--format the output file format[string] [choices: "json", "csv", "qif", "aus.qif", "us.qif", "ofx"] [default:"json"]
You can use
-a to specify which account you want to download the history from, and the value can be part of the name or account number. For example, if the account name you want to specified is
Smart Access, then you can use
-a smart to save some time.
OFX format is supported for the transactions history export format.
About the QIF format, there are several options:
qifis most common one, which is for
QIF(MYOB, MSMoney, or Quicken 2005 or later);
aus.qifis for some old software, such as
QIF (Quicken AUS 2004 or earlier);
us.qifis for some old software, such as
QIF (Quicken US 2004 or earlier).
This is an UI you can just use
<DOWN> key to list accounts and its recent transactions.
$ cba-netbank uiLogon as account 1234567 ...? Which account?❯ Smart Access Balance: $987.65 Available Funds: $907.65NetBank Saver Balance: $4321.01 Available Funds: $4021.00GoalSaver Balance: $32109.87 Available Funds: $32109.87Complete Access Balance: $1234.56 Available Funds: $1023.45MasterCard Platinum Balance: $-1234.56 Available Funds: $12345.67<Quit>
<DOWN> key to select an account then press
<ENTER>, the recent transaction history will be downloaded and shown below.
Downloading history [03/05/2017 => 03/07/2017] ...Time Description Amount Balance---------------- ------------------------------------------------------------------------------ -------- --------2017-07-01 00:00 PENDING - HURSTSVILLE TONGLI S HURSTVILLE , 0701; LAST 4 CARD DIGITS 4341 $-3.092017-07-01 00:00 PENDING - DAMS APPLE AT THE STAT HURSTVILLE , 0701; LAST 4 CARD DIGITS 4341 $-12.37...2017-07-01 04:39 THE NAKED DUCK DARLING SYDNEY NS AUS; Card xx4341; Value Date: 28/06/2017 $-13.50 $909.662017-07-01 04:39 TOPSHOP TOPMAN SYDNE SYDNEY AUS; Card xx4341; Value Date: 30/06/2017 $-80.00 $927.16...2017-06-12 16:13 Cardless Cash
To quit the CLI, just select
<Quit> then press
npm install node-cba-netbank --save
username: the netbank client number;
password: the netbank password;
Returned object will contains an
accounts field, which contains all the account information.
Example of list accounts
const Netbank = ;const netbank = ;netbank;
76543210 with your client number, and replace
YOUR_PASSWORD with your netbank password.
The result will look like below:
Smart 98765/90765NetBank 432101/402100...
For each account, there are following properties:
name: Account name;
url: Transaction page for the account, it will be different everytime you logged in;
bsb: BSB number;
account: Account number (without BSB part);
number: The entire account number,
account, without space;
balance: Current account balance. It might be different from the available funds;
available: Current available funds of the account.
Retrieve Transactions for Given Account
netbank.getTransactionHistory(account, from, to)
account: one of the account object retrieved from the previous
from: the begin date of the search period. format is
DD/MM/YYYY, [default: 6 years ago (bank may not store transactions for such long time.)]
to: the end date of the search period. format is
DD/MM/YYYY, [default: today]
The returned object will contains following field:
transactions: the processed transactions;
pendings: the pending transactions;
Example of retrieve transactions
const Netbank = ;const netbank = ;netbank// Assume we are going to retrieve the transactions of the first account, from '1/1/2017' to today;
Be aware, it might take several minutes if there are thousands transactions.
The transaction list will look like below:
2015-04-20T00:00:00.004Z SO THAI RESTAURANT KOGARAH => -13.92015-04-20T00:00:00.003Z NOK NOK SYDNEY => -41.8...
For each transaction object, there are following properties:
timestamp: Timestamp of given transaction, it's milliseconds since epoch. Although, it might be pretty accurate for some accounts (non-credit card account), it might just be accurate at date level;
date: It's human readable date format;
description: Transaction description;
amount: Transaction amount, negative value is DR, positive value is CR;
balance: The balance of the account after the transaction happened, however, the field might be empty for some accounts, such as credit card account;
trancode: It's a category code for the transaction, such as ATM, EFTPOS, cash out might be different code;
receiptnumber: The receipt number for the transaction. However, I cannot found it on my real paper receipt, and the field might be missing for some accounts, such as credit card account;
Offline test can be done by simply run
To enable real world testing, please set environment variables
NETBANK_PASSWORD to your client number and password for online banking.
Then run command:
to have more details, you can run
yarn test-debug for more verbose output.
The test will try to login and get transactions from the first account, and if it will fail if the retrieved transactions number is less than 400. It's ok if you don't have that much transactions in the account. The purpose of checking whether it get more than 400 transactions is to check whether it can overcome the maximum transactions limits.