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, and the timer cannot be cancelled. Wraps the v2 messenger method im.v2.Chat.Message.disappear. 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 response of sending

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

Terminal
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

Terminal
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

javascript
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

javascript
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

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

Error response example

422 — the delay is not on the Bitrix24 account's list:

JSON
{
  "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

Full list of common API errors — Errors.

Known specifics

The Bitrix24 account owns the list of delays. The route checks only that hours is a positive integer; Bitrix24 decides which values are allowed and rejects any other value with WRONG_MESSAGES_AUTO_DELETE_DELAY.

The timer is set once. A repeated call for the same message returns ALREADY_DISAPPEARING; the delay cannot be changed.

The right to delete for everyone is required. The Bitrix24 account decides who may delete a message completely; without that right the response is 403 BITRIX_ACCESS_DENIED.

See also