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

Read later

POST /v1/chats/messages/:messageId/mark

Marks the message's chat as unread and points the mark at this message — the v2 messenger method im.v2.Chat.Message.mark, the "Read later" command in the Bitrix24 interface. The chat is resolved from the message, so no dialogId is needed. Loading a chat returns the marked message as data.chat.markedId: the interface opens the chat at that message.

DELETE /v1/chats/:dialogId/unread clears the mark together with the pointer. The call is a write: a read-only key gets 403 WRITE_BLOCKED_READONLY_KEY before any call to Bitrix24.

Parameters

Parameter Type Required Default Description
messageId (path) number yes — Message ID, a positive integer

There are no query parameters and no body fields. Any query parameter or body field is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/1002/mark" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/1002/mark" \
  -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/chats/messages/1002/mark', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { success } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/1002/mark', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success } = await res.json()

Response fields

Field Type Description
success boolean Always true on success
data array An empty array

Response example

JSON
{
  "success": true,
  "data": []
}

Error response example

422 — the message's chat is not in the recent dialog list:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "MESSAGE_MARK_FAILED",
    "b24Code": "MESSAGE_MARK_FAILED"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS messageId is not a positive integer, a query parameter or a body field was sent, or the body is not a JSON object. Checked before any call to Bitrix24
403 SCOPE_DENIED The API key does not have the im scope
403 WRITE_BLOCKED_READONLY_KEY The key is read-only — the call changes the chat state
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured
404 ENTITY_NOT_FOUND Bitrix24 answered "not found"; the portal code is in error.b24Code
422 BITRIX_ERROR Bitrix24 returned an error; the portal code is in error.b24Code. A message that does not exist — MESSAGE_NOT_FOUND; a chat outside the recent dialog list — MESSAGE_MARK_FAILED
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error

Full list of common API errors — Errors.

Known specifics

  • The mark is set on the chat's row in the recent dialog list. When the chat is hidden from the list, Bitrix24 refuses the call with the code MESSAGE_MARK_FAILED; the row returns to the list when a new message arrives in the chat.
  • A marked chat is not re-marked. When the chat is already marked as unread — by an earlier "read later" or by POST /v1/chats/:dialogId/unread — Bitrix24 leaves the mark and the pointer as they are and answers with success. To point the mark at another message, first clear it with DELETE /v1/chats/:dialogId/unread, then call this endpoint.

See also