## Delete field

`DELETE /v1/userfields/tasks/:id`

Deletes a task user field together with its list options and its values in all tasks of the Bitrix24 account. The field and its values cannot be restored via the API.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `:id` (path) | number | yes | Numeric identifier of the field from the response of [`GET /v1/userfields/tasks`](/docs/userfields/tasks/list) or [`POST /v1/userfields/tasks`](/docs/userfields/tasks/create) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/userfields/tasks/6007967" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/userfields/tasks/6007967" \
  -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/tasks/6007967', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

### JavaScript — OAuth application

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

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

## Response

On successful deletion, HTTP status `204 No Content` is returned with an empty body. The success indicator is the response code, not the content.

## Response example

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

## Error response example

404 — there is no field with this `id`, including after a successful deletion:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Task custom field not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_ID` | `:id` is not a positive integer — the request is rejected before it reaches Bitrix24 |
| 404 | `ENTITY_NOT_FOUND` | There is no field with this `id` — including a repeated `DELETE` after a successful deletion — or it belongs to another entity |
| 403 | `SYSTEM_FIELD_PROTECTED` | System field `UF_CRM_TASK`, `UF_TASK_WEBDAV_FILES`, or `UF_MAIL_MESSAGE` |
| 403 | `BITRIX_ACCESS_DENIED` | The key owner is not a Bitrix24 account administrator |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `TASK_CUSTOM_FIELDS_UNAVAILABLE` | The portal plan does not include task user fields |
| 403 | `SCOPE_DENIED` | The API key does not have the `task` scope |
| 502 | `TASK_USERFIELD_OUTCOME_UNKNOWN` | The connection to Bitrix24 dropped, or Bitrix24 returned a server error during the deletion — whether the field was deleted is unknown. The request was not retried automatically: read the field by `id` before deleting it again |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens. For an application key, the `Authorization: Bearer USER_SESSION_TOKEN` header was not passed |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**Recreating the field does not bring its values back.** After deletion, the field disappears from tasks: [`GET /v1/tasks/:id`](/docs/entities/tasks/get) no longer returns it. A field created again with the same `fieldName` is empty in tasks — the previous values are not restored.

## See also

- [List fields](/docs/userfields/tasks/list)
- [Create field](/docs/userfields/tasks/create)
- [Task fields](/docs/userfields/tasks)
- [Tasks](/docs/entities/tasks)
- [User fields](/docs/userfields)
