Route a statement to a bank account
POST/api/v1/bank_statements/:id/route_account
Resolves an AMBIGUOUS routing by naming the account the file belongs to, and records that a human chose it: account_detection becomes manual.
When you need it. The extractor reads the IBAN off the document and matches it against the company's accounts. When it matches none, or several, the file is published account_detection: ambiguous - and every commit refuses it until this call settles the question. Read account_detection after the extraction rather than discovering the refusal at commit time.
What it moves. The statement and all of its lines are re-pointed at the account you name, and any accounting already projected against the former account is removed - the commit re-posts against the new one. The extracted FIGURES are untouched, so a review already confirmed stays confirmed and no second confirmation is needed between this call and the commit.
No Idempotency-Key is required: routing to the same account twice is the same file in the same place. Naming a DIFFERENT account a second time is a second routing and will be performed - the header does not protect you from that, reading the response does.
Request
Responses
- 200
- 401
- 403
- 404
- 422
The file was routed. It comes back on the chosen account, with account_detection now manual.
The request carries no bearer token, or one that is invalid or expired.
The token may not perform this call: the OAuth scope derived from the verb (write), the workspace grant, the bank_reconciliation feature flag, or the action's own Pundit check. The example below is refused on the scope.
No statement with this id is reachable by the token's grants. One belonging to another workspace answers the same way, so the response cannot be used to probe for one.
The routing was refused, and details is what tells the two families apart.
Without details - statement_not_reviewable: the FILE is not open to routing. It is archived, still extracting, already posted, was stored in archive mode, or its routing was never ambiguous in the first place (account_detection is auto). Nothing you send can change that; read the statement.
With details.bank_account_id - the ACCOUNT you named is not a destination for this file: it belongs to another company, is synced from an aggregation provider, is archived, or the move was refused because this file's lines already carry reconciliation work. Resend with another account.