Overview

The Bank Statement model (BANK_STATEMENT) is designed to extract and structure information from US bank statements. It captures key details including bank information, account holder details, account balances, transactions, and checks.

Model Details

  • Model ID: BANK_STATEMENT
  • Supported Locales: en-US
  • Version: GA
  • Release Date: November 30, 2024

Schema Structure

The Bank Statement model extracts the following information:

Root Level Fields

FieldTypeDescription
BankNamestringListed name of the bank
AccountHolderNamestringName of the account holder
AccountHolderAddressstringAddress of the account holder
StatementStartDatestring (ISO date)Start date of the bank statement
StatementEndDatestring (ISO date)End date of the bank statement
AccountsAccount[]Array of accounts on the statement

Account Fields

Each account in the Accounts array contains:

FieldTypeDescription
AccountNumberstringAccount number on the bank statement
AccountTypestringType of account (e.g., “Checking”, “Savings”)
EndingBalancenumberEnding balance for the statement period
TransactionsTransaction[]Array of transactions

Transaction Fields

Each transaction in the Transactions array contains:

FieldTypeDescription
Datestring (ISO date)Transaction date
DescriptionstringTransaction description
DepositAmountnumber | undefinedAmount of deposit
WithdrawalAmountnumber | undefinedAmount of withdrawal

Example Usage

import { createJob } from '@your-package/api';

// Create a job for processing bank statements
const job = await createJob({
  model: 'BANK_STATEMENT',
  files: [/* your files */]
});

// Example response structure
const statementData = {
  bankAddress: '123 Main St, Redmond, WA 98052',
  bankName: 'Contoso Bank',
  accountHolderAddress: '456 Main St, Redmond, WA 98052',
  accountHolderName: 'JOHN DOE',
  statementStartDate: '2024-01-01T00:00:00.000Z',
  statementEndDate: '2024-01-31T00:00:00.000Z',
  accounts: [
    {
      accountNumber: '987-654-3210',
      accountType: 'Checking',
      beginningBalance: 1488.03,
      endingBalance: 1488.03,
      totalServiceFees: 0.0,
      transactions: [
        {
          date: '2024-01-17T00:00:00.000Z',
          description: 'OnlineTransfer From Chk...6609 Transaction#: 6373187418',
          checkNumber: '6609',
          depositAmount: 1500.0
        }
      ],
      checks: [
        {
          number: '7175',
          date: '2024-01-11T00:00:00.000Z',
          amount: 150.0
        }
      ]
    }
  ]
};

## Date Handling

The model accepts dates in two formats:

- ISO 8601 datetime strings
- YYYY-MM-DD format strings

All dates are automatically converted to ISO format during processing.

## Type Definitions

You can import the following TypeScript types for use in your application:

```typescript
import type {
  Document,
  DocumentTypeBase
} from '@your-package/models';

type BankStatement = Document<'BANK_STATEMENT'>;

Field Validation Rules

  • All monetary amounts (balances, transaction amounts) must be non-negative numbers
  • Account numbers and check numbers are stored as strings to preserve leading zeros
  • Service fees default to 0 if not specified
  • Check numbers in transactions are normalized to undefined if null or empty
  • Transactions must have either a deposit amount or withdrawal amount (or neither), but not both