# Mask Account Numbers in BAI2 & OFX Statements for AI Agents

**Use case:** 

Sanitize BAI2 and OFX/QFX bank or card statements with last-4 account masking (******4300) and exact Decimal control-total verification before feeding financial records into LLM bookkeeping or external audit agents.

## Input

```json
{
  "format_mode": "auto_detect",
  "statements": [
    "01,021000021,ACMETREASURY,261123,2359,0001,80,1,2/\n02,ACMETREASURY,021000021,1,261123,2359,USD,2/\n03,8800194300,USD,010,25000000,,,015,26425050,,,100,1850050,2,,400,425000,2,/\n16,195,1500000,0,FED20261123001,INV-2026-8801,INCOMING FEDWIRE FROM GLOBAL RETAIL CORP/\n88,ORIG: GLOBAL RETAIL CORP OBI: ENTERPRISE LICENSE Q4/\n16,115,350050,0,LBX2026112309,LOCKBOX-4412,LOCKBOX BATCH DEPOSIT CHICAGO/\n16,455,175000,0,ACH2026112377,AWS-NOV-2026,PREAUTHORIZED ACH DEBIT CLOUD INFRA/\n16,475,250000,0,CHK00009841,9841,CHECK PAID VENDOR SETTLEMENT/\n49,55975150,7/\n98,55975150,1,9/\n99,55975150,1,11/"
  ],
  "strict_control_totals": true,
  "include_camt053_xml": false,
  "mask_account_numbers": true,
  "max_items": 25
}
```

## Output

```json
{
  "record_id": {
    "label": "Statement ID",
    "format": "string"
  },
  "source_format": {
    "label": "Format",
    "format": "string"
  },
  "account_id": {
    "label": "Account",
    "format": "string"
  },
  "currency": {
    "label": "CCY",
    "format": "string"
  },
  "as_of_date": {
    "label": "As-Of Date",
    "format": "string"
  },
  "validation_status": {
    "label": "Audit Status",
    "format": "string"
  },
  "is_compliant": {
    "label": "Compliant?",
    "format": "boolean"
  },
  "opening_ledger_balance": {
    "label": "Opening Bal",
    "format": "number"
  },
  "total_credits": {
    "label": "Total Credits",
    "format": "number"
  },
  "total_debits": {
    "label": "Total Debits",
    "format": "number"
  },
  "closing_ledger_balance": {
    "label": "Closing Bal",
    "format": "number"
  },
  "transaction_count": {
    "label": "Tx Count",
    "format": "integer"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The BAI2 & OFX/QFX Bank Statement to JSON & camt.053 Bridge Actor is ready to run with the inputs already set for "Mask Account Numbers in BAI2 & OFX Statements for AI Agents". [Sign up or log in](https://console.apify.com/create-task-from-example/4YziYCs8gn2bepxYT) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Mask Account Numbers in BAI2 & OFX Statements for AI Agents" task

The BAI2 & OFX/QFX Bank Statement to JSON & camt.053 Bridge Actor will start running based on the input automatically. You can also change all the input fields, like statement format detection mode, raw bai2 or ofx / qfx statement payloads, and more, to match your specific use case.

### 3. Receive the "Mask Account Numbers in BAI2 & OFX Statements for AI Agents" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as statement id, format, account, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Mask Account Numbers in BAI2 & OFX Statements for AI Agents" task via API](https://apify.com/bifrost-data/bai2-ofx-bank-statement-bridge.md).

## FAQ

### How does mask_account_numbers protect sensitive treasury identifiers?

Account and card numbers are masked in-memory so only the trailing 4 digits appear in both the JSON dataset and optional camt.053 XML output.

### Why run this deterministic parser before an LLM financial agent?

LLMs hallucinate on implied-decimal BAI2 integers and unclosed OFX SGML tags. Deterministic parsing guarantees 100% exact balances and control-total audits first.

### Does this Actor support Apify LIMITED_PERMISSIONS for autonomous AI agents?

Yes. It runs under strict LIMITED_PERMISSIONS with zero external network access, making it safe for autonomous MCP and x402 agent pipelines.

## About this Actor

This example demonstrates how to use [BAI2 & OFX/QFX Bank Statement to JSON & camt.053 Bridge](https://apify.com/bifrost-data/bai2-ofx-bank-statement-bridge.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/bifrost-data/bai2-ofx-bank-statement-bridge.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/bifrost-data/bai2-ofx-bank-statement-bridge.md

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`).
