For AI agents: markdown of this page — /docs-content-en/chats/messages/personal-pins-create.md documentation index — /llms.txt
Pin a message for yourself
POST /v1/chats/messages/:messageId/pin/personal
Adds a message to the current user’s personal pins in the chat where the message was sent.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParametermessageId (path) |
Typeinteger | Requiredyes | DescriptionMessage id from message history |
Requires the im scope. The credentials identify the current user. The API rejects parameters that specify the owner and any unknown parameters.
The body may be absent or {}. No body fields or query parameters are accepted. Use an API key with write access.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/pin/personal" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/pin/personal" \
-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/845/pin/personal', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { data } = await res.json()
console.log(data)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/pin/personal', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
console.log(data)
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue |
Fielddata |
Typearray | DescriptionEmpty array — the message is pinned |
Response example
{
"success": true,
"data": []
}
Error response example
400 — unexpected parameter:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "Query parameter `ownerId` is not accepted by POST /v1/chats/messages/:messageId/pin/personal. It takes no query parameters."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionMalformed ID, or an unexpected or repeated parameter or body field |
| HTTP422 | CodeBITRIX_ERROR |
Descriptionerror.b24Code is MESSAGE_NOT_FOUND — there is no message with this id |
| HTTP422 | CodeBITRIX_ERROR |
Descriptionerror.b24Code is MESSAGE_IS_ALREADY_PERSONAL_PIN — the message is already among personal pins |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionNo API key was provided |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionNo Bitrix24 credentials are configured |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key does not have im scope |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe current user has no access |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key cannot change Bitrix24 data |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionThe record was not found |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 refused the operation with another code, which is in error.b24Code |