Statement
AccountAuth RequiredGet the account statement. The loginid parameter and transfer fields are removed, fewer action_type values are used, and app_id changed from an integer to a string.
5 Breaking Changes
loginid parameter and the transfer fields are removed, action_type takes and returns fewer values, and app_id is a string instead of an integer.Quick comparison
Breaking changes
1. loginid parameter removed
In the Legacy API, loginid selected the account when you authorised several accounts. The New API does not accept it.
Required change: Remove loginid from your statement requests. Your token selects the account.
2. Fewer action_type filter values
The action_type filter in the request accepts buy, sell, deposit and withdrawal. It no longer accepts escrow, adjustment, virtual_credit or transfer.
Required change: Stop filtering by the values the New API no longer accepts.
3. Transfer fields removed
Transactions no longer include fees, from, to or withdrawal_details.
Required change: Stop reading these fields from statement transactions.
4. Fewer action_type values in transactions
The action_type of a returned transaction is buy, sell, deposit, withdrawal or adjustment. The New API no longer returns hold, release, virtual_credit or transfer.
Required change: Update code that handles the values the New API no longer returns.
5. app_id is now a string
Each transaction's app_id was an integer or null in the Legacy API. In the New API it is a string or null.
Required change: Read app_id as a string, and convert it if you compare it with a number.
Request structure
{
"statement": 1,
"action_type": "transfer",
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
}{
"statement": 1,
"action_type": "deposit",
"description": 1,
"limit": 25,
"req_id": 1
}Response structure
{
"echo_req": {
"statement": 1,
"action_type": "transfer",
"description": 1,
"limit": 25,
"loginid": "CR123456",
"req_id": 1
},
"msg_type": "statement",
"req_id": 1,
"statement": {
"count": 1,
"transactions": [
{
"action_type": "transfer",
"amount": -100,
"app_id": 1089,
"balance_after": 9900,
"contract_id": null,
"fees": {
"amount": 1,
"currency": "USD",
"minimum": 0.1,
"percentage": 1
},
"from": {
"loginid": "CR123456"
},
"longcode": "Account transfer from CR123456 to CR654321",
"reference_id": null,
"to": {
"loginid": "CR654321"
},
"transaction_id": 11542203587,
"transaction_time": 1760000000
}
]
}
}{
"echo_req": {
"statement": 1,
"action_type": "deposit",
"description": 1,
"limit": 25,
"req_id": 1
},
"msg_type": "statement",
"req_id": 1,
"statement": {
"count": 1,
"transactions": [
{
"action_type": "deposit",
"amount": 100,
"app_id": "1089",
"balance_after": 10100,
"contract_id": null,
"longcode": "Deposit to CR123456",
"reference_id": null,
"transaction_id": 11542203588,
"transaction_time": 1760000000
}
]
}
}Code examples
function getStatement(loginId) {
ws.send(JSON.stringify({ statement: 1, action_type: "transfer", description: 1, limit: 25, loginid: loginId }));
ws.onmessage = (event) => {
const response = JSON.parse(event.data);
if (response.msg_type !== "statement") return;
if (response.statement) {
response.statement.transactions?.forEach((tx) => {
console.log(tx.action_type, tx.amount, tx.from?.loginid, tx.to?.loginid);
});
}
};
}Any other questions? Get in touch