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
ParameterdialogId (path) Typestring Requiredyes DescriptionDialog 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

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/chats/chat456/pin \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
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

javascript
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

javascript
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
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.result Typeboolean Descriptiontrue — the chat is pinned. A repeated call for a chat that is already pinned also returns true

Response example

JSON
{
  "success": true,
  "data": {
    "result": true
  }
}

Error response example

422 — there is no chat with this dialogId in the Bitrix24 account:

JSON
{
  "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
HTTP400 CodeINVALID_PARAMS DescriptionA query parameter or a body field was passed. Checked before the Bitrix24 call
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 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
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 answered "not found"; the Bitrix24 code is in error.b24Code
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionThe user could not be resolved for the me alias
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe user has no access to the chat
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionRead-only key: pinning is a write, see access rights
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 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.

See also