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

Rename a chat

PATCH /v1/chats/:chatId

Changes the name of a group chat. The caller must be a member of the chat with permission to rename it.

Parameters

Parameter Type Required Description
chatId (path) number yes Numeric chat ID. Get it via POST /v1/chats or GET /v1/chats/recent
format (query) string no v2 turns on the v2 mode — see "The v2 mode" below. Any other value is ignored and the response is unchanged

The v2 mode. format=v2 changes a group chat as a whole in one call — the v2 messenger method im.v2.Chat.update: the name, description, avatar, owner, type, permissions, members and managers. The title field becomes optional, but at least one field is required. Every field is checked before any call to Bitrix24: an unknown field, a wrong type or a value outside the list is rejected with 400 INVALID_PARAMS naming the field. The v2 mode requires the permission to change the chat — the owner has it by default — rather than the rename permission, which is enough without the parameter. Bitrix24 checks the rest itself: it rejects a personal dialog with 422 BITRIX_ERROR and error.b24Code WRONG_MESSAGE_TYPE. In the response data is the object { result: true }. To only rename a chat under the rename permission, call the endpoint without format.

Request fields (body)

Field Type Required Description
title string yes New chat name. Cannot be empty. Optional in the v2 mode
description string no The v2 mode only. New description
avatar string | number no The v2 mode only. An image as a base64 string, or the ID of a Drive file the caller can read
ownerId number no The v2 mode only. Hand the chat over to this user
type string no The v2 mode only. Change the chat type; Bitrix24 checks whether the change is allowed and states the reason if it refuses
searchable string no The v2 mode only. Y — an open chat: any employee can find it and join
manageUi string no The v2 mode only. Who can change the name, description and avatar: MEMBER, MANAGER, OWNER
manageUsersAdd string no The v2 mode only. Who can add members: MEMBER, MANAGER, OWNER
manageUsersDelete string no The v2 mode only. Who can remove members: MEMBER, MANAGER, OWNER
manageMessages string no The v2 mode only. Who can post: NONE (nobody but the owner), MEMBER, MANAGER, OWNER
manageMessagesAutoDelete string no The v2 mode only. Who can turn on message auto-deletion: NONE, MEMBER, MANAGER, OWNER
manageGuestInvites string no The v2 mode only. Who can invite guests: NONE, MEMBER, MANAGER, OWNER
addedMemberEntities array no The v2 mode only. Members to add — [type, id] pairs: ["user", 5], ["department", "12:F"] (a department with its sub-departments), ["project", 3]
deletedMemberEntities array no The v2 mode only. Members to remove — [type, id] pairs of the same form
hideHistory string no The v2 mode only. Y — the added members do not see the earlier history
addedManagers array no The v2 mode only. IDs of users to make managers — positive integers
deletedManagers array no The v2 mode only. IDs of managers to demote — positive integers

Examples

curl — personal key

Terminal
curl -X PATCH https://vibecode.bitrix24.com/v1/chats/3663 \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Project Beta"
  }'

curl — OAuth application

Terminal
curl -X PATCH https://vibecode.bitrix24.com/v1/chats/3663 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Project Beta"
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/3663', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Project Beta',
  }),
})

const { success, data } = await res.json()
console.log('Renamed:', data) // true

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/3663', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Project Beta',
  }),
})

const { success, data } = await res.json()

curl — the v2 mode

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/chats/3663?format=v2" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Release discussion",
    "addedManagers": [27],
    "manageMessages": "MANAGER"
  }'

Response fields

Field Type Description
success boolean Always true on success
data boolean true when the rename succeeded
data.result boolean The v2 mode: true — the changes are applied

Response example

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

Error response example

400 — an empty title was passed:

JSON
{
  "success": false,
  "error": {
    "code": "TITLE_EMPTY",
    "message": "title is required and cannot be blank."
  }
}

Errors

HTTP Code Description
400 INVALID_CHAT_ID chatId is not a positive integer
400 TITLE_EMPTY The title field is missing or empty. Without format only
400 INVALID_PARAMS The v2 mode only: no field to change, the body is not a JSON object, an unknown field or a query parameter other than format, a wrong type or a value outside the list — the message names the field. Checked before any call to Bitrix24
404 CHAT_NOT_FOUND_OR_NO_ACCESS The chat does not exist or the caller has no permission to rename it. Without format only
404 ENTITY_NOT_FOUND The v2 mode: Bitrix24 returned "not found"; the portal code is in error.b24Code
422 BITRIX_ERROR The v2 mode: Bitrix24 returned an error; the portal code is in error.b24Code. A missing chat lands here with CHAT_NOT_FOUND, a personal dialog with WRONG_MESSAGE_TYPE
403 BITRIX_ACCESS_DENIED The v2 mode: the caller has no permission to change the chat — Bitrix24 refused with the ACCESS_DENIED code
403 SCOPE_DENIED The API key lacks the im scope
401 TOKEN_MISSING The API key has no configured tokens

Full list of common API errors — Errors.

Known specifics

An avatar in the request body. The request body is limited to 1 MiB, and base64 inflates an image by a third: the avatar field fits an image of up to about 750 KiB. Upload a larger image to Drive and pass the file ID.

Two permissions, two modes. Without format the chat is renamed by a member with the rename permission, and the endpoint first checks that the caller is a chat member. In the v2 mode the permission to change the chat is required, and Bitrix24 runs the checks.

See also