BANK STATEMENT FILE API

OCR and conversion 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.

  • POST /api/ocr
  • POST /api/convert
  • Bearer or x-api-key
cURL · PDF OCR
curl --request POST \
  --url https://bankexcelconverter.com/api/ocr \
  --header "Authorization: Bearer bec_YOUR_API_KEY" \
  --form "file=@statement.pdf"

File input

Send PDF, JPG or PNG files directly as multipart uploads.

Page status

Check requestedPages, processedPages and failedPages before accepting OCR output.

Tools output

Request CSV, XLSX, OFX, QBO, QFX, QIF, IIF, XML, TXT or PDF output.

Quick start

Create an API key, keep it on your server, then upload one file using multipart/form-data.

JavaScript
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.

Authentication

Use either header. Bearer authentication takes precedence when both are supplied.

FieldTypeRequiredDescription
AuthorizationheaderNoBearer bec_… — recommended.
x-api-keyheaderNobec_… — equivalent alternative.
Content-TypeheaderYesmultipart/form-data; let the HTTP client generate the boundary.

POST/api/ocr

Uploads 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

FieldTypeRequiredDescription
filebinaryYesOne PDF, JPG, JPEG or PNG bank or credit-card statement.
opening_balancestringNoPrinted opening balance supplied as recognition context.
closing_balancestringNoPrinted closing balance supplied as recognition context.
cURL · PDF
curl --request POST \
  --url https://bankexcelconverter.com/api/ocr \
  --header "Authorization: Bearer bec_YOUR_API_KEY" \
  --form "file=@statement.pdf"
cURL · image
curl --request POST \
  --url https://bankexcelconverter.com/api/ocr \
  --header "Authorization: Bearer bec_YOUR_API_KEY" \
  --form "file=@statement-page.png"

POST/api/convert

Converts 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

FieldTypeRequiredDescription
filebinaryYesThe source file.
input_formatenumYesPDF; JPG for JPG/JPEG/PNG images; or CSV, XLSX, OFX, QFX, QBO, QIF, IIF or XML.
output_formatenumYesCSV, XLSX, OFX, QFX, QBO, QIF, IIF, XML, TXT or PDF.

File response headers

FieldTypeRequiredDescription
Content-Typeheader—MIME type of the generated file.
Content-Dispositionheader—Sanitized attachment filename.
X-Transaction-Countheader—Number of transaction rows written.
X-Processing-Modeheader—ocr for PDF/image input; deterministic for structured file conversion without an AI request.
cURL · PDF to XLSX
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

OCR response

HTTP 200 returns JSON only when every selected page has been processed. Review recognized rows before import or posting.

Response

200 application/json
FieldTypeRequiredDescription
pagesPage[]—Recognized page number and page text.
requestedPagesinteger[]—Pages selected for processing.
processedPagesinteger[]—Successfully processed pages.
failedPagesinteger[]—Failed pages; empty on HTTP 200.
openingBalancestring | null—Recognized opening balance.
closingBalancestring | null—Recognized closing balance.
currencystring—Recognized currency code.
transactionsTransaction[]—Recognized rows requiring review.

Transaction fields

FieldTypeRequiredDescription
datestring—Recognized transaction date.
descriptionstring—Recognized description or payee.
amountstring—Signed decimal amount; withdrawals are negative.
debitstring—Debit value or empty string.
creditstring—Credit value or empty string.
balancestring—Running balance or empty string.
pageinteger—Source page number.
rawTextstring—Visible source line returned for review.
sourceBoundsnull—Reserved for source coordinates; unavailable in the current provider output.
confidencenull—Unavailable rather than estimated without evidence.
validationFlagsstring[]—Review and traceability flags; AI_REVIEW_REQUIRED is always present.
200 response
{
  "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"]
  }]
}

Errors

Every JSON error contains an error string. OCR failures include page-status arrays when available.

FieldTypeRequiredDescription
400Bad Request—Missing file or parameter, malformed multipart body, empty file, or matching input and output formats.
401Unauthorized—Missing, malformed, revoked, or unknown API key.
402Payment Required—Remaining paid pages are required. The daily 20 free pages cannot be used on the API.
405Method Not Allowed—Only POST is accepted.
413Payload Too Large—The request exceeds the current synchronous processing boundary.
415Unsupported Media Type—Wrong request content type or unsupported uploaded file format.
422Unprocessable Content—The file contains no usable rows, a page failed, or OCR returned no usable transactions.
502Bad Gateway—The OCR provider failed while processing the file.
503Service Unavailable—OCR or account storage is not configured.