For AI agents: markdown of this page — /docs-content-en/chats/management/pin.md documentation index — /llms.txt
Pin a chat
POST /v1/chats/:dialogId/pin
Pins 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.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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 |
No request body is sent. Any query parameter or body field is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X POST https://vibecode.bitrix24.com/v1/chats/chat456/pin \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/chats/chat456/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/chat456/pin', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success, data } = await res.json()
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat456/pin', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.result |
boolean | true — the chat is pinned. A repeated call for a chat that is already pinned also returns true |
Response example
{
"success": true,
"data": {
"result": true
}
}
Error response example
422 — there is no chat with this dialogId in the Bitrix24 account:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "CHAT_NOT_FOUND",
"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 /v1/bots/:botId/chats if needed.",
"b24Code": "CHAT_NOT_FOUND"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
A query parameter or a body field was passed. Checked before the Bitrix24 call |
| 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 |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 answered "not found"; the Bitrix24 code is in error.b24Code |
| 502 | ME_ALIAS_RESOLUTION_FAILED |
The user could not be resolved for the me alias |
| 403 | BITRIX_ACCESS_DENIED |
The user has no access to the chat |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
Read-only key: pinning is a write, see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
| 502 | BITRIX_UNAVAILABLE |
Bitrix24 is unavailable or returned a server error |
Full list of common API errors — Errors.
Known specifics
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 /v1/chats/messages/:messageId/pin, with the message ID in the path.
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.
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.
The limit is 45 pinned chats per user. To pin one more, first unpin one you no longer need.