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

Set the "unread" mark

POST /v1/chats/:dialogId/unread

Sets the "unread" mark on the chat's row in the recent dialog list — the mark the messenger shows after the "Mark as unread" command. The mark is independent of the unread message counter: it neither marks messages as read nor makes them unread.

Parameters

Parameter Type Required Default Description
dialogId (path) string yes — Dialog ID: chatXXX for a group chat, a user ID for a direct dialog, or the me alias. Dialog list — Recent dialogs

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/chat123/unread" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat123/unread" \
  -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/chat123/unread', {
  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/chat123/unread', {
  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.result boolean Always true, see "Known specifics"

Response example

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

Error response example

400 — a body field was sent:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `unread` is not accepted by POST /v1/chats/:dialogId/unread. It takes no body fields."
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS 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. Rejected before any call to Bitrix24
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 chat that does not exist — CHAT_NOT_FOUND
502 ME_ALIAS_RESOLUTION_FAILED Failed to resolve the user when using the me alias
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error

Full list of common API errors — Errors.

Known specifics

  • The call does not report whether the mark was set. The response data.result: true arrives regardless of the outcome: when the chat is not in the current user's recent dialog list — for example, the chat was hidden from the list — the mark is not set, but the response is the same. To check the result, read the unread field of the chat's row in the recent dialog list in the v2 mode or isMarkedAsUnread in the counters.
  • A repeated call on a marked chat changes nothing: the "read later" pointer, if set, stays where it was.

See also