bankstract

Response formats

JSON, CSV, and redacted output.

POST /v1/parse shapes its output with the format query param. Redaction is its own route, POST /v1/redact.

JSON (default)

?format=json (or omit it) returns the ParseResponse object: metadata, totals, the transaction array, and reconciliation (which checks ran and passed; see Quickstart). Money fields are decimal strings; dates are ISO 8601.

Row money rules, in JSON and CSV:

  • debit and credit are never negative. A statement row with a negative amount fails the parse with a 422 (error_class: "LayoutDriftError"). It never comes back as a clean result.
  • A zero debit, credit or balance is always unsigned. You never get -0.00.
  • debit and credit can both be nonzero on one row when the statement prints both. They are never netted. Sum each column on its own.

CSV

?format=csv returns text/csv with a Content-Disposition attachment header, serialized by the engine's own writer:

curl -X POST "https://bankstract.logickoder.dev/v1/parse?format=csv" \
  -H "Authorization: Bearer bsk_live_xxx" \
  -F "pdf=@statement.pdf" -o statement.csv

Columns: date, narration, debit, credit, balance, reference, currency, has_time. has_time is true or false.

Redaction

POST /v1/redact runs the NDPR-aware redactor and returns the redacted document bytes (PDF or XLSX), not JSON, with the matching Content-Type and two headers:

  • X-Bankstract-Redactions: count of redactions applied
  • X-Bankstract-Format-Version: engine format version
curl -X POST https://bankstract.logickoder.dev/v1/redact \
  -H "Authorization: Bearer bsk_live_xxx" \
  -F "pdf=@statement.pdf" -o redacted.pdf

Same key, same 50 MB limit, optional bank. It counts as one parse. Over a free cap it returns 402 with error_class: "free_limit_reached": there is no canned sample for a redacted document. The old redact=true field on /v1/parse is gone. A request that still sends it gets 422 with error_class: "removed_parameter", never an unredacted statement.

Optional inputs

  • bank=<name>: skip auto-detection and force a parser (fbn, opay, palmpay, zenith).

The PDF is parsed in memory and never written to disk, for any format.

On this page