## Update a custom field (key and kind are fixed) (desk:admin)

`PUT /api/desk/v1/fields/{id}`

Module: Desk · operationId: `updateField` · Tag: Configuration · Auth: access token (`Authorization: Bearer <accessToken>`)

Archiving a field the callback form still places (`settings.callbacks.fields`) is 409 `in_use` with
`details.usedBy: [callbacks]`; remove it from the form first.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json` (required)

- `key` (string, required): Key of the field; item values are cf.<key>
- `kind` (string, required): Value kind of the field (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
- `label` (string, required): Display label
- `aiFill` (boolean): The AI may fill the field of new tickets (triage); only select and short text (`text`) fields. Text is only ever proposed, never applied without a person
- `archived` (boolean): Archived: kept on items, no longer offered
- `description` (string): Help text of the field
- `id` (string, read-only): Id of the custom field
- `kbRole` (string): Field holds the cause (one of ``, `cause`, `solution`, `workaround`)
- `options` (array of object): Choices of a select or multiselect field
  - `color` (string): Display color of the choice
  - `label` (string): Display label of the choice
  - `value` (string): Stored value of the choice

Example:

```json
{
  "aiFill": false,
  "archived": false,
  "description": "Warum das Ticket geschlossen wurde",
  "id": "7f4a5b6c-8d9e-4f0a-9b2c-4d5e6f7a8b04",
  "kbRole": "",
  "key": "abschlussgrund",
  "kind": "select",
  "label": "Abschlussgrund",
  "options": [
    {
      "label": "Behoben",
      "value": "behoben"
    },
    {
      "label": "Workaround",
      "value": "workaround"
    },
    {
      "label": "Kein Fehler",
      "value": "kein_fehler"
    },
    {
      "label": "Duplikat",
      "value": "duplikat"
    },
    {
      "label": "Vom Kunden zurückgezogen",
      "value": "zurueckgezogen"
    }
  ]
}
```

### Responses

- **200** Saved (`application/json`)
- **409** in_use: the callback form places the field (`application/json`)

Fields of the 200 answer:

- `key` (string, required): Key of the field; item values are cf.<key>
- `kind` (string, required): Value kind of the field (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
- `label` (string, required): Display label
- `aiFill` (boolean): The AI may fill the field of new tickets (triage); only select and short text (`text`) fields. Text is only ever proposed, never applied without a person
- `archived` (boolean): Archived: kept on items, no longer offered
- `description` (string): Help text of the field
- `id` (string, read-only): Id of the custom field
- `kbRole` (string): Field holds the cause (one of ``, `cause`, `solution`, `workaround`)
- `options` (array of object): Choices of a select or multiselect field
  - `color` (string): Display color of the choice
  - `label` (string): Display label of the choice
  - `value` (string): Stored value of the choice

Example 200 answer:

```json
{
  "aiFill": false,
  "archived": false,
  "description": "Warum das Ticket geschlossen wurde",
  "id": "7f4a5b6c-8d9e-4f0a-9b2c-4d5e6f7a8b04",
  "kbRole": "",
  "key": "abschlussgrund",
  "kind": "select",
  "label": "Abschlussgrund",
  "options": [
    {
      "label": "Behoben",
      "value": "behoben"
    },
    {
      "label": "Workaround",
      "value": "workaround"
    },
    {
      "label": "Kein Fehler",
      "value": "kein_fehler"
    },
    {
      "label": "Duplikat",
      "value": "duplikat"
    },
    {
      "label": "Vom Kunden zurückgezogen",
      "value": "zurueckgezogen"
    }
  ]
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/desk/v1/fields/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"aiFill":false,"archived":false,"description":"Warum das Ticket geschlossen wurde","id":"7f4a5b6c-8d9e-4f0a-9b2c-4d5e6f7a8b04","kbRole":"","key":"abschlussgrund","kind":"select","label":"Abschlussgrund","options":[{"label":"Behoben","value":"behoben"},{"label":"Workaround","value":"workaround"},{"label":"Kein Fehler","value":"kein_fehler"},{"label":"Duplikat","value":"duplikat"},{"label":"Vom Kunden zurückgezogen","value":"zurueckgezogen"}]}'
```
