# imports.undo.preview

Preview selective Undo for one manual CSV or uploaded statement import, or guarded Restore for one complete Undo operation. Resolve batch, statement, transaction, or bank-row context inside the organization. Returns paged groups, treatment choices, blockers, and an exact whole-graph fingerprint while preserving originals.

`GET | POST /api/v1/accounting/imports.undo.preview`

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

MCP tool: `accounting_imports_undo_preview`

## Fields

#### mode: "undo"

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `mode` | "undo" | Yes |  |
| `target` | object | Yes | No other fields. |
| `target.kind` | enum | Yes | Which kind of record or job this is. One of: `batch`, `statement`, `entry`, `bank_transaction`. |
| `target.id` | string (ID) | Yes | The record's ID. |
| `cursor` | string |  | Where the next page starts: the nextCursor value from the previous response. 1–512 characters. |
| `limit` | integer |  | How many results to return at most. 1 to 500. Default `200`. |

#### mode: "restore"

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `mode` | "restore" | Yes |  |
| `operationId` | string (ID) | Yes | The ID of the related record. |
| `cursor` | string |  | Where the next page starts: the nextCursor value from the previous response. 1–512 characters. |
| `limit` | integer |  | How many results to return at most. 1 to 500. Default `200`. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/imports.undo.preview \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "mode": "undo",
  "target": {
    "kind": "batch",
    "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
  }
}'
```

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