لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/task-stages/delete.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Delete an empty task stage
DELETE /v1/task-stages/:stageId
Deletes a stage with no tasks from a workgroup kanban or from My Plan. A deleted stage cannot be restored through the API — create a new one if needed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParameterstageId (path) |
Typenumber | Requiredyes | DescriptionStage ID. List: GET /v1/tasks/stages/:entityId |
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/task-stages/631" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/task-stages/631" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/task-stages/631', {
method: 'DELETE',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
if (res.status === 204) {
console.log('Stage deleted')
}
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/task-stages/631', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
if (res.status === 204) {
console.log('Stage deleted')
}
Response
On successful deletion the API returns HTTP status 204 No Content with an empty body. Success is indicated by the status code, not the content.
Response example
HTTP/1.1 204 No Content
Error response example
409 — the stage contains tasks:
{
"success": false,
"error": {
"code": "STAGE_NOT_EMPTY",
"message": "The stage contains tasks; move them first (including tasks not visible to you)"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionstageId is not a positive integer: stageId must be a positive integer |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no valid Bitrix24 token |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the task or tasks scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe key's user has no rights to the group kanban |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo stage with this stageId, including when the stage is deleted a second time. The message text comes from Bitrix24 in the Bitrix24 account's language |
| HTTP409 | CodeSTAGE_NOT_EMPTY |
DescriptionThe stage contains tasks: The stage contains tasks; move them first (including tasks not visible to you) |
| HTTP409 | CodeSTAGE_IS_SYSTEM |
DescriptionThe stage is first on the board, that is, the default stage: The first stage cannot be deleted |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 did not confirm the deletion: Bitrix24 did not confirm deletion; reread stages before retrying |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the deletion. The text is in message |
Full list of common API errors — Errors.
Known specifics
- Emptiness counts all tasks. Tasks the key's user cannot see are counted too. If
STAGE_NOT_EMPTYcomes back for a stage that looks empty, it holds tasks not accessible to the key's user. - How to delete the first stage. First make another stage the first one:
PATCH /v1/task-stages/:stageIdwithafterStageId: 0. Group tasks without a stage are then assigned to the former first stage, and the deletion returns409 STAGE_NOT_EMPTY. Find them in the task list withfilter[stageId]=<stage ID>, move them with the move method and retry the deletion.