# Bank 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 statement rows as transactions. Each row becomes a LedgerEvent with status needs_review. Use checkBankStatementDups first to detect duplicates.

## Check Bank Statement Duplicates

Check rows against existing transactions before importing. Returns per-row duplicate flags. Full match = same date + amount + vendor. Possible match = same date + amount, different vendor.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `UUID!` | Yes | Organization ID |
| `paymentAccountId` | `UUID!` | Yes | Bank or credit card account to check against |
| `rows` | `[BankStatementRowInput!]!` | Yes | Array of statement rows to check. Each row: transactionDate (String!), description (String!), amount (String!), eventType (String!), memo (String), reference (String) |

### Request

```graphql
mutation {
  checkBankStatementDups(
    organizationId: "a1b2c3d4-..."
    paymentAccountId: "chequing-uuid"
    rows: [
      {
        transactionDate: "2025-03-01"
        description: "SHOPIFY *MAPLE ROASTERS"
        amount: "149.50"
        eventType: "expense"
      },
      {
        transactionDate: "2025-03-02"
        description: "TIM HORTONS #4821"
        amount: "11.30"
        eventType: "expense"
        memo: "Team coffee run"
      }
    ]
  ) {
    results {
      rowIndex
      isDuplicate
      isPossibleDuplicate
      matchingEventId
    }
    success
  }
}
```

### Response

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

## Import Bank Statement

Imports bank statement rows as LedgerEvents attached to a payment account. Each row is created with status needs_review. Rows that exactly match existing transactions (same date, amount, and vendor) are skipped automatically.

### Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `organizationId` | `UUID!` | Yes | Organization ID |
| `paymentAccountId` | `UUID!` | Yes | Bank or credit card account to import into |
| `currency` | `String` | No | ISO 4217 currency code (default "CAD") |
| `rows` | `[BankStatementRowInput!]!` | Yes | Array of statement rows. Each row: transactionDate (String!), description (String!), amount (String!), eventType (String!), memo (String), reference (String) |

### Request

```graphql
mutation {
  importBankStatement(
    organizationId: "a1b2c3d4-..."
    paymentAccountId: "chequing-uuid"
    currency: "CAD"
    rows: [
      {
        transactionDate: "2025-03-01"
        description: "SHOPIFY *MAPLE ROASTERS"
        amount: "149.50"
        eventType: "expense"
        reference: "TXN-20250301-001"
      },
      {
        transactionDate: "2025-03-01"
        description: "E-TRANSFER FROM CLAIRE DUBOIS"
        amount: "2500.00"
        eventType: "income"
        memo: "Invoice #1042 payment"
      },
      {
        transactionDate: "2025-03-03"
        description: "CANADA POST CORP"
        amount: "18.75"
        eventType: "expense"
        memo: "Shipping label — order #887"
        reference: "CP-88712345"
      }
    ]
  ) {
    importedCount
    skippedCount
    success
    error
  }
}
```

### Response

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