Relevés bancaires
Les fichiers de relevé téléversés dans une entreprise, et la révision de ce qu'une extraction y a lu. UN FICHIER, UN RELEVÉ : un téléversement multipart répond une collection, une ligne par fichier, chacune avec son propre compte, son propre état et sa propre erreur, si bien qu'un fichier en échec n'entraîne jamais ses voisins avec lui. Une extraction produit des lignes qu'un opérateur corrige - les lignes et les deux soldes du relevé se corrigent en un seul appel atomique - et reconciliation_errors sur cet appel est un avertissement porté par un 200, qui vous dit que le relevé ne s'équilibre plus. UNE EXTRACTION TRANSMET LE FICHIER À UN PRESTATAIRE OCR EXTERNE (Mistral AI) ; l'opération de téléversement énonce le parcours en entier, et le mode archive est celui sous lequel le fichier est stocké, et rien de plus.
List a company's bank statements
Returns the company's uploaded statements, newest first. Poll this - or the single-statement read - after an upload: a 202 means the files exist and are yours to follow, never that the extraction finished.
Upload bank statements
Uploads one or more statement files into a company. **One file, one statement**, so this 202 answers a COLLECTION - one row per file, in request order, each with its own account, state and error - and you poll N ids rather than one. A file that fails extraction never takes its siblings down with it. A part naming an account you cannot reach is different: that is a malformed request, so the whole upload is refused and nothing is stored.
Retrieve a bank statement
Returns one statement. This is the poll target after an upload or a retry, and `state` is the field to read. `started_at` and `finished_at` are the extraction's own clocks now: a `processing` file publishes a start and no end, and both stay null on a file no pass has claimed.
Delete a bank statement
Deletes the statement and its stored file. Allowed only BEFORE commit, and `committed` is where that boundary sits - NOT reconciliation. `committed` turns true as soon as the extraction persists operations - the LINES, which land before `operations_count` is written - so read it before calling: a statement reporting `committed: true` is refused whatever its `state`. In practice this endpoint cancels an import that produced nothing - a statement still at `committed: false`, in any state. An `archived` statement is refused too. The body is the statement as it stood when you asked for it to go - serialized before the delete, because afterwards its file no longer exists to describe.
Retry a statement extraction
Re-runs the extraction on a file whose first attempt did not finish. Read `retryable` on the statement before calling: the affordance and this endpoint read the same rule. The 202 returns the statement reset to `pending`, with the previous error cleared.
Commit a reviewed bank statement
Posts the statement's extracted lines to the general ledger and closes its review. The 200 returns the statement at `posted`, with `committed` true.
Route a statement to a bank account
Resolves an AMBIGUOUS routing by naming the account the file belongs to, and records that a human chose it: `account_detection` becomes `manual`.
Exclude a statement from its upload's commit
Takes the file out of the commit of the upload it arrived in. The 200 returns the statement with `excluded` true and `excluded_at` set.
Include a statement back in its upload's commit
Puts an excluded file back into the commit of its upload. The 200 returns the statement with `excluded` false and `excluded_at` null.
List a statement's extracted lines
Returns the lines the extraction read, in statement order (`operation_date` ascending, then `id`) - the order a statement is read in. This is what an operator reviews before the figures are committed.
Review a statement's lines and balances
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.