لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/task-comments.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Task comments

Comments are a nested task resource. Each comment has an author, text, and creation time. The base path is /v1/tasks/:taskId/comments. All operations require an existing task (:taskId) in the Bitrix24 account.

Bitrix24 API: tasks.task.chat.message.*, task.commentitem.* Scope: task

Create comment

POST /v1/tasks/:taskId/comments

Adds a comment to a task. On the new task card the message is posted to the chat; on the old one it lands in the comments block inside the card itself.

Parameters

Parameter Type Required Description
ParametertaskId (path) Typenumber Requiredyes DescriptionTask ID

Request fields (body)

Field Type Required Description
Fieldmessage Typestring Required★ DescriptionComment text, up to 65,535 characters. Supports BB-code ([USER=ID]Name[/USER], [B]...[/B], [QUOTE]...[/QUOTE])

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/289/comments" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Added a draft of the report — please take a look."
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/289/comments" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Added a draft of the report — please take a look."
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/comments', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    message: 'Added a draft of the report — please take a look.',
  }),
})

const { success, data } = await res.json()
console.log('New comment ID:', data.id)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/comments', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    message: 'Added a draft of the report — please take a look.',
  }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.id Typenumber | null DescriptionNew comment identifier. On the new card the chat-message ID is returned; in rare cases it may be null — see "Known specifics"

Response example

HTTP 201 Created:

JSON
{
  "success": true,
  "data": {
    "id": 36559
  }
}

Error response example

400 — empty or missing message:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`message` is required and must be a string"
  }
}

404 — the task does not exist or is not accessible:

JSON
{
  "success": false,
  "error": {
    "code": "TASK_NOT_FOUND",
    "message": "Bitrix24 did not create the comment (returned false). Task 99999999 may not exist or may not be accessible."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptiontaskId is not a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionThe message field is missing or is not a string
HTTP400 CodeINVALID_PARAMS Descriptionmessage exceeds the length limit
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the task scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP404 CodeTASK_NOT_FOUND DescriptionTask taskId does not exist or is not accessible to the key — Bitrix24 did not create the comment

Full list of common API errors — Errors.

Known specifics

data.id is occasionally null on success (success: true). On the new task card the comment goes to chat (tasks.task.chat.message.send), and the ID is recovered by a separate search over recent chat messages. If recovering the ID fails (the message was not found in the search window), the comment has already been created, but the response returns id: null — this is not an error, and retrying the request will create a duplicate. If Bitrix24 did not create the comment at all (the task does not exist or is not accessible), that is a different case — the API returns 404 TASK_NOT_FOUND instead of 201 with id: null.

See also