## Delete a list field value

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

Deletes one option of a CRM list custom field. The API cannot restore a deleted option.

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

Alternative path for Smart Process Automation and invoices: `DELETE /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 |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

if (res.status === 204) {
  console.log('Value deleted')
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/userfields/deals/enum-values/4119', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

if (res.status === 204) {
  console.log('Value deleted')
}
```

## Response

A successful deletion returns `204 No Content` with an empty body. Check the response status.

## Response example

```http
HTTP/1.1 204 No Content
```

## Error response example

404: deleting a value that has already been deleted:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Record with ID = `4119` was not found"
  }
}
```

## 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)
