## Create or replace a lookup entry (tenant:settings:write)

`PUT /api/masterdata/lookups/{kind}/{code}`

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

Kind-specific columns that are omitted are reset to their default. For `currencies` the ECB rate wins over the `exchangeRate` of the body when the ECB publishes the currency (`rateSource` `ECB`); `rateSource` and `rateDate` are read-only. For `address-statuses` the roles of every address with the status are re-derived in the same transaction; in the operator tenant `10639/MBCOM` removing `isCustomer` from a status of an address with active platform tenants answers `409`. Emits `masterdata.lookup.updated`.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `kind` | path | LookupKind | yes | Parameter table (one of `address-statuses`, `currencies`, `industries`, `payment-methods`, `payment-terms`, `salutations`, `shipping-types`, `tax-keys`, `units`) |
| `code` | path | string | yes | Entry code (`^[A-Za-z0-9_.-]{1,32}$`, stored upper-case), for `currencies` an ISO 4217 code |

### Request body

`application/json` (required)

- `name` (string, required): Display name (max length 128)
- `code` (string, read-only): Taken from the path on write
- `isActive` (boolean): Offered in selects (default `true`)
- `sortOrder` (integer): Position in the table (default `0`)
- `updatedAt` (string (date-time), read-only): Time of the last change

Example:

```json
{
  "isActive": true,
  "name": "30 Tage netto",
  "netDays": 30,
  "sortOrder": 30,
  "text": "Zahlbar innerhalb von 30 Tagen ohne Abzug."
}
```

### 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`)
- **404** Not found in the caller's tenant (or merged, see `code`) (`application/json`)
- **409** Stale version or conflict with existing data (`application/json`)

Fields of the 200 answer:

- `name` (string, required): Display name (max length 128)
- `code` (string, read-only): Taken from the path on write
- `isActive` (boolean): Offered in selects (default `true`)
- `sortOrder` (integer): Position in the table (default `0`)
- `updatedAt` (string (date-time), read-only): Time of the last change

Example 200 answer:

```json
{
  "code": "NETTO30",
  "isActive": true,
  "name": "30 Tage netto",
  "netDays": 30,
  "sortOrder": 0,
  "text": "Zahlbar innerhalb von 30 Tagen ohne Abzug.",
  "updatedAt": "2026-01-02T08:00:00Z"
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/masterdata/lookups/address-statuses/NETTO30' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"isActive":true,"name":"30 Tage netto","netDays":30,"sortOrder":30,"text":"Zahlbar innerhalb von 30 Tagen ohne Abzug."}'
```
