# ai.settings.update

Revise matching and routing models, thresholds, and automatic matching with revision and idempotency checks. Changes apply to future evaluations only; stored decisions keep their recorded provenance.

`POST /api/v1/accounting/ai.settings.update`

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

MCP tool: `accounting_ai_settings_update`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `expectedRevision` | integer |  | The record's current revision, from the last time you read it. If someone changed the record since, the request is refused with a conflict so you can reload and check before trying again. 0 to 9007199254740991. |
| `matchModel` | string | Yes | 1–120 characters. |
| `matchThresholds` | object | Yes | No other fields. |
| `matchThresholds.selectedProbability` | number | Yes | 0.9 to 1. |
| `matchThresholds.providerConfidence` | number | Yes | 0.85 to 1. |
| `matchThresholds.sameEventProbability` | number | Yes | 0.9 to 1. |
| `matchThresholds.runnerUpMargin` | number | Yes | 0.1 to 1. |
| `routingModel` | string | Yes | 1–120 characters. |
| `routingThresholds` | object | Yes | No other fields. |
| `routingThresholds.probability` | number | Yes | 0 to 1. |
| `routingThresholds.confidence` | number | Yes | 0 to 1. |
| `autoApply` | boolean | Yes |  |
| `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/ai.settings.update \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "matchModel": "example",
  "matchThresholds": {
    "selectedProbability": 1,
    "providerConfidence": 1,
    "sameEventProbability": 1,
    "runnerUpMargin": 1
  },
  "routingModel": "example",
  "routingThresholds": {
    "probability": 1,
    "confidence": 1
  },
  "autoApply": true
}'
```

Reference page: https://app.getoatmilk.com/docs/api/ai.settings.update
