Skip to main content
POST /v1/statements/extract reads a bank statement (a native PDF, a scanned PDF or an image) into its header and its transactions, line by line, and reconciles the balances. GET /v1/statements/{statement_id} returns a queued statement. Scope for both: statements:read. Open to every plan. All calls go to https://app.sahlfinancial.com/api with Authorization: Bearer <key>. The environment comes from X-Sahl-Environment (sandbox by default) or an environment form field. The Sandbox reads specimen documents only. Production needs your workspace to be approved for Production API calls (see Go live). Each key is limited to 60 calls a minute on these routes.

Extract a statement

multipart/form-data:

Up to 6 pages: the answer is the statement (200)

The values come from Sahl’s synthetic sample statement.
  • Line by line. Every transaction row, with amount signed (credit positive, debit negative), as a number with two decimals.
  • Reconciliation is the acceptance test. The opening balance plus all movements must equal the closing balance, each printed running balance must follow from the previous one, and printed totals must equal the sum of the rows. A break is reported in gaps with its row, as a missed or misread line. passed: null means the balances could not be read, so nothing was checked: treat it as not verified.
  • Scans and native PDFs. A native PDF is read from its text layer; a scan or image with OCR. When a scan does not reconcile, its rows are read again by Sahl’s document reader and the reading that reconciles best is kept. read.source says which: text_layer, ocr or vision.
  • A synchronous read stores nothing.

More than 6 pages: queued (202)

A statement of 7 to 60 pages is queued. The answer is HTTP 202:
Wait for the statement.extracted webhook, or poll:
When status is completed, the answer carries the same statement fields as the synchronous answer. status is queued, processing, completed or failed; a failed job has an error_code: sandbox_specimen_required, or processing_failed when the statement could not be read. A queued result is kept 7 days, then the call answers 410 statement_expired. An unknown id, or another workspace’s, answers 404 not_found. The uploaded file of a queued statement is deleted once it is read.

Billing

One document per started block of 10 pages: 1 to 10 pages is 1 document, 11 to 20 is 2, and so on. Every answer carries billing. In Sandbox nothing counts against your plan, but a fair-use cap of 200 documents per workspace and UTC day applies (429 sandbox_daily_cap_reached). In Production the documents count against your plan’s monthly quota together with documents uploaded in the console (429 usage_limit_reached). The quota is checked before the statement is read, so a refused call costs nothing. A statement Sahl could not queue is not billed.

Which banks

There is no per-bank template. The reader handles the layout Moroccan banks share (date, value date, label, débit, crédit, solde, French labels) and names the bank from the header, or from the bank code of the RIB. A layout it does not read well shows up as a failed reconciliation with its gaps, never as invented rows. Sahl’s tests run on synthetic statements and the coverage of each bank’s real layout is still being measured. If a statement from your bank does not reconcile, send Sahl a specimen.

Webhook

statement.extracted is sent when a queued statement has been read (or has failed). It carries statement_id, reference, environment, status, error_code, transaction_count and reconciliation_passed, and never a balance, a transaction or a name. See Webhook endpoints.

Errors