API Documentation

Complete reference for integrating Balanzio bank statement conversion API

Introduction

The Balanzio API allows you to convert bank statement PDFs to structured data formats (CSV, XLSX, JSON). Our API supports both text-based and image-based (scanned) PDFs with OCR processing.

Fast Processing

Text PDFs in seconds, OCR in <30s per page

Secure & GDPR Compliant

Automatic deletion after 24h

Multi-Bank Support

100+ banks supported

Authentication

All API requests require authentication using a Bearer token. Include your API key in the Authorization header:

HTTP
Authorization: Bearer YOUR_API_KEY
Keep your API key secret!

Never expose your API key in client-side code or commit it to version control.

Endpoints

Base URL

https://api.balanzio.app/api/v1

Upload Bank Statement

POST
/bank-statement

Upload one or multiple PDF files for processing. The API will automatically detect if the PDF is text-based or image-based (scanned).

Request Parameters

ParameterTypeRequiredDescription
filesfile[]YesPDF file(s) to process (max 3MB each)

Request Example

curl
curl -X POST https://api.balanzio.app/api/v1/bank-statement \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files=@statement.pdf"

Response (201 Created)

json
[
  {
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "filename": "statement.pdf",
    "pdfType": "TEXT_BASED",
    "state": "READY",
    "numberOfPages": 3
  }
]

Response Fields

FieldTypeDescription
uuidstringUnique identifier for the uploaded file
filenamestringOriginal filename
pdfTypestringTEXT_BASED or IMAGE_BASED
statestringREADY (text) or PROCESSING (OCR)
numberOfPagesnumberTotal pages in the PDF

Check Processing Status

POST
/bank-statement/status

Check the processing status of uploaded files. Use this endpoint to poll for OCR completion.

Request Example

curl
curl -X POST https://api.balanzio.app/api/v1/bank-statement/status \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uuids": ["550e8400-e29b-41d4-a716-446655440000"]
  }'

Response (200 OK)

json
[
  {
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "filename": "statement.pdf",
    "pdfType": "IMAGE_BASED",
    "state": "COMPLETED",
    "numberOfPages": 3,
    "progress": 100
  }
]

Convert to Format

POST
/bank-statement/convert

Convert processed statements to CSV, XLSX, or JSON format.

Query Parameters

ParameterTypeRequiredDescription
formatstringYesCSV, XLSX, or JSON

Request Example (CSV)

curl
curl -X POST "https://api.balanzio.app/api/v1/bank-statement/convert?format=CSV" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "550e8400-e29b-41d4-a716-446655440000"
  }' \
  -o statement.csv

Request Example (JSON)

curl
curl -X POST "https://api.balanzio.app/api/v1/bank-statement/convert?format=JSON" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "550e8400-e29b-41d4-a716-446655440000"
  }'

Response (JSON format)

json
{
  "transactions": [
    {
      "date": "2024-01-15",
      "description": "VIREMENT SALAIRE",
      "amount": 3500.00,
      "balance": 4250.50,
      "currency": "EUR"
    },
    {
      "date": "2024-01-16",
      "description": "CARTE 12/01 SUPERMARCHE",
      "amount": -85.30,
      "balance": 4165.20,
      "currency": "EUR"
    }
  ],
  "metadata": {
    "bank": "BNP Paribas",
    "accountNumber": "****1234",
    "statementPeriod": "2024-01"
  },
  "warnings": []
}

Set PDF Password

POST
/bank-statement/set-password

Provide password for password-protected PDFs.

Request Example

curl
curl -X POST https://api.balanzio.app/api/v1/bank-statement/set-password \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "password": "mySecretPassword123"
  }'

Response (200 OK)

json
{
  "uuid": "550e8400-e29b-41d4-a716-446655440000",
  "state": "READY",
  "passwordSet": true
}

Get User Info

GET
/user

Retrieve current user information, including credits and plan details.

Request Example

curl
curl -X GET https://api.balanzio.app/api/v1/user \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (200 OK)

json
{
  "user": {
    "userId": 123,
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "emailVerified": true,
    "referralCode": "ABC123"
  },
  "credits": {
    "paidCredits": 1000,
    "freeCredits": 50
  },
  "unlimitedCredits": false,
  "subscriptionCount": 1,
  "plan": "pro",
  "saveConvertedFiles": false,
  "hasPaymentMethod": true
}

Error Codes

All errors return a JSON response with an error code and message:

json
{
  "error": "INVALID_FILE_TYPE",
  "message": "Only PDF files are accepted",
  "recovery": "Please upload a PDF file"
}
StatusError CodeDescription
400
INVALID_FILE_TYPEFile is not a PDF
400
INVALID_FORMATInvalid format parameter (must be CSV, XLSX, or JSON)
401
UNAUTHORIZEDInvalid or missing API key
403
INSUFFICIENT_CREDITSNot enough credits to process file
404
FILE_NOT_FOUNDFile UUID not found
413
FILE_TOO_LARGEFile exceeds 3MB limit
422
PASSWORD_REQUIREDPDF is password-protected
422
INVALID_PASSWORDIncorrect PDF password
429
RATE_LIMIT_EXCEEDEDToo many requests
500
INTERNAL_ERRORServer error, please retry

Rate Limits

Anonymous Users

• 10 requests per minute

• 1 page per day

• No concurrent uploads

Authenticated Users

• 60 requests per minute

• Credit-based (plan dependent)

• Up to 5 concurrent uploads

Rate limit headers: All responses include X-RateLimit-Limit,X-RateLimit-Remaining, and X-RateLimit-Reset headers.

Complete Code Examples

Python

python
import requests
import time

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.balanzio.app/api/v1"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

# 1. Upload PDF
with open("statement.pdf", "rb") as f:
    files = {"files": f}
    response = requests.post(
        f"{BASE_URL}/bank-statement",
        headers=HEADERS,
        files=files
    )
    data = response.json()
    file_uuid = data[0]["uuid"]
    pdf_type = data[0]["pdfType"]
    print(f"Uploaded: {file_uuid} ({pdf_type})")

# 2. Poll status if OCR is needed
if pdf_type == "IMAGE_BASED":
    while True:
        response = requests.post(
            f"{BASE_URL}/bank-statement/status",
            headers=HEADERS,
            json={"uuids": [file_uuid]}
        )
        status = response.json()[0]
        if status["state"] == "COMPLETED":
            print("Processing complete!")
            break
        elif status["state"] == "ERROR":
            print("Processing failed:", status.get("error"))
            break
        print(f"Progress: {status.get('progress', 0)}%")
        time.sleep(3)

# 3. Convert to JSON
response = requests.post(
    f"{BASE_URL}/bank-statement/convert",
    headers=HEADERS,
    params={"format": "JSON"},
    json={"uuid": file_uuid}
)

transactions = response.json()
print(f"Found {len(transactions['transactions'])} transactions")
for txn in transactions["transactions"]:
    print(f"{txn['date']}: {txn['description']} - {txn['amount']} {txn['currency']}")

Node.js

javascript
const FormData = require('form-data');
const fs = require('fs');
const fetch = require('node-fetch');

const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.balanzio.app/api/v1';
const HEADERS = { 'Authorization': `Bearer ${API_KEY}` };

async function convertBankStatement() {
  // 1. Upload PDF
  const form = new FormData();
  form.append('files', fs.createReadStream('statement.pdf'));

  let response = await fetch(`${BASE_URL}/bank-statement`, {
    method: 'POST',
    headers: HEADERS,
    body: form
  });

  const uploadData = await response.json();
  const fileUuid = uploadData[0].uuid;
  const pdfType = uploadData[0].pdfType;
  console.log(`Uploaded: ${fileUuid} (${pdfType})`);

  // 2. Poll status if OCR needed
  if (pdfType === 'IMAGE_BASED') {
    let completed = false;
    while (!completed) {
      response = await fetch(`${BASE_URL}/bank-statement/status`, {
        method: 'POST',
        headers: { ...HEADERS, 'Content-Type': 'application/json' },
        body: JSON.stringify({ uuids: [fileUuid] })
      });

      const statusData = await response.json();
      const status = statusData[0];

      if (status.state === 'COMPLETED') {
        console.log('Processing complete!');
        completed = true;
      } else if (status.state === 'ERROR') {
        throw new Error(`Processing failed: ${status.error}`);
      } else {
        console.log(`Progress: ${status.progress || 0}%`);
        await new Promise(resolve => setTimeout(resolve, 3000));
      }
    }
  }

  // 3. Convert to JSON
  response = await fetch(
    `${BASE_URL}/bank-statement/convert?format=JSON`,
    {
      method: 'POST',
      headers: { ...HEADERS, 'Content-Type': 'application/json' },
      body: JSON.stringify({ uuid: fileUuid })
    }
  );

  const transactions = await response.json();
  console.log(`Found ${transactions.transactions.length} transactions`);

  transactions.transactions.forEach(txn => {
    console.log(`${txn.date}: ${txn.description} - ${txn.amount} ${txn.currency}`);
  });
}

convertBankStatement().catch(console.error);

PHP

php
<?php

$apiKey = 'YOUR_API_KEY';
$baseUrl = 'https://api.balanzio.app/api/v1';

// 1. Upload PDF
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$baseUrl/bank-statement");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $apiKey"
]);

$file = new CURLFile('statement.pdf', 'application/pdf', 'statement.pdf');
curl_setopt($ch, CURLOPT_POSTFIELDS, ['files' => $file]);

$response = curl_exec($ch);
$data = json_decode($response, true);
$fileUuid = $data[0]['uuid'];
$pdfType = $data[0]['pdfType'];

echo "Uploaded: $fileUuid ($pdfType)\n";

// 2. Poll status if OCR needed
if ($pdfType === 'IMAGE_BASED') {
    do {
        sleep(3);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "$baseUrl/bank-statement/status");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
            "Authorization: Bearer $apiKey",
            "Content-Type: application/json"
        ]);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
            'uuids' => [$fileUuid]
        ]));

        $response = curl_exec($ch);
        $statusData = json_decode($response, true);
        $status = $statusData[0];

        echo "Progress: " . ($status['progress'] ?? 0) . "%\n";
    } while ($status['state'] !== 'COMPLETED' && $status['state'] !== 'ERROR');

    echo "Processing complete!\n";
}

// 3. Convert to JSON
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$baseUrl/bank-statement/convert?format=JSON");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'uuid' => $fileUuid
]));

$response = curl_exec($ch);
$transactions = json_decode($response, true);

echo "Found " . count($transactions['transactions']) . " transactions\n";

foreach ($transactions['transactions'] as $txn) {
    echo "{$txn['date']}: {$txn['description']} - {$txn['amount']} {$txn['currency']}\n";
}

curl_close($ch);
?>

Need Help?

Support

Our support team is here to help you integrate successfully.

Postman Collection

Download our Postman collection to test all endpoints easily.