---
title: "Preview a bank-statement CSV import (no write)"
method: POST
path: "/accountant/companies/{customerId}/transactions/import/preview"
tags: ["Accountant Portal", "Transactions"]
---

# Preview a bank-statement CSV import (no write)

`POST /accountant/companies/{customerId}/transactions/import/preview`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/companies/{customerId}/transactions/import/preview`
- Auth: HTTP bearer

PG-p08-017. The same body as the import, decided row by row by the same code, with nothing written. `new` imports (two equal same-day rows both import; the second is left in review for a person, BK-107). `bill_payment` imports and names the open bill of exactly that amount the bank row would pay (the match is made after import). `suspected_duplicate` has no bank id and looks like a row already booked from a feed or another file: it is booked for a person to decide, never dropped. `already_booked` repeats a booked row (its bank id, or the same file again) and is skipped. `counts.toImport` counts new rows and bill payments. People only: the service token is refused.

## Path parameters

- `customerId` string, uuid, required

## Request body

- ImportTransactionsCsvInput
  - `accountId` string, uuid, required: The "deposit to" account rows will post against. May be an integration_account id (Mercury/Ramp/Plaid), a bank_account id (legacy/manual), or a gl_account id (direct Chart-of-Accounts selection, e.g. Undeposited Funds); resolved server-side to a concrete GL account.
  - `entityId` string, uuid: Concrete legal entity that owns the import. Required for direct GL-account imports; when the selected account is connected, this value must match its immutable entity owner.
  - `rows` TransactionImportRow[], required
    - `rowNumber` integer: 1-based row position in the source CSV, echoed back in results
    - `occurredOn` string, nullable: Posting date (YYYY-MM-DD)
    - `description` string, nullable
    - `amountCents` integer, nullable: Positive amount in cents; `direction` carries the sign
    - `direction` 'in' | 'out' | 'null', nullable
    - `merchant` string, nullable
    - `merchantName` string, nullable
    - `currency` string, nullable: ISO 4217 code. When omitted, the row takes the resolved account's currency (the integration or bank account, or the sole bank account bound to a selected GL account) and must otherwise match it. A row with no currency on an account that has none is rejected as invalid. A value that is not an ISO 4217 code marks only that row invalid; the other rows still import.
    - `sourceStatus` string, nullable
    - `sourceAccount` string, nullable
    - `bankDescription` string, nullable
    - `memo` string, nullable
    - `counterparty` string, nullable
    - `counterpartyId` string, nullable
    - `sourceCategory` string, nullable
    - `providerCategory` string, nullable
    - `merchantCategoryCode` string, nullable
    - `trackingId` string, nullable
    - `timestamp` string, nullable
    - `categoryAccountCode` string, nullable: Optional pre-categorization by Chart-of-Accounts code (e.g. "4100"). The row posts already categorized against the resolved account instead of landing in Uncategorized, and is excluded from the post-import rule engine. `categoryGlAccountId` wins when both are present.
    - `categoryGlAccountId` string, uuid, nullable: Optional pre-categorization by GL account id (must belong to the company and be active). Wins over `categoryAccountCode`.
  - `csvFingerprint` string, nullable: Optional client-generated hash of the raw CSV content. Kept for tracing in raw payloads only; it does not scope row-level dedup.

## Response `200`

Every row's class

- object
  - `success` boolean, required
  - `data` TransactionImportPreview, required: PG-p08-017 CSV import preview.
    - `rows` object[], required
      - `index` integer, required
      - `rowNumber` integer
      - `class` 'new' | 'bill_payment' | 'suspected_duplicate' | 'already_booked' | 'bank_id_discrepancy' | 'invalid', required
      - `heldForPerson` boolean, required: Booked uncategorized and left in review for a person
      - `reason` string
      - `matchedTransactionId` string, uuid: Absent when the row it repeats is one the same file would book first (no id yet). The booked row it repeats (`already_booked`), looks like (`suspected_duplicate`) or differs from (`bank_id_discrepancy`)
      - `billCandidates` object[]
        - `documentId` string, uuid, required
        - `documentName` string, nullable, required
        - `vendorName` string, nullable, required
        - `amountCents` integer, nullable, required
      - `discrepancy` TransactionImportPreviewBankIdDiscrepancy: The preview's view of a TransactionImportBankIdDiscrepancy. `booked.transactionId` is absent (never empty) when the booked version is a row the same file would book first: it has no id until the import books it. The import's result and its Inbox item always carry the persisted row's uuid.
        - `bankId` string, required
        - `changes` string[], required
        - `booked` object, required
          - `transactionId` string, uuid
          - `occurredOn` string, date, required
          - `amountCents` integer, required
          - `currency` string, required
          - `direction` 'in' | 'out', required
          - `description` string, required
        - `imported` object, required
          - `occurredOn` string, date, required
          - `amountCents` integer, required
          - `currency` string, required
          - `direction` 'in' | 'out', required
          - `description` string, required
          - `rowNumber` integer
    - `counts` object, required
      - `total` integer, required
      - `new` integer, required
      - `billPayment` integer, required
      - `suspectedDuplicate` integer, required
      - `alreadyBooked` integer, required
      - `bankIdDiscrepancy` integer, required
      - `invalid` integer, required
      - `toImport` integer, required: What "Import N rows" counts, new rows and bill payments

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Deposit-to account not found for this customer
- `422`: Request failed validation

## Changes

- **2026-11-26** `4a2098becaf9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/companies/:customerId/transactions/import/preview/post.md)

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) - [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) - [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/4f4c2d34276b?raw)
