For AI agents: markdown of this page — /docs-content-en/chats/messages/pins-delete.md documentation index — /llms.txt
Unpin a message
DELETE /v1/chats/messages/:messageId/pin
Unpins a message: it is removed from its chat's list of pinned messages. The chat is resolved from the message, so no dialogId is needed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
messageId (path) |
number | yes | ID of the pinned message, a positive integer — the messageId field from the list of pinned messages |
No body and no query parameters are accepted: any body field or query parameter is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/messages/1001/pin" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/messages/1001/pin" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/1001/pin', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success } = await res.json()
console.log('Unpinned:', success)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/1001/pin', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success } = await res.json()
console.log('Unpinned:', success)
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data |
array | An empty array |
Response example
{
"success": true,
"data": []
}
Error response example
422 — there is no such message:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "MESSAGE_NOT_FOUND",
"b24Code": "MESSAGE_NOT_FOUND"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
messageId is not a positive integer, or a body field or query parameter was passed. Checked before any call to Bitrix24 |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 reported "not found"; the portal code is in error.b24Code |
| 422 | BITRIX_ERROR |
Bitrix24 returned an error; the code is in error.b24Code, for example MESSAGE_NOT_FOUND — there is no such message |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
A read-only key cannot unpin messages — see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
Full list of common API errors — Errors.
Known specifics
Unpinning again succeeds. Unpinning a message that is not pinned returns the same response as unpinning a pinned one. You do not need to check whether the message is pinned before the call.