For AI agents: markdown of this page — /docs-content-en/humanresources/members/remove.md documentation index — /llms.txt

Remove members

POST /v1/humanresources/nodes/:id/members/remove

Removes one or more employees from the specified organizational structure node. A single call can remove several members at once — a separate result is returned for each one.

Parameters

Parameter Type Required Description
id (path) number yes Identifier of the node members are removed from. List of identifiers: GET /v1/humanresources/nodes?type=DEPARTMENT

Request body fields

Field Type Required Description
userIds array yes Identifiers of the employees to remove. Node membership: GET /v1/humanresources/nodes/:id (the members array)

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/humanresources/nodes/23/members/remove" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "userIds": [42, 108] }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/humanresources/nodes/23/members/remove" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "userIds": [42, 108] }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/humanresources/nodes/23/members/remove', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userIds: [42, 108] }),
})

const { success, data } = await res.json()
console.log('Removed:', data.removed.length, '— failed:', data.failed.length)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/humanresources/nodes/23/members/remove', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userIds: [42, 108] }),
})

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

Response fields

Field Type Description
success boolean Always true on success
data.removed array Identifiers of the successfully removed employees
data.failed array Employees that could not be removed
data.failed[].userId number Identifier of the employee that remained in the node
data.failed[].reason string Reason the employee was not removed

Response example

All specified employees removed:

JSON
{
  "success": true,
  "data": {
    "removed": [42, 108],
    "failed": []
  }
}

Some employees could not be removed — each one lands in failed with a reason:

JSON
{
  "success": true,
  "data": {
    "removed": [42],
    "failed": [
      {
        "userId": 108,
        "reason": "An employee cannot be removed from their primary department."
      }
    ]
  }
}

Error response example

400 — non-numeric id in the path:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "id must be a positive integer"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS Non-numeric id in the path — id must be a positive integer
404 NOT_FOUND Unknown verb in the path after members/. The message lists the allowed ones: move, remove, add, set
403 SCOPE_DENIED The key is missing the humanresources scope
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured

Full list of common API errors — Errors.

Known specifics

The response is always success: true, even if no one was removed. Some employees may land in failed with a rejection reason — for example, an employee cannot be removed from their primary department. Check the removed and failed arrays, not just the response code.

See also