Monetize360
WorkflowsFunctionsSystem Functions

Parse Bank Statement

Parse bank statements and other financial documents from PDF, XML, EDI, and Excel formats

Parse Bank Statement

Parse bank statements and other financial documents from various file formats. The function automatically detects file type, selects the appropriate parser, and extracts account information, transactions, and fee details.

Technical Name: ParseStatementFunc

Properties

  • Execution Mode: SYNC
  • Type: NATIVE
  • Category: System Functions
  • Function ID: 66e31772-bde2-4a8f-801d-c215b5cdc321

Input Schema

Required Parameters

ParameterTypeDescription
fileIdstring (uuid)UUID of the uploaded file to parse (must exist in file storage)

Optional Parameters

ParameterTypeDescription
bankNamestringName of the bank for statement identification and parser selection
parserNamestringSpecific parser bean name to use (e.g., "chaseBankParser")
parserPatternIdstring (uuid)UUID of a parser pattern configuration to use for pattern-based parsing
currencystringCurrency code to use (e.g., "USD", "EUR")
countrystringCountry alpha-2 code (e.g., "US", "GB")
usePatternParserbooleanForce use of pattern-based parser instead of bank-specific parsers

[Image placeholder: ParseStatement function configuration panel]

Input Example

Basic Parsing

{
  "fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d"
}

With Bank Name

{
  "fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
  "bankName": "Chase Bank",
  "currency": "USD",
  "country": "US"
}

Using Specific Parser

{
  "fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
  "parserName": "chaseBankParser"
}

Using Pattern-Based Parser

{
  "fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
  "parserPatternId": "pattern-uuid-here",
  "usePatternParser": true
}

Supported File Types

  • PDF (application/pdf) - Bank statement PDFs
  • XML (application/xml, text/xml) - CAMT.053, ISO 20022 formats
  • EDI (.edi) - Electronic Data Interchange formats
  • Excel (.xlsx, .xls) - Spreadsheet-based statements

Output Schema

FieldTypeDescription
statementGroupobjectGroup information about the parsed statement (metadata)
statementAccountsarrayAccount information including balances and account details
statementServicesarrayService/transaction details including fees and charges

The output structure contains:

  • Statement Metadata: Bank name, account numbers, statement period, currency
  • Account Balances: Opening/closing balances, ledger balances
  • Activity Details: Transactions, service charges, fees
  • Conversion Rates: Exchange rates if applicable
  • Tax Details: Tax information if present

Output Example

{
  "statementGroup": {
    "bankName": "Chase Bank",
    "fileName": "statement_2024_01.pdf",
    "statementFrom": "2024-01-01",
    "statementTo": "2024-01-31",
    "duplicate": false
  },
  "statementAccounts": [
    {
      "accountNumber": "1234567890",
      "accountType": "DETAIL",
      "openingBalance": 10000.00,
      "closingBalance": 9500.00,
      "currency": "USD"
    }
  ],
  "statementServices": [
    {
      "serviceDescription": "Wire Transfer",
      "unitPrice": 25.00,
      "volume": 5,
      "totalCharges": 125.00,
      "accountNumber": "1234567890"
    }
  ]
}

[Image placeholder: Parsed statement visualization]

How It Works

  1. File Type Detection: Automatically detects file type (PDF, XML, EDI, Excel)
  2. Parser Selection:
    • If parserName provided: Uses specified parser
    • If parserPatternId or usePatternParser=true: Uses pattern-based generic parser
    • If bankName provided: Attempts to find bank-specific parser or pattern
    • Otherwise: Tries all available parsers until one succeeds
  3. Parsing: Extracts statement data based on file format
  4. Data Enrichment:
    • Resolves bank metadata
    • Populates currency and country information
    • Validates account numbers
    • Checks for duplicate statements
  5. Output: Returns structured statement data

Use Cases

Parse Uploaded Statement

Parse a bank statement uploaded by a user:

{
  "fileId": "{{context.uploadedFileId}}",
  "bankName": "Wells Fargo",
  "currency": "USD"
}

Process Multiple Statements

Parse multiple statements in a workflow:

Start → UploadFile → ParseStatement → ProcessFees → End

Use Pattern-Based Parsing

Parse statements using a custom parser pattern:

{
  "fileId": "file-uuid",
  "parserPatternId": "custom-pattern-uuid",
  "usePatternParser": true
}

[Image placeholder: Workflow examples]

Parser Selection Strategy

The function uses the following strategy to select a parser:

  1. Explicit Parser: If parserName is provided, uses that parser
  2. Pattern Parser: If parserPatternId or usePatternParser=true, uses pattern-based parser
  3. Bank-Specific: If bankName is provided, searches for bank-specific parser or pattern
  4. Fallback: Tries all available parsers sequentially until one succeeds
  5. Generic Parser: Falls back to generic PDF parser if all specific parsers fail

Error Handling

File Not Found

{
  "error": "File not found with ID: invalid-uuid"
}

Unsupported File Type

{
  "error": "Unsupported file type: image/jpeg"
}

Bank Not Found

{
  "error": "No bank metadata found for bank: Unknown Bank"
}

Best Practices

  1. Provide bankName when known to improve parser selection accuracy
  2. Use parserPatternId for custom statement formats
  3. Set currency and country for proper data enrichment
  4. Handle duplicate detection - check duplicate flag in output
  5. Validate parsed data before processing further