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 |
|---|---|---|---|---|
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
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/chat123/unread" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
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
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
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 |
|---|---|---|
success |
boolean | Always true on success |
data.chatId |
number | Chat ID |
data.lastId |
number | ID of the last read message |
data.counter |
number | Number of unread messages after the call — the mark does not affect it |
data.viewedMessages |
array | IDs of messages marked as read. Empty when the mark is cleared |
Response example
{
"success": true,
"data": {
"chatId": 123,
"lastId": 1002,
"counter": 0,
"viewedMessages": []
}
}
Error response example
422 — the chat is not in the recent dialog list:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "READ_RECENT_ITEM_NOT_FOUND_ERROR",
"b24Code": "READ_RECENT_ITEM_NOT_FOUND_ERROR"
}
}
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 |
| 403 | BITRIX_ACCESS_DENIED |
The chat does not exist or the user has no access to it |
| 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 outside the recent dialog list — READ_RECENT_ITEM_NOT_FOUND_ERROR |
| 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
- 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.