[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Fdisappear":3,"docs-tabs-chats\u002Fmessages\u002Fdisappear":6},{"content":4,"lastmod":5},"## Disappearing message\n\n`POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Fdisappear`\n\n**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.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `messageId` (path) | number | yes | Message ID, a positive integer — from the [chat feed](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) (`GET \u002Fv1\u002Fchats\u002F:dialogId\u002Fmessages`) or from the [send](\u002Fdocs\u002Fchats\u002Fmessages\u002Fsend) response |\n\n## Request body fields\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `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 |\n\nOther body fields and query parameters are rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fdisappear \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"hours\": 24 }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fdisappear \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"hours\": 24 }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fdisappear', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ hours: 24 }),\n})\n\nconst { success } = await res.json()\nconsole.log('Timer set:', success)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fdisappear', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ hours: 24 }),\n})\n\nconst { success } = await res.json()\nconsole.log('Timer set:', success)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | boolean | `true` — the deletion timer is set |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": true\n}\n```\n\n## Error response example\n\n422 — the delay is not on the Bitrix24 account's list:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"WRONG_MESSAGES_AUTO_DELETE_DELAY\",\n    \"b24Code\": \"WRONG_MESSAGES_AUTO_DELETE_DELAY\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 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 |\n| 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 |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned the `NOT_FOUND` code. The portal code is in `error.b24Code` |\n| 403 | `BITRIX_ACCESS_DENIED` | No permission to delete the message for all members |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**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`.\n\n## See also\n\n- [Delete a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fdelete)\n- [Send a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fsend)\n","2026-10-07",{},1794739547054]