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
| Parameter | Type | Description |
|---|
| id | string | Account ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|
| as_of | string | Yes | Date 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
| Field | Type | Description |
|---|
| account_id | string | The account ID |
| as_of_date | string | The date the balance was computed for |
| balance | number | End-of-day balance as of the specified date |
| computed_from.opening_balance | number | Account's opening balance |
| computed_from.opening_balance_date | string|null | Date of the opening balance |
| computed_from.total_inflow | number | Sum of all inflows from opening_balance_date to as_of |
| computed_from.total_outflow | number | Sum of all outflows from opening_balance_date to as_of |
| computed_from.transaction_count | number | Number of transactions in the period |
Use Case
This endpoint is useful for statement reconciliation. When you receive a bank statement, you can:
- Get the balance as of
period_start - 1 day from this API
- Compare it with the statement's opening balance
- Identify discrepancies without fetching all historical transactions
Errors
| Code | Description |
|---|
| 400 | Missing or invalid as_of parameter |
| 400 | as_of date is before the account's opening_balance_date |
| 401 | Invalid or missing API credentials |
| 403 | API key lacks accounts:read permission |
| 404 | Account not found |