[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmanagement\u002Fpin":3,"docs-tabs-chats\u002Fmanagement\u002Fpin":6},{"content":4,"lastmod":5},"## Pin a chat\n\n`POST \u002Fv1\u002Fchats\u002F:dialogId\u002Fpin`\n\nPins a chat in the current user's dialog list: pinned chats appear at the top of the list on every page. The whole chat is pinned, not a message in it.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `dialogId` (path) | string | yes | Dialog ID: a numeric user ID for a direct dialog, `chatXXX` for a group chat, `me` for the current user's own dialog. Dialog list — [Recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) |\n\nNo request body is sent. Any query parameter or body field is 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\u002Fchat456\u002Fpin \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat456\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\u002Fchat456\u002Fpin', {\n  method: 'POST',\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat456\u002Fpin', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.result` | boolean | `true` — the chat is pinned. A repeated call for a chat that is already pinned also returns `true` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"result\": true\n  }\n}\n```\n\n## Error response example\n\n422 — there is no chat with this `dialogId` in the Bitrix24 account:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"CHAT_NOT_FOUND\",\n    \"hint\": \"dialogId must be a userId (number as string) for DMs or \\\"chat{N}\\\" for group chats. Examples: \\\"1\\\" for user 1, \\\"chat123\\\" for group chat 123. Create a group chat first via POST \u002Fv1\u002Fbots\u002F:botId\u002Fchats if needed.\",\n    \"b24Code\": \"CHAT_NOT_FOUND\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A query parameter or a body field was passed. Checked before the Bitrix24 call |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the Bitrix24 code is in `error.b24Code`. `FOLDER_PINS_LIMIT_EXCEEDED` — 45 chats are already pinned. `CHAT_NOT_FOUND` — there is no chat with this `dialogId` |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 answered \"not found\"; the Bitrix24 code is in `error.b24Code` |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | The user could not be resolved for the `me` alias |\n| 403 | `BITRIX_ACCESS_DENIED` | The user has no access to the chat |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | Read-only key: pinning is a write, see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**Pinning a chat and pinning a message are different operations.** This endpoint lifts the chat to the top of the dialog list. A message inside a chat is pinned through a separate path, `POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Fpin`, with the message ID in the path.\n\n**The pin is personal.** The chat is pinned only in the list of the user the call is made on behalf of; other members' lists do not change.\n\n**The call may make you a member.** When the chat allows auto-join — for example, a comment chat, a collab or a task chat — pinning adds the current user as a member, just as opening the chat in the Bitrix24 interface does.\n\n**The limit is 45 pinned chats per user.** To pin one more, first [unpin](\u002Fdocs\u002Fchats\u002Fmanagement\u002Funpin) one you no longer need.\n\n## See also\n\n- [Pinned chat order](\u002Fdocs\u002Fchats\u002Fmanagement\u002Fpin-sort)\n- [Unpin a chat](\u002Fdocs\u002Fchats\u002Fmanagement\u002Funpin)\n- [Recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent)\n- [Chat management](\u002Fdocs\u002Fchats\u002Fmanagement)\n","2026-09-30",{},1794739542253]