Update Statement
PATCH /api/v1/statements/:id
Updates the period and balance fields of a statement. Use this to manually set or correct statement period dates and opening/closing balances.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | Statement ID |
Request Body
| Field | Type | Description |
|---|---|---|
| file_name | string | Display name for the statement |
| period_start | string | Statement period start date (YYYY-MM-DD) |
| period_end | string | Statement period end date (YYYY-MM-DD) |
| opening_balance | integer | Opening balance (smallest currency unit) |
| closing_balance | integer | Closing balance (smallest currency unit) |
| review | object | Review status object (see below) |
All fields are optional. Only include fields you want to update. Balance values should be integers in the smallest currency unit (e.g., paise for INR).
Review Object
| Field | Type | Description |
|---|---|---|
| is_done | boolean | Whether review is complete |
| at | string | ISO 8601 timestamp of review |
| type | string | Reviewer type: ai or human |
| by | string | User ID if human reviewer, null if AI |
| work_record_id | string | WorkRecord ID documenting the review |
Example Request
curl -X PATCH "https://statements.finopsbricks.com/api/v1/statements/stmt123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"period_start": "2025-01-01",
"period_end": "2025-01-31",
"opening_balance": 5000050,
"closing_balance": 4825075
}'
Example: Rename Statement
curl -X PATCH "https://statements.finopsbricks.com/api/v1/statements/stmt123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"file_name": "HDFC Savings - January 2025.pdf"
}'
Example: Update Period Only
curl -X PATCH "https://statements.finopsbricks.com/api/v1/statements/stmt123xyz" \
-H "api-key: fob_stm_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"period_start": "2025-01-01",
"period_end": "2025-01-31"
}'
Response
{
"data": {
"id": "stmt123xyz",
"file_name": "statement_jan_2025.pdf",
"mime_type": "application/pdf",
"file_type": "pdf",
"file_size": "245760",
"parser_type": "hdfc_savings__pdf",
"step": "complete",
"error": null,
"account_id": "acc123",
"account_name": "Main Account",
"account_currency": "INR",
"is_archived": false,
"created_at": "2025-01-05T10:30:00.000Z",
"period_start": "2025-01-01",
"period_end": "2025-01-31",
"opening_balance": 5000050,
"closing_balance": 4825075,
"data_source": {
"period_start": "user_entered",
"period_end": "user_entered",
"opening_balance": "user_entered",
"closing_balance": "user_entered"
}
}
}
Data Source Tracking
When you update a field, the data_source object tracks how the value was set:
| Previous Source | After Update |
|---|---|
null / unknown | user_entered |
extracted | user_updated |
computed | user_updated |
user_entered | user_entered |
user_updated | user_updated |
This allows you to see whether a value was originally extracted from the statement or manually entered.
Validation Rules
Period Validation
If the statement has transactions, the period must contain all transaction dates:
period_startmust be on or before the earliest transaction dateperiod_endmust be on or after the latest transaction date
Example: If a statement has transactions from 2025-01-03 to 2025-01-28:
- Valid:
period_start: "2025-01-01",period_end: "2025-01-31" - Invalid:
period_start: "2025-01-05"(after earliest transaction) - Invalid:
period_end: "2025-01-25"(before latest transaction)
Validation Error Response
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid statement period",
"details": [
"period_start (2025-01-05) cannot be after earliest transaction (2025-01-03)"
]
}
}
Errors
| Code | Description |
|---|---|
| 400 | Invalid request body or validation error |
| 401 | Invalid or missing API credentials |
| 403 | API key lacks statements:edit permission |
| 404 | Statement not found |