Get Account Balance

GET /api/v1/accounts/:id/balance

Returns the computed account balance as of a specific date. The balance is calculated from the account's opening balance plus all transactions up to the specified date.

Path Parameters

ParameterTypeDescription
idstringAccount ID

Query Parameters

ParameterTypeRequiredDescription
as_ofstringYesDate to compute balance for (YYYY-MM-DD format)

Example Request

curl -X GET "https://statements.finopsbricks.com/api/v1/accounts/acc123xyz/balance?as_of=2024-12-31" \
  -H "api-key: fob_stm_xxxxxxxxxxxx" \
  -H "api-secret: xxxxxxxxxxxxxxxx"

Response

{
  "data": {
    "account_id": "acc123xyz",
    "as_of_date": "2024-12-31",
    "balance": 5000.00,
    "computed_from": {
      "opening_balance": 1000.00,
      "opening_balance_date": "2024-01-01",
      "total_inflow": 6000.00,
      "total_outflow": 2000.00,
      "transaction_count": 150
    }
  }
}

Response Fields

FieldTypeDescription
account_idstringThe account ID
as_of_datestringThe date the balance was computed for
balancenumberEnd-of-day balance as of the specified date
computed_from.opening_balancenumberAccount's opening balance
computed_from.opening_balance_datestring|nullDate of the opening balance
computed_from.total_inflownumberSum of all inflows from opening_balance_date to as_of
computed_from.total_outflownumberSum of all outflows from opening_balance_date to as_of
computed_from.transaction_countnumberNumber of transactions in the period

Use Case

This endpoint is useful for statement reconciliation. When you receive a bank statement, you can:

  1. Get the balance as of period_start - 1 day from this API
  2. Compare it with the statement's opening balance
  3. Identify discrepancies without fetching all historical transactions

Errors

CodeDescription
400Missing or invalid as_of parameter
400as_of date is before the account's opening_balance_date
401Invalid or missing API credentials
403API key lacks accounts:read permission
404Account not found