## Create a custom field (desk:admin)

`POST /api/desk/v1/fields`

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

### 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": true,
  "description": "Seriennummer des betroffenen Geräts",
  "key": "seriennummer",
  "kind": "text",
  "label": "Seriennummer"
}
```

### Responses

- **201** Created (`application/json`)

Fields of the 201 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 201 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 POST 'https://api.mbcom.cloud/api/desk/v1/fields' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"aiFill":true,"description":"Seriennummer des betroffenen Geräts","key":"seriennummer","kind":"text","label":"Seriennummer"}'
```
