File input
Send PDF, JPG or PNG files directly as multipart uploads.
BANK STATEMENT FILE API
Upload a PDF, JPG or PNG statement for OCR, or convert supported financial files into spreadsheet and accounting formats. Extracted page text is an internal processing detail.
curl --request POST \ --url https://bankexcelconverter.com/api/ocr \ --header "Authorization: Bearer bec_YOUR_API_KEY" \ --form "file=@statement.pdf"
Send PDF, JPG or PNG files directly as multipart uploads.
Check requestedPages, processedPages and failedPages before accepting OCR output.
Request CSV, XLSX, OFX, QBO, QFX, QIF, IIF, XML, TXT or PDF output.
Create an API key, keep it on your server, then upload one file using multipart/form-data.
const form = new FormData();
form.set("file", statementFile);
const response = await fetch("https://bankexcelconverter.com/api/ocr", {
method: "POST",
headers: {Authorization: "Bearer " + process.env.BANKEXCEL_API_KEY},
body: form
});
const result = await response.json();
if (!response.ok) throw new Error(result.error ?? "OCR failed");Server-side only
Do not place API keys in browser JavaScript, mobile bundles, URLs, public repositories or client logs.
Use either header. Bearer authentication takes precedence when both are supplied.
| Field | Type | Required | Description |
|---|---|---|---|
Authorization | header | No | Bearer bec_… — recommended. |
x-api-key | header | No | bec_… — equivalent alternative. |
Content-Type | header | Yes | multipart/form-data; let the HTTP client generate the boundary. |
/api/ocrUploads one statement and returns recognized page text, balances, page status and transaction rows as JSON. This path uses Cloudflare Workers AI. It does not run the browser PDF.js or Tesseract pipeline.
Multipart fields
| Field | Type | Required | Description |
|---|---|---|---|
file | binary | Yes | One PDF, JPG, JPEG or PNG bank or credit-card statement. |
opening_balance | string | No | Printed opening balance supplied as recognition context. |
closing_balance | string | No | Printed closing balance supplied as recognition context. |
curl --request POST \ --url https://bankexcelconverter.com/api/ocr \ --header "Authorization: Bearer bec_YOUR_API_KEY" \ --form "file=@statement.pdf"
curl --request POST \ --url https://bankexcelconverter.com/api/ocr \ --header "Authorization: Bearer bec_YOUR_API_KEY" \ --form "file=@statement-page.png"
/api/convertConverts a statement or transaction file and returns the generated file. PDF and image inputs use the same Workers AI OCR pipeline before export, not in-browser PDF.js or Tesseract. Both endpoints require remaining paid pages; the 20 free pages stay on the website converter only.
Multipart fields
| Field | Type | Required | Description |
|---|---|---|---|
file | binary | Yes | The source file. |
input_format | enum | Yes | PDF; JPG for JPG/JPEG/PNG images; or CSV, XLSX, OFX, QFX, QBO, QIF, IIF or XML. |
output_format | enum | Yes | CSV, XLSX, OFX, QFX, QBO, QIF, IIF, XML, TXT or PDF. |
File response headers
| Field | Type | Required | Description |
|---|---|---|---|
Content-Type | header | — | MIME type of the generated file. |
Content-Disposition | header | — | Sanitized attachment filename. |
X-Transaction-Count | header | — | Number of transaction rows written. |
X-Processing-Mode | header | — | ocr for PDF/image input; deterministic for structured file conversion without an AI request. |
curl --request POST \ --url https://bankexcelconverter.com/api/convert \ --header "Authorization: Bearer bec_YOUR_API_KEY" \ --form "file=@statement.pdf" \ --form "input_format=PDF" \ --form "output_format=XLSX" \ --output statement.xlsx
HTTP 200 returns JSON only when every selected page has been processed. Review recognized rows before import or posting.
Response
200 application/json| Field | Type | Required | Description |
|---|---|---|---|
pages | Page[] | — | Recognized page number and page text. |
requestedPages | integer[] | — | Pages selected for processing. |
processedPages | integer[] | — | Successfully processed pages. |
failedPages | integer[] | — | Failed pages; empty on HTTP 200. |
openingBalance | string | null | — | Recognized opening balance. |
closingBalance | string | null | — | Recognized closing balance. |
currency | string | — | Recognized currency code. |
transactions | Transaction[] | — | Recognized rows requiring review. |
Transaction fields
| Field | Type | Required | Description |
|---|---|---|---|
date | string | — | Recognized transaction date. |
description | string | — | Recognized description or payee. |
amount | string | — | Signed decimal amount; withdrawals are negative. |
debit | string | — | Debit value or empty string. |
credit | string | — | Credit value or empty string. |
balance | string | — | Running balance or empty string. |
page | integer | — | Source page number. |
rawText | string | — | Visible source line returned for review. |
sourceBounds | null | — | Reserved for source coordinates; unavailable in the current provider output. |
confidence | null | — | Unavailable rather than estimated without evidence. |
validationFlags | string[] | — | Review and traceability flags; AI_REVIEW_REQUIRED is always present. |
{
"pages": [{"page": 1, "text": "04/03 ACH payroll 1,840.00 5,120.44"}],
"requestedPages": [1], "processedPages": [1], "failedPages": [],
"openingBalance": "3280.44", "closingBalance": "444.92", "currency": "USD",
"transactions": [{
"date": "2026-04-03", "description": "ACH payroll", "amount": "1840.00",
"debit": "", "credit": "1840.00", "balance": "5120.44", "page": 1,
"rawText": "04/03 ACH payroll 1,840.00 5,120.44", "sourceBounds": null,
"confidence": null, "validationFlags": ["AI_REVIEW_REQUIRED"]
}]
}Every JSON error contains an error string. OCR failures include page-status arrays when available.
| Field | Type | Required | Description |
|---|---|---|---|
400 | Bad Request | — | Missing file or parameter, malformed multipart body, empty file, or matching input and output formats. |
401 | Unauthorized | — | Missing, malformed, revoked, or unknown API key. |
402 | Payment Required | — | Remaining paid pages are required. The daily 20 free pages cannot be used on the API. |
405 | Method Not Allowed | — | Only POST is accepted. |
413 | Payload Too Large | — | The request exceeds the current synchronous processing boundary. |
415 | Unsupported Media Type | — | Wrong request content type or unsupported uploaded file format. |
422 | Unprocessable Content | — | The file contains no usable rows, a page failed, or OCR returned no usable transactions. |
502 | Bad Gateway | — | The OCR provider failed while processing the file. |
503 | Service Unavailable | — | OCR or account storage is not configured. |