API-Dokumentation

Vollständige Referenz für die Integration der Balanzio Kontoauszugskonvertierungs-API

Einführung

Die Balanzio-API ermöglicht es Ihnen, PDF-Kontoauszüge in strukturierte Datenformate (CSV, XLSX, JSON) zu konvertieren. Unsere API unterstützt sowohl textbasierte als auch bildbasierte (gescannte) PDFs mit OCR-Verarbeitung.

Schnelle Verarbeitung

Text-PDFs in Sekunden, OCR in <30s pro Seite

Sicher & DSGVO-konform

Automatische Löschung nach 24h

Multi-Bank-Unterstützung

100+ unterstützte Banken

Authentifizierung

Alle API-Anfragen erfordern Authentifizierung mit einem Bearer-Token. Fügen Sie Ihren API-Schlüssel im Authorization-Header ein:

HTTP
Authorization: Bearer YOUR_API_KEY
Halten Sie Ihren API-Schlüssel geheim!

Veröffentlichen Sie Ihren API-Schlüssel niemals in clientseitigem Code oder committen Sie ihn in eine Versionsverwaltung.

Endpunkte

Basis-URL

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

Kontoauszug hochladen

POST
/bank-statement

Laden Sie eine oder mehrere PDF-Dateien zur Verarbeitung hoch. Die API erkennt automatisch, ob das PDF textbasiert oder bildbasiert (gescannt) ist.

Anfrageparameter

ParameterTypErforderlichBeschreibung
filesfile[]JaZu verarbeitende PDF-Datei(en) (max 3MB pro Datei)

Anfragebeispiel

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

Antwort (201 Created)

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

Antwortfelder

FeldTypBeschreibung
uuidstringEindeutige Kennung für die hochgeladene Datei
filenamestringOriginal-Dateiname
pdfTypestringTEXT_BASED oder IMAGE_BASED
statestringREADY (Text) oder PROCESSING (OCR)
numberOfPagesnumberGesamtanzahl der Seiten im PDF

Verarbeitungsstatus prüfen

POST
/bank-statement/status

Überprüfen Sie den Verarbeitungsstatus hochgeladener Dateien. Verwenden Sie diesen Endpunkt zum Abfragen der OCR-Fertigstellung.

Anfragebeispiel

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"]
  }'

Antwort (200 OK)

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

In Format konvertieren

POST
/bank-statement/convert

Verarbeitete Kontoauszüge in CSV-, XLSX- oder JSON-Format konvertieren.

Query-Parameter

ParameterTypErforderlichBeschreibung
formatstringJaCSV, XLSX oder JSON

Anfragebeispiel (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

Anfragebeispiel (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"
  }'

Antwort (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": []
}

PDF-Passwort setzen

POST
/bank-statement/set-password

Passwort für passwortgeschützte PDFs angeben.

Anfragebeispiel

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"
  }'

Antwort (200 OK)

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

Benutzerinformationen abrufen

GET
/user

Aktuelle Benutzerinformationen abrufen, einschließlich Credits und Tarifdetails.

Anfragebeispiel

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

Antwort (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
}

Fehlercodes

Alle Fehler geben eine JSON-Antwort mit einem Fehlercode und einer Nachricht zurück:

json
{
  "error": "INVALID_FILE_TYPE",
  "message": "Only PDF files are accepted",
  "recovery": "Please upload a PDF file"
}
StatusFehlercodeBeschreibung
400
INVALID_FILE_TYPEDatei ist kein PDF
400
INVALID_FORMATUngültiger Format-Parameter (muss CSV, XLSX oder JSON sein)
401
UNAUTHORIZEDUngültiger oder fehlender API-Schlüssel
403
INSUFFICIENT_CREDITSNicht genügend Credits zur Verarbeitung der Datei
404
FILE_NOT_FOUNDDatei-UUID nicht gefunden
413
FILE_TOO_LARGEDatei überschreitet 3MB-Limit
422
PASSWORD_REQUIREDPDF ist passwortgeschützt
422
INVALID_PASSWORDFalsches PDF-Passwort
429
RATE_LIMIT_EXCEEDEDZu viele Anfragen
500
INTERNAL_ERRORServerfehler, bitte erneut versuchen

Rate-Limits

Anonyme Nutzer

10 Anfragen pro Minute

1 Seite pro Tag

Keine gleichzeitigen Uploads

Authentifizierte Nutzer

60 Anfragen pro Minute

Credit-basiert (tarifabhängig)

Bis zu 5 gleichzeitige Uploads

Rate-Limit-Header: Alle Antworten enthalten X-RateLimit-Limit, X-RateLimit-Remaining und X-RateLimit-Reset Header.

Vollständige Code-Beispiele

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);
?>

Benötigen Sie Hilfe?

Support

Unser Support-Team hilft Ihnen bei einer erfolgreichen Integration.

Postman-Collection

Laden Sie unsere Postman-Collection herunter, um alle Endpunkte einfach zu testen.