# Venn / Bank CSV Import

> Solarium docs. All requests are `POST https://api.trysolarium.com/graphql/` with `Authorization: Bearer <api key>` and a JSON body `{"query": ..., "variables": ...}`. Every query and mutation takes an `organizationId` (find it with `myOrganizations`). Index of all pages: https://trysolarium.com/llms.txt

Import bank transaction CSVs (Venn, TD, or any bank) into Solarium as transactions via the **importBankStatement** API or the CSV import page in the admin UI.

The CSV import flow:
1. Upload CSV on the Import page
2. Map columns (date, description, amount)
3. Select payment account
4. Preview rows with duplicate detection
5. Import — each row becomes a LedgerEvent with `needs_review` status

| Transaction Type | Event Type |
|---|---|
| Card payments (expenses) | expense |
| Loads / funding | transfer |
| Interest / cashback | income |

Duplicate detection runs automatically: exact matches (same date + amount + vendor) are flagged as duplicates, partial matches (same date + amount, different vendor) as possible duplicates.

## CSV Import via API

Use the importBankStatement mutation to import rows programmatically.

### Request

```graphql
mutation {
  importBankStatement(
    organizationId: "a1b2c3d4-..."
    paymentAccountId: "bank-account-uuid"
    currency: "CAD"
    rows: [
      {
        transactionDate: "2026-06-19"
        description: "MVC INC."
        amount: "-23.55"
        eventType: "expense"
      },
      {
        transactionDate: "2026-06-13"
        description: "Account Funding"
        amount: "500.00"
        eventType: "income"
      }
    ]
  ) {
    importedCount
    skippedCount
    success
    error
  }
}
```

### Response

```json
{
  "data": {
    "importBankStatement": {
      "importedCount": 2,
      "skippedCount": 0,
      "success": true,
      "error": null
    }
  }
}
```

## Check Duplicates Before Import

Run checkBankStatementDups first to detect duplicates. Returns per-row flags so you can skip or override.

### Request

```graphql
mutation {
  checkBankStatementDups(
    organizationId: "a1b2c3d4-..."
    paymentAccountId: "bank-account-uuid"
    rows: [
      {
        transactionDate: "2026-06-19"
        description: "MVC INC."
        amount: "23.55"
        eventType: "expense"
      }
    ]
  ) {
    results {
      rowIndex
      isDuplicate
      isPossibleDuplicate
      matchingEventId
    }
    success
  }
}
```

### Response

```json
{
  "data": {
    "checkBankStatementDups": {
      "results": [
        {
          "rowIndex": 0,
          "isDuplicate": true,
          "isPossibleDuplicate": false,
          "matchingEventId": "e5f6g7h8-..."
        }
      ],
      "success": true
    }
  }
}
```
