# imports.preview

Validate a CSV import using accountId, csv text and mapping with date, description, amount or debit/credit, and dateFormat. Returns errors without booking transactions.

`POST /api/v1/accounting/imports.preview`

Permissions: `accounting:read` · Roles: admin, finance

MCP tool: `accounting_preview_bank_import`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `accountId` | string (ID) | Yes | The ID of a bank, card or payment account, from accounts.list. |
| `csv` | string | Yes | at most 5000000 characters. |
| `filename` | string |  | The file's name, including its extension. 1–255 characters. Default `"statement.csv"`. |
| `currency` | string | Yes | Three-letter currency code, such as CAD or USD. |
| `mapping` | object | Yes | No other fields. |
| `mapping.date` | string | Yes | A date, as YYYY-MM-DD. at least 1 characters. |
| `mapping.description` | string | Yes | A short description. at least 1 characters. |
| `mapping.amount` | string |  |  |
| `mapping.debit` | string |  |  |
| `mapping.credit` | string |  |  |
| `mapping.reference` | string |  |  |
| `mapping.dateFormat` | enum | Yes | One of: `YYYY-MM-DD`, `MM/DD/YYYY`, `DD/MM/YYYY`. |
| `mapping.columns` | array of strings |  | 2–50 items; each 1–100 characters. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/imports.preview \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "4d5e6f7a-8b9c-4d0e-8f1a-2b3c4d5e6f7a",
  "csv": "example",
  "currency": "CAD",
  "mapping": {
    "date": "2026-09-30",
    "description": "Synthetic example from the docs",
    "dateFormat": "YYYY-MM-DD"
  }
}'
```

Reference page: https://app.getoatmilk.com/docs/api/imports.preview
