For AI agents: markdown of this page — /docs-content-en/entities/tasks/checklist-actions/attachments-remove.md documentation index — /llms.txt

Remove checklist item attachments

POST /v1/tasks/:taskId/checklist/:itemId/attachments/remove

Removes attachments from a task checklist item — files attached by content or from Bitrix24 Drive.

Parameters

Parameter Type Required Description
ParametertaskId (path) Typenumber Requiredyes DescriptionTask ID. List: GET /v1/tasks
ParameteritemId (path) Typenumber Requiredyes DescriptionChecklist item ID. List of items: GET /v1/tasks/:taskId/checklist

Request fields (body)

Field Type Required Description
FieldattachmentsIds Typearray Requiredyes DescriptionAttachment IDs — numbers. An attachment ID is a key of the item's attachments object, not a Drive file ID. List: GET /v1/tasks/:taskId/checklist/:itemId

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/attachments/remove" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"attachmentsIds":[592]}'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/attachments/remove" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"attachmentsIds":[592]}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/attachments/remove', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ attachmentsIds: [592] }),
})

const { success, data } = await res.json()
console.log('Attachments left:', Object.keys(data?.checkListItem?.attachments ?? {}).length)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/attachments/remove', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ attachmentsIds: [592] }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue if the request succeeded
Fielddata.checkListItem Typeobject DescriptionThe checklist item after the attachments were removed
Fielddata.checkListItem.id Typenumber DescriptionItem ID
Fielddata.checkListItem.copiedId Typenumber | null DescriptionID of the item this one was copied from. null — the item was not copied
Fielddata.checkListItem.userId Typenumber DescriptionID of the user on whose behalf the call is made
Fielddata.checkListItem.createdBy Typenumber DescriptionID of the item author. List: GET /v1/users
Fielddata.checkListItem.parentId Typenumber DescriptionParent item ID. 0 — a top-level item
Fielddata.checkListItem.title Typestring DescriptionItem text
Fielddata.checkListItem.sortIndex Typenumber DescriptionPosition of the item among items with the same parent: the lower the number, the higher the item
Fielddata.checkListItem.displaySortIndex Typestring DescriptionItem number for display. An empty string in this method's response
Fielddata.checkListItem.isComplete Typeboolean DescriptionWhether the item is completed
Fielddata.checkListItem.isImportant Typeboolean DescriptionWhether the item is marked as important
Fielddata.checkListItem.completedCount Typenumber DescriptionNumber of completed sub-items. 0 in this method's response
Fielddata.checkListItem.members Typearray DescriptionItem members — objects with the fields id, type, name, personalPhoto, personalGender, image, isCollaber. id is the user ID as a string; type: A — participant, U — observer
Fielddata.checkListItem.attachments Typearray | object DescriptionAttachments the item still has. An empty array — no attachments are left. Otherwise an object where the key is the attachment ID and the value is the Drive file ID prefixed with the letter n
Fielddata.checkListItem.nodeId Typenull DescriptionNode key from saving the checklist. null in this method's response
Fielddata.checkListItem.taskId Typenumber DescriptionTask ID

Response example

Attachment 592 is removed, and the item still has attachment 594:

JSON
{
  "success": true,
  "data": {
    "checkListItem": {
      "id": 276,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 268,
      "title": "Check the build",
      "sortIndex": 1,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": true,
      "completedCount": 0,
      "members": [
        {
          "id": "1295",
          "type": "U",
          "name": "John Smith",
          "personalPhoto": "33093",
          "personalGender": "",
          "image": "https://example.bitrix24.com/...",
          "isCollaber": false
        }
      ],
      "attachments": {
        "594": "n10806"
      },
      "nodeId": null,
      "taskId": 4218
    }
  }
}

Error response example

400 — attachmentsIds is not an array:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "attachmentsIds must be an array"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptiontaskId is not a positive integer. Message taskId must be a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionitemId is not a positive integer. Message itemId must be a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionThe body is missing or is not a JSON object. Message JSON object body is required
HTTP400 CodeINVALID_PARAMS DescriptionattachmentsIds is missing or is not an array. Message attachmentsIds must be an array
HTTP401 CodeMISSING_API_KEY DescriptionX-Api-Key is missing
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no Bitrix24 tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the task scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is in read-only mode. error.details.switchUrl contains the URL of the section where the mode is changed
HTTP415 CodeFST_ERR_CTP_INVALID_MEDIA_TYPE DescriptionA body with a Content-Type the API does not parse, for example application/xml
HTTP404 CodeTASK_NOT_FOUND DescriptionThe task is missing or inaccessible and the core returned the legacy named task-not-found signature
HTTP404 CodeNOT_FOUND DescriptionThe itemId item is missing, belongs to another task or is inaccessible. This also covers an unnamed task access denial in Russian, English, German or Kazakh; this denial does not distinguish a missing task from denied access
HTTP422 CodeBITRIX_ERROR DescriptionAnother Bitrix24 error, including an unrecognized core denial
HTTP429 CodeRATE_LIMITED DescriptionRequest rate exceeded. The effective cap is in the x-ratelimit-limit header

The full list of common API errors — Errors.

Known specifics

An unknown ID does not cause an error. If the item has no attachment with the passed ID, the method returns 200 and leaves the attachments unchanged. Check attachments in the response to confirm the result.

The Drive file is not always deleted. The file of an attachment created by content disappears from Drive after the attachment is removed: GET /v1/files/:id returns 404 for it. A file attached from Drive stays in place.

See also