## Save the NFON phone book settings (tenant:settings:write)

`PUT /api/crm/v1/nfon/config`

Module: CRM · operationId: `saveNfonConfig` · Tag: NFON telephony · Auth: access token (`Authorization: Bearer <accessToken>`)

Replaces the `nfon` section of the module configuration; the rest stays unchanged. The
`lastSync*` fields are ignored. A `syncIntervalCron` or `fullSyncCron` that is no 5-field cron
expression is refused with `400`.

### Request body

`application/json` (required)

- `active` (boolean): The phone book is sent only when active.
- `fullSyncCron` (string): Schedule of the full run (comms empties and rebuilds the NFON phone book), same format. Missing: Sundays at 03:00 (`0 3 * * 0`); empty: no scheduled full run. When both schedules are due, the full run is sent.
- `includeLeads` (boolean): Also put the CRM leads with a phone number into the phone book (after the masterdata contacts). (default `true`)
- `lastSync` (string (date-time), read-only): Start of the most recent run.
- `lastSyncCount` (integer, read-only): Entries the most recent run sent.
- `lastSyncError` (string, read-only): First error of the most recent run.
- `lastSyncStatus` (string, read-only): Status of the most recent run. (one of `SUCCESS`, `FAILED`)
- `syncIntervalCron` (string): Schedule of the regular run: a 5-field cron expression in German time (prefix `CRON_TZ=<zone>` for another zone). Empty: no scheduled regular run; responses leave the field out then. A scheduled run sends only when something changed.

Example:

```json
{
  "active": true,
  "fullSyncCron": "0 3 * * 0",
  "includeLeads": true,
  "syncIntervalCron": "* * * * *"
}
```

### Responses

- **200** Saved (`application/json`)
- **400** Invalid input (`invalid`): `field` names the first invalid field, `details.fields` every one (JSON paths for
bodies, parameter names for the query). Some refusals have their own code (`invalid_sort`,
`invalid_stages`, `invalid_custom_fields`, `convert_target_required`, `invalid_csv`, …).
 (`application/json`)
- **401** Missing, invalid or expired token (no body).
- **403** The token lacks the permission (`insufficient permissions`) or has no active tenant.
 (`application/json`)
- **500** Unexpected error; details are only logged. (`application/json`)

Fields of the 200 answer:

- `message` (string): What happened.

Example 200 answer:

```json
{
  "message": "NFON configuration saved successfully"
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/crm/v1/nfon/config' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"active":true,"fullSyncCron":"0 3 * * 0","includeLeads":true,"syncIntervalCron":"* * * * *"}'
```
