Bank statement to JSON API: one request, with CSV
Send a bank statement PDF and a schema, get typed transactions back as JSON. One curl request, the response, a CSV conversion and a balance check.
4 min readA bank statement is a PDF with a table in it, and the table is the whole point. This is one request that turns a statement into JSON with a schema you control, and a few lines that turn that JSON into a CSV. It is a narrower take than the general PDF to JSON guide.
The request
Send the statement and a JSON Schema describing the rows you want back:
Replace the data URL with your own base64 PDF. The call returns 201 straight away with the job in pending. Extraction runs asynchronously, so pass a webhook_url to be called when it finishes, or poll GET /jobs/:jobId/get every 2 to 3 seconds. See Jobs and queue.
The response
When the job is completed, output is a JSON string. Parse it:
That output is illustrative, not from a real account. What the schema guarantees is the shape: numbers come back as numbers whatever separator the bank used, and format: "date" and format: "iban" make ISO dates and a validated IBAN a guarantee rather than a judgement. See Schemas and formats.
A statement can run to many pages, and the transactions table does not stop at page one. A job takes a PDF up to 200 pages and 20 MB and answers it as one document.
Statement PDF to CSV
JSON to CSV is your code, not an API feature, and it is short:
Check it reconciles
Do not trust a statement import until it adds up. The statement already carries the check: opening balance plus the sum of the transactions should equal the closing balance.
When it does not, route that statement to review rather than importing it. Tables are the hardest part of any document, and a split or merged row is where every extraction system is weakest. Keep required short so a field that is genuinely absent comes back null instead of invented. More on this in extracted totals that reconcile.
Try it
- Create an account and an API key.
- Add funds in Billing. There is no free balance, so top up before your first job. Billing is prepaid per token, you can add from $5, and a failed job refunds its hold in full. See pricing.
- Run the request above on one of your own statements.