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

Transfer chat ownership

POST /v1/chats/:chatId/owner

Transfers group chat owner rights to another participant. The new owner must already be a member of the chat.

Parameters

Parameter Type Required Description
chatId (path) number yes Chat ID (positive integer)

Request fields (body)

Field Type Required Description
userId number yes ID of the user to transfer ownership to. The user must be a participant of the chat. Participant list: GET /v1/chats/:chatId/users

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/chats/456/owner \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "userId": 42 }'

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/chats/456/owner \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "userId": 42 }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/456/owner', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userId: 42 }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/456/owner', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userId: 42 }),
})

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

Response fields

Field Type Description
success boolean Always true on success
data boolean true when ownership was transferred successfully

Response example

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

Error response example

422 — the ownership transfer condition was violated:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Change owner can only owner and user must be member in chat"
  }
}

Errors

HTTP Code Description
400 MISSING_PARAMS The userId field is missing or is not a positive integer
422 BITRIX_ERROR Only the current owner can transfer ownership, and the new owner must be a chat participant
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error
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

If the target participant is not yet in the chat, add them via POST /v1/chats/:chatId/users before calling this endpoint.

Owner leaving the chat. The chat creator remains the owner even after calling POST /v1/chats/:chatId/leave — leaving does not remove the owner status. To leave a chat completely: first transfer ownership to another participant with this endpoint, then call leave.

See also