> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fintelite.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bank Statement Analysis

> Automate bank statement OCR extraction, review transaction data, and run financial analytics with AnyCheck's BSA service.

## Overview

Bank Statement Analysis (BSA) is AnyCheck's most comprehensive verification service. It extracts and structures all transactions from uploaded bank statement PDFs or images using OCR, then provides a full suite of financial analytics: balance trends, merchant analysis, cash flow categorization, and more.

<CardGroup cols={2}>
  <Card title="Multi-file support" icon="files">
    Analyze multiple statements (different months or accounts) in a single verification.
  </Card>

  <Card title="Inspectable OCR results" icon="table">
    Read extracted headers and transaction rows programmatically to verify OCR output.
  </Card>

  <Card title="Rich analytics" icon="chart-line">
    Balance summary, running balances, merchant analysis, proforma financial statements.
  </Card>

  <Card title="Combine results" icon="code-merge">
    Merge multiple BSA results into a single unified view for multi-account analysis.
  </Card>
</CardGroup>

***

## BSA Workflow

<Steps>
  <Step title="Upload the statement file(s)">
    Upload the bank statement PDF or image using the file upload endpoint. You can upload multiple
    files and include passwords for password-protected PDFs.

    ```bash theme={null}
    curl -X POST https://api.anycheck.ai/uploads \
      -H "X-API-Key: YOUR_API_KEY" \
      -F "file_category=VERIFICATION_INPUT_FILE" \
      -F "files=@january.pdf" \
      -F "files=@february.pdf" \
      -F "file_passwords=pw1" \
      -F "file_passwords="
    ```

    Save the returned file paths to use in the next steps.
  </Step>

  <Step title="Create the BSA verification">
    Create a verification using the Bank Statement service ID. Pass the uploaded file paths
    in the `configuration` object.

    ```bash theme={null}
    curl -X POST https://api.anycheck.ai/verifications \
      -H "X-API-Key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "service_id": "<bsa-service-uuid>",
        "folder_id": "<folder-uuid>",
        "configuration": {
          "files": {
            "bsa_file": ["/uploads/january.pdf", "/uploads/february.pdf"]
          }
        },
        "webhook_url": "https://your-app.com/webhooks/anycheck"
      }'
    ```

    Processing is asynchronous. The verification starts in `IN_QUEUE` and transitions to
    `IN_PROGRESS` then `COMPLETED`.
  </Step>

  <Step title="Inspect headers and item lines">
    When the verification is `COMPLETED`, the OCR results are available.
    Inspect the extracted table structure before reading analytics.

    **Get headers** (column names recognized from the statement):

    ```bash theme={null}
    GET /bank-statements/{verification_id}/headers
    GET /bank-statements/{verification_id}/headers/{header_id}
    ```

    **Get item lines** (individual transaction rows for a header):

    ```bash theme={null}
    GET /bank-statements/{verification_id}/headers/{header_id}/item-lines
    ```
  </Step>

  <Step title="Read analytics">
    Once you're satisfied with the reviewed data, fetch the financial analytics.
    See [Analytics endpoints](#analytics-endpoints) below.
  </Step>
</Steps>

***

## Understanding OCR Results

### Headers

Headers represent the **column structure** recognized from the statement, for example: Date, Description, Debit, Credit, Balance. Each header has:

* `name`: the column label as read from the document
* `type`: the detected data type (`date`, `number`, `string`)
* `index`: the column's position in the table (0-based)

A single verification can have multiple headers if multiple statements were uploaded, each identified by `file_index`.

### Item Lines

Item lines are the **individual transaction rows**. Each line contains key-value pairs matching the header columns. Read item lines via `GET /bank-statements/{id}/headers/{header_id}/item-lines`.

### Confidence Levels

AnyCheck assigns a confidence level to each extracted page:

| Level    | Meaning                                |
| -------- | -------------------------------------- |
| `HIGH`   | OCR accuracy is high; data is reliable |
| `MEDIUM` | Some uncertainty; review recommended   |
| `LOW`    | Low confidence; manual review required |

Fetch the confidence breakdown:

```bash theme={null}
GET /bank-statements/{id}/confidence-summary
GET /bank-statements/{id}/confidence-summary/{level}/pages
```

***

## Analytics Endpoints

Once extraction is complete, the following analytics are available. All endpoints use the `verification_id` as the `{id}` path parameter.

<AccordionGroup>
  <Accordion title="Summary dashboard">
    A high-level overview of the statement: total credits, debits, average balance, and key financial indicators.

    ```bash theme={null}
    GET /bank-statements/{id}/summary
    ```
  </Accordion>

  <Accordion title="Currency overview">
    Breakdown of transactions by currency (useful for multi-currency accounts).

    ```bash theme={null}
    GET /bank-statements/{id}/currency-overview
    ```
  </Accordion>

  <Accordion title="Balance summary">
    Opening and closing balances, total inflows, total outflows, and net change.

    ```bash theme={null}
    GET /bank-statements/{id}/balance-summary
    ```
  </Accordion>

  <Accordion title="Running balances">
    The account balance at each transaction point, useful for visualizing balance trends over time.

    ```bash theme={null}
    GET /bank-statements/{id}/running-balances
    ```
  </Accordion>

  <Accordion title="Daily ending balances">
    The closing balance for each day covered by the statement, useful for day-by-day cash flow charts.

    ```bash theme={null}
    GET /bank-statements/{id}/daily-ending-balances
    ```
  </Accordion>

  <Accordion title="Transaction list">
    Full paginated list of all transactions with filtering and sorting. Get available columns first:

    ```bash theme={null}
    GET /bank-statements/{id}/transactions/columns
    POST /bank-statements/{id}/transactions
    # Body: { "page_offset": 0, "page_size": 50, "filters": { ... } }
    ```
  </Accordion>

  <Accordion title="Merchant analysis">
    Transactions grouped by merchant with total spend per merchant. Useful for expense categorization.

    ```bash theme={null}
    GET /bank-statements/{id}/merchant-analysis
    GET /bank-statements/{id}/merchant-transactions?merchant_name=...
    ```
  </Accordion>

  <Accordion title="Proforma financial statement">
    An estimated income/expense summary derived from transaction patterns. Useful when a formal
    financial statement is unavailable.

    ```bash theme={null}
    GET /bank-statements/{id}/proforma-financial-statement
    ```
  </Accordion>

  <Accordion title="Recast formula transactions">
    Transactions matched by your configured recast formula rules. Recast formulas allow custom
    classification of transactions according to your business logic (e.g., separating operating
    income from non-operating income).

    Configure rules via `GET /services/{service_id}/configurations/recast-formula-rules`.

    ```bash theme={null}
    GET /bank-statements/{id}/recast-formula-transactions
    ```
  </Accordion>
</AccordionGroup>

***

## Combining Multiple BSA Results

If you have statements from multiple bank accounts or time periods that you want to analyze together, combine them into a single unified view:

```bash theme={null}
curl -X POST https://api.anycheck.ai/bank-statements/combine \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bank_statements": [
      { "id": "<verification-uuid-1>", "file_index": 0 },
      { "id": "<verification-uuid-2>", "file_index": 0 },
      { "id": "<verification-uuid-2>", "file_index": 1 }
    ]
  }'
```

The response contains a `verification_id` you can use with all analytics endpoints.

***

## BSA vs. Financial Statement

|              | Bank Statement Analysis (BSA)           | Financial Statement                     |
| ------------ | --------------------------------------- | --------------------------------------- |
| **Input**    | Raw bank statement PDFs/images          | Financial reports (balance sheet, P\&L) |
| **Output**   | Structured transactions + analytics     | Extracted financial figures             |
| **Best for** | Cash flow analysis, income verification | Company financial health assessment     |
| **Editing**  | Full item-line editing supported        | Not applicable                          |

Use BSA when you need to verify income/cash flow from transaction history. Use Financial Statement when you need to assess a business's financial position from formal reports.
