For AI agents: markdown of this page — /docs-content-en/chats/messages/url-preview.md documentation index — /llms.txt

Remove a link preview

DELETE /v1/chats/messages/:messageId/url-preview

Removes the link preview card from your message; the message text stays. No operation brings the removed preview back, but editing the message in the format=v2 mode builds the preview anew from the links of the text unless you pass urlPreview: false. The endpoint calls the v2 messenger method im.v2.Chat.Message.deleteRichUrl. 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

The request accepts no body and no query parameters: any field is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/chats/messages/1002/url-preview \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/chats/messages/1002/url-preview \
  -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/messages/1002/url-preview', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { success } = await res.json()
console.log('Preview removed:', success)

JavaScript — OAuth application

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

const { success } = await res.json()
console.log('Preview removed:', success)

Response fields

Field Type Description
success boolean Always true on success
data.result boolean true — the preview is removed

Response example

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

Error response example

422 — the message is not yours:

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

Errors

HTTP Code Description
400 INVALID_PARAMS messageId is not a positive integer, or the request has a body field or a query parameter. Checked before any call to Bitrix24
422 BITRIX_ERROR Bitrix24 refused; the code is in error.b24Code: WRONG_SENDER — the message is not yours, 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 The user has no access to the chat — Bitrix24 refused with the ACCESS_DENIED code
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

Your own messages only. Only the message author can remove the preview; for someone else's message the response is WRONG_SENDER.

No preview from the start. To keep the preview from appearing at all, send the message with urlPreview: false — see sending a message.

An edit brings the preview back. An edit in the format=v2 mode builds the preview anew from the links of the text by default — after this operation too. To keep the message without a preview, pass urlPreview: false when editing.

See also