## Delete a task result

`DELETE /v1/task-results/:id`

Deletes a task result by its ID. A deleted result cannot be restored via the API — add a new one if needed.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Result ID, a positive integer. Take it from `data.item.id` in the response of [adding a result](/docs/entities/tasks/results-v3-create) or [creating one from a message](/docs/entities/tasks/results-v3-from-chat-message). List: [`GET /v1/tasks/:taskId/results`](/docs/entities/tasks/results) |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/task-results/21" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { success, data } = await res.json()
console.log('Request accepted:', success)
```

### JavaScript — OAuth application

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

const { success, data } = await res.json()
```

## Response fields

The response comes with code `200` and a JSON body, not `204` with an empty body as with [deleting a task](/docs/entities/tasks/delete).

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` if the request was accepted |
| `data` | object | Wrapper with the deletion outcome |
| `data.result` | boolean | `true`, including for an `id` that does not exist in the Bitrix24 account and for a repeated deletion. To see whether the result was deleted, check the list [`GET /v1/tasks/:taskId/results`](/docs/entities/tasks/results) |

## Response example

```json
{
  "success": true,
  "data": {
    "result": true
  }
}
```

## Error response example

400 — `id` is not a positive integer:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "id must be a positive safe integer"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message: `id must be a positive safe integer` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `BITRIX_ACCESS_DENIED` | No permission to delete this result |
| 403 | `SCOPE_DENIED` | The key has no `task` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode. `error.details.switchUrl` contains the URL of the section where the mode is changed |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the call. The text is in `error.message` |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |

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

## See also

- [Task results: REST 3.0](/docs/entities/tasks/results-v3)
- [Add task result](/docs/entities/tasks/results-v3-create)
- [Create task result from chat message](/docs/entities/tasks/results-v3-from-chat-message)
- [Update task result](/docs/entities/tasks/results-v3-update)
- [Task results: legacy REST](/docs/entities/tasks/results)
