# dataImports.commit

Start an import in the background with the mapping and decisions: create or choose customers and contractors, link or skip invoice numbers already in Oatmilk, and import or skip possible duplicate payments. Invoices keep their original numbers without using the invoice sequence, paid rows get their payment, the first PDF becomes the invoice's PDF, and Notion rows are linked for sync. Contractor payments are recorded as paid outside Wise; no money is sent and nobody is emailed. Rows already imported are skipped. Returns the import to follow with dataImports.get. Supply idempotencyKey.

`POST /api/v1/accounting/dataImports.commit`

Permissions: `accounting:read`, `accounting:write` · Roles: admin, finance · Idempotency key required

MCP tool: `accounting_data_imports_commit`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `target` | enum | Yes | One of: `invoices`, `contractor_payments`. |
| `source` | enum |  | Where the record came from. One of: `notion`. Default `"notion"`. |
| `databaseId` | string | Yes | 1–200 characters. |
| `mapping` | object | Yes | No other fields. |
| `mapping.columns` | map | Yes |  |
| `mapping.statusMap` | map |  | Default `{}`. |
| `mapping.defaultCurrency` | string or null |  | Default `null`. |
| `mapping.dateOrder` | enum or null |  | One of: `mdy`, `dmy`. Default `null`. |
| `mapping.reviewCustomers` | boolean |  |  |
| `mapping.customerRelationPath` | array of strings |  | at most 3 items; each 1–100 characters. |
| `mapping.customerRelationDirect` | boolean |  |  |
| `mapping.rowOverrides` | map |  |  |
| `decisions` | object |  | No other fields. |
| `decisions.groups` | map |  | Default `{}`. |
| `decisions.rows` | map |  | Default `{}`. |
| `rowIds` | array of strings |  | A list of record IDs. 1–2000 items; each 1–200 characters. |
| `idempotencyKey` | string | Yes | Any unique text you generate once per intended change, so a retried request only happens once. Send it as the Idempotency-Key header instead if you prefer; if you send both they must match. 8–200 characters. |

## Example request

```bash
curl https://app.getoatmilk.com/api/v1/accounting/dataImports.commit \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "target": "invoices",
  "databaseId": "example",
  "mapping": {
    "columns": {}
  }
}'
```

Reference page: https://app.getoatmilk.com/docs/api/dataImports.commit
