Recalculate Opening Balance
POST /api/v1/accounts/:id/recalculate-opening-balance
Recomputes opening_balance/opening_balance_date from the earliest statement on file for this account (ordered by period_start), and updates the account with the result. Useful after uploading an earlier statement than the one the account's opening balance was originally derived from.
Path Parameters
| Parameter | Type | Description |
|---|
| id | string | Account ID |
Example Request
curl -X POST "https://statements.finopsbricks.com/api/v1/accounts/acc123xyz/recalculate-opening-balance" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Response
{
"data": {
"id": "acc123xyz",
"opening_balance": 10000.00,
"opening_balance_date": "2024-01-01"
}
}
Errors
| Code | Description |
|---|
| 401 | Invalid or missing API credentials |
| 403 | API key lacks accounts:edit permission |
| 404 | Account not found, or no statements on file for this account |
| 400 | The earliest statement has no opening balance information (NO_OPENING_BALANCE_DATA) |