Skip to main content

Review a statement's lines and balances

PATCH 

/api/v1/bank_statements/:id/lines

Corrects extracted lines and, in the SAME call, the statement's two balances - there is no PATCH /bank_statements/{id}, and correcting a balance is the same review act as correcting a line. The submission is atomic: one malformed figure refuses all of it and writes nothing, so you never end up with a half-edited statement behind a 422.

The response is the reviewed lines, paginated like the GET, plus a meta carrying the statement's balances and reconciliation_errors - a warning on a 200, telling you the statement no longer adds up even though the correction was applied.

Which states accept a review: completed, partial and reviewing - the extraction is over and the file is still open. posted does not: the commit is done, and correcting a line afterwards would invalidate a ledger entry that already exists. pending, processing, failed and archived are not reviewable either, for four different reasons. pending means only that the file is stored and not yet reviewable - never that an extraction is running; processing is the one state that does mean work is under way. failed may still CARRY the lines of an earlier pass - a retry keeps them and a later failure does not delete them - so GET /bank_statements/{id}/lines will serve them, but they cannot be corrected until a successful extraction returns the file to completed or partial. archived was stored without running an extraction at all, so it has nothing to review and never will. Anything outside the three accepted states is refused statement_not_reviewable.

Inside an accepted state, both corrections are authorized in full: any of the statement's lines that is not yet reconciled or posted, and either of the two balances. Opening a review (reviewing) narrows nothing - it records that a human has the file, and further corrections are still taken.

A correction that ends a statement's review returns it to the state its extraction left it in - partial when the extraction reported errors, completed otherwise - so a corrected partial statement stays partial and stays retryable.

Request​

Responses​

The corrections were applied. The reviewed lines come back paginated, with the statement's balances and a freshly recomputed reconciliation_errors alongside them.