#Delete task

DELETE /v1/tasks/:id

Deletes a task. A deleted task cannot be restored via the API — create a new one if needed. Together with the task, its comments and time-tracking records become inaccessible.

#Parameters

Parameter Type Req. Description
id (path) number yes Task ID

#Examples

#curl — personal key

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/tasks/3871" \
  -H "X-Api-Key: YOUR_API_KEY"

#curl — OAuth application

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

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

#JavaScript — OAuth application

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

if (res.status === 204) {
  console.log('Deleted')
}

#Response

On successful deletion, HTTP status 204 No Content is returned with an empty body — success is determined by the status.

#Response example

HTTP/1.1 204 No Content

#Error response example

404 — task not found (or already deleted):

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "task 999999999 not found"
  }
}

#Errors

HTTP Code Description
404 ENTITY_NOT_FOUND A task with this ID was not found (including if it has already been deleted)
403 SCOPE_DENIED The API key does not have the tasks scope
401 TOKEN_MISSING The API key has no configured tokens

The full list of common API errors — Errors.

#Known specifics

Cascade deletion of nested resources. After a task is deleted, its comments and time-tracking records become inaccessible — a separate DELETE for each of them is not needed. An attempt to access them by the former ID returns 422 BITRIX_ERROR with the message ITEM_NOT_FOUND_OR_NOT_ACCESSIBLE.

#See also