For AI agents: markdown of this page — /docs-content-en/chats/messages/disappear.md documentation index — /llms.txt
Disappearing message
POST /v1/chats/messages/:messageId/disappear
Irreversible: after the given time the message is deleted for all members; the timer cannot be cancelled and the delay cannot be changed. The chat is determined from the message, so no dialogId is needed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
messageId (path) |
number | yes | Message ID, a positive integer — from the chat feed (GET /v1/chats/:dialogId/messages) or from the send response |
Request body fields
| Field | Type | Required | Description |
|---|---|---|---|
hours |
number | yes | Delay before the message is deleted, in hours: 1, 24, 168 (a week) or 720 (30 days). A number or a digit string |
Other body fields and query parameters are rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X POST https://vibecode.bitrix24.com/v1/chats/messages/1002/disappear \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "hours": 24 }'
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/chats/messages/1002/disappear \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hours": 24 }'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/1002/disappear', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ hours: 24 }),
})
const { success } = await res.json()
console.log('Timer set:', success)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/1002/disappear', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ hours: 24 }),
})
const { success } = await res.json()
console.log('Timer set:', success)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data |
boolean | true — the deletion timer is set |
Response example
{
"success": true,
"data": true
}
Error response example
422 — the delay is not on the Bitrix24 account's list:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "WRONG_MESSAGES_AUTO_DELETE_DELAY",
"b24Code": "WRONG_MESSAGES_AUTO_DELETE_DELAY"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
messageId is not a positive integer, hours is missing or is not a positive integer, or the request has an extra body field or a query parameter. Checked before any call to Bitrix24 |
| 422 | BITRIX_ERROR |
Bitrix24 refused. The code is in error.b24Code: WRONG_MESSAGES_AUTO_DELETE_DELAY — the delay is not on the list, ALREADY_DISAPPEARING — the timer is already set, MESSAGE_NOT_FOUND — the message does not exist |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 returned the NOT_FOUND code. The portal code is in error.b24Code |
| 403 | BITRIX_ACCESS_DENIED |
No permission to delete the message for all members |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only — see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
The full list of common API errors — Errors.
Known specifics
The Bitrix24 account owns the list of delays. The platform checks only that hours is a positive integer. The Bitrix24 account sets the allowed values, and any other value gets 422 BITRIX_ERROR with WRONG_MESSAGES_AUTO_DELETE_DELAY.