For AI agents: markdown of this page — /docs-content-en/chats/copilot/vote.md documentation index — /llms.txt

Rate an answer

POST /v1/chats/messages/:messageId/vote

Rates a message with "like" or "dislike". Meant for rating CoPilot answers.

Parameters

Parameter Type Required Description
ParametermessageId (path) Typenumber Requiredyes DescriptionMessage ID. Get it from data.messages[].id of the draft chat or of the message history in the v2 mode

Query parameters are not accepted and are rejected with 400 INVALID_PARAMS.

Request fields (body)

Field Type Required Description
Fieldvalue Typestring Requiredyes DescriptionThe rating: like or dislike

Other body fields are rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/chats/messages/9002/vote \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value": "like"}'

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/chats/messages/9002/vote \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"value": "like"}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/9002/vote', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ value: 'like' }),
})

const { success, data } = await res.json()
console.log('Rating sent:', data.result)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/9002/vote', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ value: 'like' }),
})

const { success, data } = await res.json()
console.log('Rating sent:', data.result)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.result Typeboolean Descriptiontrue — the rating was sent

Response example

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

Error response example

400 — an invalid value:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`value` must be `like` or `dislike`."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionmessageId is not a positive integer, value is missing or is neither like nor dislike, or another body field or a query parameter was sent. Checked before any call to Bitrix24
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 returned "not found". The portal code is in error.b24Code
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned an error. The portal code is in error.b24Code
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — the call may make the key owner a chat member
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured

Full list of common API errors — Errors.

Known specifics

The call may make you a member. If the message's chat allows auto-join — for example, a comment chat, a collab or a task chat — the call adds the current user as a member, just as opening the chat in the Bitrix24 interface does. The call therefore counts as a write.

Rating any message. The endpoint accepts a rating for any message and returns result: true. Only ratings of CoPilot answers in a CoPilot chat are taken into account. This endpoint cannot read a rating back.

See also