For AI agents: markdown of this page — /docs-content-en/openlines/crm/members-delete.md documentation index — /llms.txt
Remove an employee from a CRM chat
DELETE /v1/openlines/crm/chats/users
Removes an employee from an Open Channels chat linked to a lead, deal, contact or company, when the colleague no longer takes part in the conversation about the CRM card.
Request fields (body)
The fields are passed in the JSON body, not in the query string.
| Field | Type | Required | Description |
|---|---|---|---|
FieldcrmEntityType |
Typestring | Requiredyes | DescriptionCRM object type: lead, deal, company, contact. Case-insensitive |
FieldcrmEntityId |
Typenumber | Requiredyes | DescriptionCRM object ID, a positive integer. List: GET /v1/leads, GET /v1/deals, GET /v1/companies, GET /v1/contacts |
FielduserId |
Typenumber | Requiredyes | DescriptionID of the employee to remove from the chat. List: GET /v1/users |
FieldchatId |
Typenumber | Requiredno | DescriptionID of an Open Channels chat of this CRM object. List: GET /v1/openlines/crm/chats with activeOnly=false. Without the field, the object's last chat is used |
Examples
curl — personal key
curl -X DELETE "https://vibecode.bitrix24.com/v1/openlines/crm/chats/users" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"crmEntityType": "deal", "crmEntityId": 42, "userId": 7, "chatId": 123}'
curl — OAuth application
curl -X DELETE "https://vibecode.bitrix24.com/v1/openlines/crm/chats/users" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"crmEntityType": "deal", "crmEntityId": 42, "userId": 7, "chatId": 123}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/crm/chats/users', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
crmEntityType: 'deal',
crmEntityId: 42,
userId: 7,
chatId: 123,
}),
})
const { success, data } = await res.json()
console.log('Chat:', data.chatId)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/crm/chats/users', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
crmEntityType: 'deal',
crmEntityId: 42,
userId: 7,
chatId: 123,
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue when the employee is removed |
Fielddata.chatId |
Typenumber | DescriptionID of the chat the employee was removed from. Without chatId in the request, the last chat of the CRM object |
Fielddata.userId |
Typenumber | DescriptionID of the removed employee |
Fielddata.deleted |
Typeboolean | DescriptionAlways true |
Response example
{
"success": true,
"data": {
"chatId": 123,
"userId": 7,
"deleted": true
}
}
Error response example
404 — the CRM object has no Open Channels chats:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "CRM chat not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe body is not a JSON object, crmEntityType is missing or not in the list, crmEntityId or userId is missing or not a positive integer |
| HTTP400 | CodeINVALID_JSON_BODY |
DescriptionThe request body cannot be parsed as JSON |
| HTTP400 | CodeINVALID_CHAT_ID |
DescriptionchatId is passed but is not a positive integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionMessage CRM chat not found: the CRM object has no Open Channels chats, including finished ones, or chatId is not one of them. The check runs before the write, so chat membership does not change |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionMessage Record not found: Bitrix24 did not find the chat when removing the employee |
| HTTP422 | CodeBITRIX_ERROR |
Descriptionerror.b24Code equals CHAT_NOT_IN_CRM: Bitrix24 did not confirm that the chat is linked to the CRM object |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the request for another reason. The text is in message |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access to the key owner due to insufficient permissions |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key does not have the imopenlines scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header was not passed |
| HTTP401 | CodeINVALID_API_KEY |
DescriptionThe key is not recognized |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionA personal key has no access to the Bitrix24 portal, or an application key was sent without a session token in Authorization |
| HTTP429 | CodeRATE_LIMITED |
DescriptionThe limit of 120 requests per minute per portal is exceeded. The limit is divided across platform replicas, so the code may arrive before the 120th request. The effective value for the key is in the x-ratelimit-limit header, the remaining quota in x-ratelimit-remaining |
| HTTP429 | CodeRATE_LIMITED |
DescriptionBitrix24 rejected the call because the portal's request rate limit was exceeded. The response carries a Retry-After header |
| HTTP502 | CodeOPENLINE_OPERATOR_FAILED |
DescriptionBitrix24 returned an unexpected write result: not a chat ID, or a chat other than the passed chatId |
| HTTP502 | CodeOPENLINE_OPERATOR_FAILED |
DescriptionThe card's chat list arrived in an unexpected shape. The check runs before the write, so chat membership does not change |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable |
| HTTP503 | CodeBITRIX_TIMEOUT |
DescriptionBitrix24 did not respond in time, so the result is unknown. Check the chat membership before retrying |
Full list of common API errors — Errors.