[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Fpins-delete":3,"docs-tabs-chats\u002Fmessages\u002Fpins-delete":6},{"content":4,"lastmod":5},"## Unpin a message\n\n`DELETE \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Fpin`\n\nUnpins 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.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `messageId` (path) | number | yes | ID of the pinned message, a positive integer — the `messageId` field from the [list of pinned messages](\u002Fdocs\u002Fchats\u002Fmessages\u002Fpins) |\n\nNo body and no query parameters are accepted: any body field or query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Fpin\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X DELETE \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Fpin\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Fpin', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\n\nconst { success } = await res.json()\nconsole.log('Unpinned:', success)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Fpin', {\n  method: 'DELETE',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { success } = await res.json()\nconsole.log('Unpinned:', success)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | array | An empty array |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": []\n}\n```\n\n## Error response example\n\n422 — there is no such message:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"MESSAGE_NOT_FOUND\",\n    \"b24Code\": \"MESSAGE_NOT_FOUND\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `messageId` is not a positive integer, or a body field or query parameter was passed. Checked before any call to Bitrix24 |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 reported \"not found\"; the portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the code is in `error.b24Code`, for example `MESSAGE_NOT_FOUND` — there is no such message |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | A read-only key cannot unpin messages — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**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.\n\n## See also\n\n- [List pinned messages](\u002Fdocs\u002Fchats\u002Fmessages\u002Fpins)\n- [Pin a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fpins-create)\n- [Number of pinned messages](\u002Fdocs\u002Fchats\u002Fmessages\u002Fpins-count)\n- [Messages](\u002Fdocs\u002Fchats\u002Fmessages)\n","2026-10-06",{},1795415438645]