## Update a list field value

`PATCH /v1/userfields/:entity/enum-values/:id`

Updates one option of a CRM custom list field. Send fields at the JSON root without a `fields` wrapper.

> **Availability.** An administrator must enable this feature. It requires a CRM update after version 26.2200.0. The release version for that update has not yet been announced. If unavailable, the API returns `422 METHOD_NOT_YET_AVAILABLE` with `error.release`.

Alternative path for Smart Process Automation and invoices: `PATCH /v1/items/:entityTypeId/userfields/enum-values/:id`.

## Parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `entity` (path) | string | yes | `deals`, `leads`, `contacts`, `companies`, `quotes`, `invoices` |
| `id` (path) | number | yes | Value ID. Source: [List field values](/docs/entities/crm-field-enum/list) |
| `entityTypeId` (path) | number | yes for the alternative path | For the alternative path: a [Smart Process Automation type ID](/docs/entities/smart-processes/list), or `31` for invoices |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `value` | string | no | Option label |
| `isDefault` | boolean | no | Whether this option is selected by default |
| `sort` | integer | no | Sort order |
| `xmlId` | string \| null | no | External identifier. `null` preserves the current value |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value": "VIBE-PROBE changed"}'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": "VIBE-PROBE changed"}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"value": "VIBE-PROBE changed"}),
})

const result = await res.json()
console.log(result)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"value": "VIBE-PROBE changed"}),
})

const result = await res.json()
console.log(result)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` |
| `data` | object | The updated option |
| `data.id` | number | Option ID from [List field values](/docs/entities/crm-field-enum/list) |
| `data.fieldId` | number | [CRM custom field ID](/docs/userfields/crm/list) or [Smart Process Automation custom field ID](/docs/userfields/smart-processes/list) |
| `data.value` | string | Option label |
| `data.isDefault` | boolean | Whether selected by default |
| `data.sort` | integer | Sort order |
| `data.xmlId` | string \| null | External identifier |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 4119,
    "fieldId": 6008145,
    "value": "VIBE-PROBE changed",
    "isDefault": false,
    "sort": 500,
    "xmlId": "VIBE-PROBE-X"
  }
}
```

## Error response example

400: attempting to pass `id` in the request body:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Use enum fields fieldId (add only), value, isDefault, sort and xmlId with their documented types"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `INVALID_PARAMS` | A parameter has an invalid type or shape |
| 400 | `UNKNOWN_FILTER_FIELD` | An unknown or repeated query parameter |
| 401 | `MISSING_API_KEY` | The API key is missing |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 credentials |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied permission for this operation |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key allows reads only |
| 404 | `ENTITY_NOT_FOUND` | The list value was not found |
| 422 | `METHOD_NOT_YET_AVAILABLE` | The feature is disabled or unavailable on this portal. `error.release` identifies the required update |
| 422 | `BITRIX_ERROR` | Bitrix24 refused the request. See `error.message` |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 returned an invalid response |

For shared API errors, see [Errors](/docs/errors).

## See also

- [List field values](/docs/entities/crm-field-enum/list)
- [Create a list field value](/docs/entities/crm-field-enum/create)
