## Set the tenant's chart of accounts (tenant:settings:write)

`PUT /api/masterdata/tenant-settings`

Module: Master data · operationId: `saveTenantSettings` · Tag: Settings · Auth: access token (`Authorization: Bearer <accessToken>`)

`version` must match the stored one (0 while none is stored). The default revenue accounts of the
standard tax keys follow the chart where they are empty or still the previous chart's account;
changed accounts stay (each changed tax key emits `masterdata.lookup.updated`). A chart that is
already set cannot change once product groups have revenue accounts (`409`).

### Request body

`application/json` (required)

- `chartOfAccounts` (string, required): DATEV chart of accounts (empty in a response while none was chosen) (one of `SKR03`, `SKR04`)
- `version` (integer, required): Optimistic locking version (0 while not stored)

Example:

```json
{
  "chartOfAccounts": "SKR04",
  "version": 2
}
```

### Responses

- **200** Saved (`application/json`)
- **400** Malformed body or query parameter (`application/json`)
- **401** Missing, invalid or expired token (empty body)
- **403** The token lacks the permission or carries no tenant (`application/json`)
- **409** Stale version or conflict with existing data (`application/json`)

Fields of the 200 answer:

- `chartOfAccounts` (string, required): DATEV chart of accounts (empty in a response while none was chosen) (one of `SKR03`, `SKR04`)
- `version` (integer, required): Optimistic locking version (0 while not stored)

Example 200 answer:

```json
{
  "chartOfAccounts": "SKR04",
  "version": 2
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/masterdata/tenant-settings' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"chartOfAccounts":"SKR04","version":2}'
```
