API "all transactions" does not tally to correct balance

Hi :slight_smile:

Since the timeline graph feature was removed from the app I have to make extra efforts each month to know how much left in my account the day before i get paid. Monzo Plus helped with this using the export to google sheet feature. With some spreadsheet jiggerypokery you can get a rolling balance. I was really impressed at the rolling balance across the past 3 years instantly hitting the correct balance of my account (well ok you expect that) - job done

However, the API is not the same - I cant get it to match my exact balance to prove the numbers. I have a Monzo webhook hitting an Azure function to add new records but i wanted to upload the transaction history i got from from a freshly authed API. I ran the following code: (PowerShell)

$Balance = 0
$AllTransactions | ForEach-Object `
{
    $Balance += $_.Amount
}

The total in $Balance was way out of whack - to the extreme, very very wrong. So i did some further research in to the records and found that failed attempts of a card payment included a record that had a value in the amount field. I discovered that these transactions did not contain a value in the “settled” field so I removed them and re-totaled the balance with the following code

$AllTransactionsCleaned = $AllTransactions | Where-Object {$_.settled -ne ""}
$Balance = 0
$AllTransactionsCleaned | ForEach-Object `
{
    $Balance += $_.Amount
}

*** please note that on line 1, the reason for using {$_.settled -ne “”} rather than $null is that it is blank in my database rather than null (a workaround for an Azure Table Storage quirk)

This Also gives an incorrect balance (spreadsheet and App match, but this does not) but… over the last 3 years of transactions it is only about 40 GBP out.

Is there any information please on what type of records the google sheet export is filtering? ie failed card attempts and what else?

I need to get a valid ledger from the API that totals correctly or there is not much point. What record types am i failing to omit?

I think this information would be very useful for the developer community here as when receiving “All Transactions” from the API the amounts don’t tally to a correct balance !?!??

Please advise

I suspect you need to look for declined transactions and filter those out. You should not filter out transactions which haven’t settled.

I think you want to check that the decline_reason field is empty.

Sorry I can’t be more help!

2 Likes