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

Clear the "unread" mark

DELETE /v1/chats/:dialogId/unread

Clears the "unread" mark from the chat's row in the recent dialog list together with the "read later" pointer — they cannot be cleared separately. Messages are not marked as read — use POST /v1/chats/:dialogId/read for that.

Parameters

Parameter Type Required Default Description
ParameterdialogId (path) Typestring Requiredyes Default— DescriptionDialog 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 DELETE "https://vibecode.bitrix24.com/v1/chats/chat123/unread" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X DELETE "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: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Unread messages:', data.counter)

JavaScript — OAuth application

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

const { data } = await res.json()
console.log('Unread messages:', data.counter)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.chatId Typenumber DescriptionChat ID
Fielddata.lastId Typenumber DescriptionID of the last read message
Fielddata.counter Typenumber DescriptionNumber of unread messages after the call — the mark does not affect it
Fielddata.viewedMessages Typearray DescriptionIDs of messages marked as read. Empty when the mark is cleared

Response example

JSON
{
  "success": true,
  "data": {
    "chatId": 123,
    "lastId": 1002,
    "counter": 0,
    "viewedMessages": []
  }
}

Error response example

422 — the chat is not in the recent dialog list:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionA query parameter or a body field was sent, or the body is not a JSON object. Checked before any call to Bitrix24
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — the call changes the chat state. Rejected before any call to Bitrix24
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe chat does not exist or the user has no access to it
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 answered "not found"; the portal code is in error.b24Code
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned an error; the portal code is in error.b24Code. A chat outside the recent dialog list — READ_RECENT_ITEM_NOT_FOUND_ERROR
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionFailed to resolve the user when using the me alias
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unavailable or returned a server error

Full list of common API errors — Errors.

Known specifics

  • A hidden chat returns to the recent dialog list when a new message arrives in it. Until then, the call for that chat is rejected.

See also