# Bank Statement Converter - MT940, CAMT, OFX, QIF to JSON/CSV (`datanest-labs/bank-statement-converter`) Actor

Convert MT940/MT942, CAMT.052/053/054, OFX/QFX/QBO, QIF and BAI2 bank statement files into clean JSON, CSV or Excel. Auto-detects the format and checks every statement against its opening and closing balances.

- **URL**: https://apify.com/datanest-labs/bank-statement-converter.md
- **Developed by:** [Ergin Bekar](https://apify.com/datanest-labs) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 converted transactions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bank Statement Converter: MT940, CAMT.053, OFX, QIF, BAI2 to JSON, CSV & Excel

Convert bank statement files into clean, consistent transaction data in seconds. Upload or link **MT940 / MT942**, **CAMT.052 / CAMT.053 / CAMT.054** (ISO 20022 XML), **OFX / QFX / QBO**, **QIF** or **BAI2** files. You get one normalized table of transactions, ready to download as **JSON, CSV, Excel or XML** or to pull over the API.

Every statement is **reconciled against its own opening and closing balances**, so you know the conversion is complete and correct. You don't have to trust that the parser got it right.

### Why use this converter?

- **One tool, every common bank file format.** Banks hand out MT940 in Europe, CAMT.053 under ISO 20022, OFX/QFX/QBO in the US, QIF from Quicken and BAI2 for corporate treasury. This Actor reads all of them and turns them into the same output schema.
- **Auto-detection.** You don't need to know which format you have. Drop the file in.
- **Balance-verified.** For each statement it calculates opening balance + booked transactions and compares the result with the closing balance. Mismatches are flagged.
- **Bank-specific quirks handled.** It parses German `?20`–`?33` structured :86: fields (SEPA `EREF+`, `SVWZ+`, `KREF+`) and Dutch/Belgian `/NAME/ /IBAN/ /REMI/ /EREF/` slash fields. It supports MT940 reversals (RC/RD), OFX 1.x SGML without closing tags, OFX 2.x XML, CAMT v02–v08 party structures, QIF splits and BAI2 funds-type availability fields.
- **Private by design.** Files are processed in memory. Nothing is scraped and nothing is kept beyond your own Apify run storage.
- **Cheap and fast.** No browser and no proxy. Thousands of transactions convert in a few seconds.

### Who is it for?

- **Accountants and bookkeepers** who import client bank files into Xero, QuickBooks, Sage, Exact or Excel.
- **Fintech and SaaS developers** who need an MT940/CAMT/OFX parser API without maintaining one themselves.
- **Finance and treasury teams** who are moving from MT940 to CAMT.053 (the ISO 20022 migration) and need both formats in one model.
- **AI agents and automations** (Make, Zapier, n8n, Apify MCP) that categorize, audit or match bank transactions.

### How to use

1. Add your files in one of three ways: **Statement file URLs** (S3, Drive, Dropbox, any direct link), **Upload a file**, or **Paste file content**.
2. Keep **Input format** on *Auto-detect*.
3. Click **Start**, then export the results as CSV, Excel or JSON, or read them via the API.

If you leave the input empty, the Actor runs on built-in demo files so you can see the output first.

### Output

Each transaction is one row:

```json
{
  "date": "2024-01-02",
  "valueDate": "2024-01-02",
  "amount": 500,
  "currency": "EUR",
  "direction": "credit",
  "description": "Invoice 2024-001",
  "counterpartyName": "ACME BV",
  "counterpartyAccount": "NL20INGB0001234567",
  "counterpartyBic": "INGBNL2A",
  "reference": null,
  "endToEndId": "E2E-001",
  "bankReference": "BREF123",
  "transactionCode": "N541",
  "checkNumber": null,
  "category": null,
  "status": "booked",
  "isReversal": false,
  "accountId": "NL91ABNA0417164300",
  "iban": "NL91ABNA0417164300",
  "format": "MT940",
  "sourceFile": "https://example.com/statement.sta",
  "statementReconciliation": "balanced"
}
```

Amounts are **signed**: credits are positive and debits negative, whatever convention the source format uses.

The **OUTPUT** record in the key-value store holds a per-file and per-statement report. It includes the account, currency, period, opening and closing balances, total credits and debits, and the reconciliation result:

| status | meaning |
|---|---|
| `balanced` | opening + transactions = closing (to the cent) |
| `mismatch` | the totals do not add up; `difference` shows by how much |
| `closing_only` | the file only has a closing balance (typical for OFX); `impliedOpening` is calculated |
| `no_balances` | the format has no balances (QIF, CAMT.054 notifications) |

### Supported formats

| Format | Extensions | Notes |
|---|---|---|
| SWIFT MT940 / MT942 | .sta, .940, .mt940, .txt | with or without SWIFT {1:}{2:}{4:} envelopes, multiple statements per file |
| ISO 20022 CAMT.053 / 052 / 054 | .xml | camt.053.001.02 up to .08, booked and pending entries, batch entries |
| OFX / QFX / QBO | .ofx, .qfx, .qbo | OFX 1.x SGML and 2.x XML, bank and credit card statements |
| QIF | .qif | Bank, CCard and Cash types, splits, automatic US/EU date order |
| BAI2 | .bai, .bai2, .txt | 88 continuation records, funds-type fields, opening and closing ledger |

PDF bank statements are **not** in scope. This Actor converts structured bank export files.

### Pricing

You pay per converted transaction (one dataset row). Platform usage is included. Converting a typical monthly statement costs a few cents.

### FAQ

**Can I convert CAMT.053 to MT940 or MT940 to CAMT?** The output is a normalized JSON/CSV model that works for both. Write-back to MT940 or CAMT is on the roadmap. Open an issue if you need it.

**My bank's file fails or a field is missing.** Open an issue with a description of the layout or an anonymized sample. Never post real account data. Format fixes usually ship within days.

**Can I call it from code or an AI agent?** Yes. Use the Apify API (`run-sync-get-dataset-items`), the JS or Python client, or the Apify MCP server.

# Actor input Schema

## `fileUrls` (type: `array`):

Direct download links to statement files (MT940/.sta/.940, MT942, CAMT.052/053/054 XML, OFX/QFX/QBO, QIF, BAI2). Signed S3, Google Drive direct-download, Dropbox (?dl=1) and Apify key-value store links all work. Leave everything empty to run a demo on built-in sample files.

## `uploadedFile` (type: `string`):

Upload a single statement file directly from your computer.

## `fileContent` (type: `string`):

Alternatively paste the raw text of one statement file (MT940, CAMT XML, OFX, QIF or BAI2).

## `format` (type: `string`):

Leave on Auto-detect unless detection fails for an unusual file.

## `qifDateFormat` (type: `string`):

QIF files have no standard date order. Auto-detect looks for days above 12; set it explicitly if your file only has ambiguous dates.

## `defaultCurrency` (type: `string`):

ISO currency code (e.g. USD, EUR, GBP) applied when the file itself does not state a currency.

## Actor input object example

```json
{
  "format": "auto",
  "qifDateFormat": "auto"
}
```

# Actor output Schema

## `transactions` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("datanest-labs/bank-statement-converter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("datanest-labs/bank-statement-converter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call datanest-labs/bank-statement-converter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datanest-labs/bank-statement-converter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RspLprqpub7WIb1VZ/builds/Y6OaBeCGlGai4ov0H/openapi.json
