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. The chat is determined from the message, so no dialogId is needed.

Parameters

Parameter Type Required Description
ParametermessageId (path) Typenumber Requiredyes DescriptionMessage ID, a positive integer — from the chat feed (GET /v1/chats/:dialogId/messages) or from the send response

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
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.result Typeboolean Descriptiontrue — 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
HTTP400 CodeINVALID_PARAMS DescriptionmessageId is not a positive integer, or the request has a body field or a query parameter. Checked before any call to Bitrix24
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 refused. The code is in error.b24Code: WRONG_SENDER — the message is not yours, MESSAGE_NOT_FOUND — the message does not exist
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 returned the NOT_FOUND code. The Bitrix24 code is in error.b24Code
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe user has no access to the chat — Bitrix24 refused with the ACCESS_DENIED code
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — see access rights
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured

Full list of common API errors — Errors.

Known specifics

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. By default, an edit in format=v2 mode rebuilds the preview from the links in the text, even after this operation. To keep the message without a preview, pass urlPreview: false when editing.

See also