API Documentation
Reference for uploading, processing, and downloading a bank statement as Excel, programmatically.
API keys
You will create keys from your dashboard and call the endpoints below from your server. This page shows the API as it will work at launch.
Request early accessAuthentication
Send your API key in the Authorization header of every request. Keep it on your server, never in a browser or mobile app.
Authorization: Bearer <your_api_key>
Base URL
https://api.bayainy.com/api/v1
/upload/previewPreview before uploading
Classifies each page (digital or scanned) and calculates the exact page cost. Nothing is charged.
POST /upload/preview HTTP/1.1Authorization: Bearer <your_api_key>Content-Type: multipart/form-datafile: statement.pdf
Response
{"page_count": 3,"digital_pages": 2,"scanned_pages": 1,"credit_cost": 4,"pages": [{ "page": 1, "type": "digital" },{ "page": 2, "type": "digital" },{ "page": 3, "type": "scanned" }]}
/uploadUpload a statement
Upload a PDF to start extraction. The statement starts at status pending and moves through processing automatically.
POST /upload HTTP/1.1Authorization: Bearer <your_api_key>Content-Type: multipart/form-datafile: statement.pdf
Response
{"id": "550e8400-e29b-41d4-a716-446655440000","filename": "statement.pdf","status": "pending","page_count": 3,"estimated_seconds": 6}
/statements/{id}Get a statement and its transactions
Use this to find out when processing finishes, and to get the extracted transactions and balances back.
Note: Poll this endpoint every few seconds until status changes from processing to completed (or failed).
GET /statements/550e8400-e29b-41d4-a716-446655440000 HTTP/1.1Authorization: Bearer <your_api_key>
Response
{"id": "550e8400-e29b-41d4-a716-446655440000","status": "completed","bank_name": "Al Rajhi Bank","transaction_count": 42,"opening_balance": 12480.00,"closing_balance": 24755.00,"available_exports": ["excel", "csv", "qbo", "xml"],"transactions": [{"date": "2026-09-01","description": "Card purchase, Panda","debit": 184.50,"credit": 0.00,"balance": 12295.50,"category": "grocery","reference": "FT26244S1K7Q","page_number": 1}]}
Transaction fields
datestringTransaction date, YYYY-MM-DD.
descriptionstringWhat the transaction was, cleaned of reference numbers.
debitnumberMoney out. Always positive, 0 when none.
creditnumberMoney in. Always positive, 0 when none.
balancenumberRunning balance printed on that row. Negative when overdrawn.
categorystringSpending category, e.g. grocery, transfer, fuel.
referencestring | nullThe bank's own reference, when printed.
page_numberintegerThe PDF page the row came from.
/statementsList your statements
Returns every statement tied to your account, newest first.
GET /statements HTTP/1.1Authorization: Bearer <your_api_key>
Response
[{"id": "550e8400-e29b-41d4-a716-446655440000","filename": "statement.pdf","status": "completed","transaction_count": 42}]
/download/{id}/{format}Download the file
Only available once status is completed. The formats your plan includes are listed in available_exports.
excelcsvqboquickbooksxmlodoozohomt940camt053iifGET /download/550e8400-e29b-41d4-a716-446655440000/excel HTTP/1.1Authorization: Bearer <your_api_key>
Response
HTTP/1.1 200 OKContent-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet<binary .xlsx file>
/statements/{id}Delete a statement
Deletes the statement, its transactions and its files. This cannot be undone.
DELETE /statements/550e8400-e29b-41d4-a716-446655440000 HTTP/1.1Authorization: Bearer <your_api_key>
Response
HTTP/1.1 204 No Content
Possible status values
pendingReceived, about to start.
queuedWaiting for a free slot.
processingExtraction is running.
completedTransactions and files are ready.
failedCould not be processed. The reason is in error_message.
Questions about integrating?
Contact us