For AI agents: markdown of this page — /docs-content-en/chats/management/permissions-messages.md documentation index — /llms.txt

Set the permission to post messages

PUT /v1/chats/:dialogId/permissions/messages

Sets who in a chat can post and pin messages: all members, managers and the owner, the owner only, or nobody.

Parameters

Parameter Type Required Description
ParameterdialogId (path) Typestring Requiredyes DescriptionDialog ID: chatXXX for a group chat, a numeric user ID for private messages, me — the current user's personal dialog. The value is the dialogId field of recent dialogs. A CRM entity chat is found via Find a CRM entity chat

The operation takes no query parameters: any parameter in the query string is refused with 400 INVALID_PARAMS.

Request fields (body)

Field Type Required Description
FieldrightsLevel Typestring Requiredyes DescriptionWho holds the permission: MEMBER — all members, MANAGER — managers and the owner, OWNER — the owner only, NONE — nobody. Case does not matter: manager and MANAGER are equivalent

Other body fields are refused with 400 INVALID_PARAMS, and the message names the extra field.

Right after a group chat is created, the permission value is MEMBER.

Examples

The examples let only the owner post to the chat.

curl — personal key

Terminal
curl -X PUT https://vibecode.bitrix24.com/v1/chats/chat2741/permissions/messages \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rightsLevel": "OWNER"}'

curl — OAuth application

Terminal
curl -X PUT https://vibecode.bitrix24.com/v1/chats/chat2741/permissions/messages \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"rightsLevel": "OWNER"}'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2741/permissions/messages', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ rightsLevel: 'OWNER' }),
})

const { success } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2741/permissions/messages', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ rightsLevel: 'OWNER' }),
})

const { success } = await res.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeboolean Descriptiontrue — the permission is saved

Response example

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

Error response example

400 — the request sets rightsLevel to "ALL", a value outside the operation's set:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Body field `rightsLevel` must be one of MEMBER, NONE, OWNER, MANAGER (any case)."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionThe body has no rightsLevel, or the value is not in the operation's set: MEMBER, MANAGER, OWNER, NONE. The message lists the allowed values
HTTP400 CodeINVALID_PARAMS DescriptionThe body has a field other than rightsLevel
HTTP400 CodeINVALID_PARAMS DescriptionThe request body is not a JSON object
HTTP400 CodeINVALID_PARAMS DescriptionThe query string has a parameter
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 refused: the user is not a chat member, or the settings permission does not let them change permissions. The same error is returned for a collab chat, even to its owner
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned an error, and the Bitrix24 code is in error.b24Code. A missing chat gives CHAT_NOT_FOUND
HTTP403 CodeSCOPE_DENIED DescriptionThe API key lacks the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only — changing permissions counts as a write
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured Bitrix24 tokens
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptiondialogId=me — the current user's ID could not be resolved
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unavailable or returned a server error

All 400 refusals happen before the Bitrix24 call.

Full list of common API errors — Errors.

Known specifics

Current value. The permissions.manageMessages field of the Dialog details response returns the permission in lower case, for example owner. The permissions.canPost field there repeats manageMessages.

See also