## Change a custom field (tenant:forge:write and maintainer, or tenant:forge:admin)

`PATCH /api/forge/v1/projects/{key}/custom-fields/{id}`

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

Same permission as creating. `version` is required (409 `version_conflict`); keys never change.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `key` | path | string | yes | Project key (e.g. APP) |
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json` (required)

- `key` (string): Create: field key; fixed afterwards
- `kind` (string): Create: value type; fixed afterwards (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
- `label` (string): Display label (max length 80)
- `options` (array of FieldOption): Choices of select and multiselect fields
  - `label` (string, required): Display label
  - `value` (string, required): Stored value
  - `color` (string): Color token or #rrggbb (optional)
- `required` (boolean): Items need a value
- `typeKeys` (array of string): Item type keys the field applies to; empty = every type
- `version` (integer): PATCH: the version the change is based on

Example:

```json
{
  "required": true,
  "typeKeys": [
    "story"
  ],
  "version": 1
}
```

### Responses

- **200** Changed (`application/json`)
- **400** Error (`application/json`)
- **403** Error (`application/json`)
- **404** Error (`application/json`)
- **409** Error (`application/json`)

Fields of the 200 answer:

- `id` (string (uuid), required): Field id
- `key` (string, required): Field key: the key in `customFields` of an item; never changes
- `kind` (string, required): Value type; never changes (one of `text`, `longtext`, `number`, `date`, `datetime`, `bool`, `select`, `multiselect`, `user`, `url`)
- `label` (string, required): Display label
- `options` (array of FieldOption, required): Choices of select and multiselect fields
  - `label` (string, required): Display label
  - `value` (string, required): Stored value
  - `color` (string): Color token or #rrggbb (optional)
- `position` (integer, required): Order in the configuration
- `required` (boolean, required): Items of the types the field applies to need a value
- `typeKeys` (array of string, required): Item type keys; empty = every type
- `version` (integer, required): Optimistic-locking version; send it with PATCH

Example 200 answer:

```json
{
  "id": "9b5c6d7e-8f9a-4b0c-9dbe-5f6a7b8c9d01",
  "key": "story_points",
  "kind": "number",
  "label": "Story Points",
  "options": [],
  "position": 0,
  "required": false,
  "typeKeys": [
    "story",
    "aufgabe",
    "fehler"
  ],
  "version": 1
}
```

### Example request

```bash
curl -X PATCH 'https://api.mbcom.cloud/api/forge/v1/projects/string/custom-fields/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"required":true,"typeKeys":["story"],"version":1}'
```
