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

Attach Drive files to a checklist item

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

Attaches files that are already on Bitrix24 Drive to a task checklist item. The files are not copied: each attachment refers to the Drive file itself.

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
FieldfilesIds Typearray Requiredyes DescriptionDrive file IDs — numbers or strings prefixed with the letter n, for example 10808 or "n10808". List: GET /v1/files. To upload a new file, use POST /v1/files/upload

Examples

curl — personal key

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

curl — OAuth application

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

JavaScript — personal key

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

const { success, data } = await res.json()
console.log('Item attachments:', data?.checkListItem?.attachments)

JavaScript — OAuth application

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

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 files were added
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 employee 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 DescriptionItem attachments, including the newly added ones. An empty array — the item has no attachments. Otherwise an object where the key is the attachment ID and the value is the Drive file ID prefixed with the letter n. Pass the attachment ID to POST /v1/tasks/:taskId/checklist/:itemId/attachments/remove
Fielddata.checkListItem.nodeId Typenull DescriptionNode key from saving the checklist. null in this method's response
Fielddata.checkListItem.taskId Typenumber DescriptionTask ID

Response example

Drive file 10808 is attached to the item, and the attachment has ID 596:

JSON
{
  "success": true,
  "data": {
    "checkListItem": {
      "id": 274,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 268,
      "title": "Agree on the date",
      "sortIndex": 2,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": false,
      "completedCount": 0,
      "members": [],
      "attachments": {
        "596": "n10808"
      },
      "nodeId": null,
      "taskId": 4218
    }
  }
}

Error response example

422 — Drive has no file with this ID:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "File could not be found.",
    "b24Code": "ERROR_CORE"
  }
}

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 DescriptionfilesIds is missing or is not an array. Message filesIds 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
HTTP422 CodeBITRIX_ERROR DescriptionDrive has no file with an ID from filesIds. error.b24Code is ERROR_CORE; the message is in the Bitrix24 account language, for example File could not be found.
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

Attaching a file again does not duplicate the attachment. A file that is already attached to the item can be passed again, including in the other form — 10808 or "n10808". The method returns 200, and the item keeps a single attachment with the same ID.

See also