For AI agents: markdown of this page — /docs-content-en/entities/tasks/results-from-comment.md documentation index — /llms.txt

Create a task result from a comment

POST /v1/task-results/from-comment/:commentId

Turns a comment from the old task card into a result of that task: the method takes the result text from the comment and determines the task from it.

Parameters

Parameter Type Required Description
ParametercommentId (path) Typenumber Requiredyes DescriptionID of a comment on the old task card, a positive integer. List: GET /v1/tasks/:taskId/comments — it returns old-card comments for a task without a chat

Request fields (body)

The body is optional. The method accepts no fields other than params.

Field Type Required Description
Fieldparams Typeobject Requiredno DescriptionAdditional data in the response
Fieldparams.WITH_FILE_INFO Typestring Requiredno DescriptionY — add fileInfo with file data to the result. N or omitted — do not add it

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/task-results/from-comment/8611" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/task-results/from-comment/8611" \
  -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/task-results/from-comment/8611', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/task-results/from-comment/8611', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue if the request succeeded
Fielddata Typeobject | null DescriptionThe created result or null. null comes back for a system comment, such as the automatic message about task completion: no result is created, and there is no error
Fielddata.id Typenumber DescriptionResult ID. Needed to update and delete the result
Fielddata.taskId Typenumber DescriptionID of the task the comment belongs to
Fielddata.commentId Typenumber DescriptionComment ID from the path
Fielddata.createdBy Typenumber DescriptionID of the employee on whose behalf the call is made, not of the comment author. List: GET /v1/users
Fielddata.createdAt Typestring DescriptionDate and time of the comment, not of the call, in ISO 8601 format with a time zone offset
Fielddata.updatedAt Typestring DescriptionDate and time of the last change, in the same format. For a new result it matches createdAt
Fielddata.status Typenumber DescriptionResult status: 0 — open, 1 — closed
Fielddata.text Typestring DescriptionComment text. May contain BB code markup
Fielddata.formattedText Typestring DescriptionThe same text with BB code markup converted to HTML
Fielddata.files Typearray | null DescriptionIDs of the result files. A result without files has null, or an empty array with params.WITH_FILE_INFO = Y. File data is in fileInfo
Fielddata.fileInfo Typeobject DescriptionOnly with params.WITH_FILE_INFO = Y. File data, keyed by file ID. A result without files has an empty array []

Response example

Result created:

JSON
{
  "success": true,
  "data": {
    "id": 33,
    "taskId": 2079,
    "commentId": 8611,
    "createdBy": 1295,
    "createdAt": "2023-12-22T10:41:45+00:00",
    "updatedAt": "2023-12-22T10:41:45+00:00",
    "status": 0,
    "text": "22745",
    "formattedText": "22745",
    "files": null
  }
}

System comment, no result created:

JSON
{
  "success": true,
  "data": null
}

Error response example

422 — no comment with this commentId exists:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Comment not found.",
    "b24Code": "0"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptioncommentId is not a positive integer. Message: commentId must be a positive integer
HTTP400 CodeINVALID_PARAMS DescriptionThe body is not a JSON object. Message: body must be an object
HTTP400 CodeINVALID_PARAMS DescriptionThe body has a field other than params. Message: body contains unsupported fields
HTTP400 CodeINVALID_PARAMS Descriptionparams is not an object. Message: params must be an object
HTTP400 CodeINVALID_PARAMS Descriptionparams has a field other than WITH_FILE_INFO, or WITH_FILE_INFO is neither Y nor N. Message: params only accepts WITH_FILE_INFO as Y or N
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no Bitrix24 tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe key has no 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, such as application/xml
HTTP422 CodeBITRIX_ERROR DescriptionNo comment with this commentId exists. Message: Comment not found.
HTTP422 CodeBITRIX_ERROR DescriptionA result has already been created from the comment, and it is open. Message: Result already exists.
HTTP422 CodeBITRIX_ERROR DescriptionThe employee on whose behalf the call is made cannot read the task, or is neither the comment author nor a Bitrix24 account administrator. Message: Access denied.
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

A chat message ID does not work here. For a task with a chat, the comment list returns chat message IDs, while this method looks up an old-card comment by ID across all tasks of the Bitrix24 account. To turn a chat message into a result, use POST /v1/task-results/from-chat-message.

The call also changes the comment itself. The comment gets a result mark, and the task history — GET /v1/tasks/:taskId/history — gets a RESULT entry with the comment ID.

See also