لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/humanresources.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Human resources
Organizational structure of a Bitrix24 account: departments and teams, their members and employees. The API lets you build and change the department tree, manage node membership, and search employees — without going through the account UI.
Scope: humanresources | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: X-Api-Key
Documentation sections
- Org-structure nodes — create, read, update, list, search, and count departments and teams (6 endpoints).
- Node operations — child nodes, counter, moving within the tree, communication channels (5 endpoints).
- Node members — add, remove, move, and fully replace membership with roles (4 endpoints).
- Employees — search by name, subordinates, count, membership in several departments (4 endpoints).
What to know up front
- A node is a department or a team. The type is set by the
typevalue:DEPARTMENT(department) orTEAM(team). Thetypeparameter is required when listing (node list) and when creating. - Nodes cannot be deleted via the API. The section has no node-delete endpoint — the tree changes by creating, updating, and moving nodes.
- Member roles depend on the node type. For a department —
MEMBER_HEAD,MEMBER_DEPUTY_HEAD,MEMBER_EMPLOYEE. For a team —MEMBER_TEAM_HEAD,MEMBER_TEAM_DEPUTY_HEAD,MEMBER_TEAM_EMPLOYEE. See the Node members section for the full list. - Membership is returned only when fetching a single node. The node list and search return summary fields without members — membership is returned in the Get node response.
- Nodes can be listed by type only. Narrowing the output by an arbitrary node field is not supported. To find nodes by a substring of the name, use node search —
typeandnameare required. - The response shape depends on the endpoint. Node listing and search return an array in a flat
dataplusmeta(total,hasMore). Child nodes and employee search nest the array indata.items. Counters and single nodes return an object indata. See each endpoint's "Response fields" section for the exact shape.
Full example
A JavaScript scenario: create a department, nest a sub-department inside it, assign a head, view the tree, and move the sub-department to the top level.
const VIBE_KEY = process.env.VIBE_KEY
const BASE = 'https://vibecode.bitrix24.com/v1'
async function api(method, path, body = null) {
const opts = { method, headers: { 'X-Api-Key': VIBE_KEY } }
if (body) {
opts.headers['Content-Type'] = 'application/json'
opts.body = JSON.stringify(body)
}
const res = await fetch(`${BASE}${path}`, opts)
if (!res.ok) throw new Error(`${method} ${path} → ${res.status}`)
return res.json()
}
// 1. Create a department at the top level
const { data: parent } = await api('POST', '/humanresources/nodes', {
type: 'DEPARTMENT',
name: 'Development department',
parentId: 1,
})
console.log(`Department created: ${parent.id}`)
// 2. Create a sub-department inside it
const { data: child } = await api('POST', '/humanresources/nodes', {
type: 'DEPARTMENT',
name: 'Testing group',
parentId: parent.id,
})
// 3. Assign the department head
await api('POST', `/humanresources/nodes/${parent.id}/members/add`, {
userIds: [42],
role: 'MEMBER_HEAD',
})
// 4. View the department's child nodes
const { data: children } = await api('GET', `/humanresources/nodes/${parent.id}/children`)
console.log(`Child nodes: ${children.items.length}`)
// 5. Move the sub-department to the top level
await api('POST', `/humanresources/nodes/${child.id}/move`, { parentId: 1 })
console.log('Sub-department moved to the top level')
Endpoint reference
All 19 endpoints of the section. Links lead to pages with parameters, examples, and error codes.
Org-structure nodes:
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| MethodGET | Path/v1/humanresources/nodes |
Bitrix24 methodhumanresources.node.list | DescriptionList of nodes of the selected type |
| MethodGET | Path/v1/humanresources/nodes/:id |
Bitrix24 methodhumanresources.node.get | DescriptionNode with its membership |
| MethodPOST | Path/v1/humanresources/nodes |
Bitrix24 methodhumanresources.node.add | DescriptionCreate a department or team |
| MethodPATCH | Path/v1/humanresources/nodes/:id |
Bitrix24 methodhumanresources.node.edit | DescriptionUpdate a node |
| MethodPOST | Path/v1/humanresources/nodes/search |
Bitrix24 methodhumanresources.node.search | DescriptionSearch nodes by name |
| MethodPOST | Path/v1/humanresources/nodes/aggregate |
Bitrix24 methodhumanresources.node.list | DescriptionCount nodes of a given type and compute numeric aggregates |
Node operations:
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| MethodGET | Path/v1/humanresources/nodes/:id/children |
Bitrix24 methodhumanresources.node.children | DescriptionChild nodes |
| MethodGET | Path/v1/humanresources/nodes/count |
Bitrix24 methodhumanresources.node.count | DescriptionNumber of nodes by type |
| MethodPOST | Path/v1/humanresources/nodes/:id/move |
Bitrix24 methodhumanresources.node.move | DescriptionMove a node within the tree |
| MethodGET | Path/v1/humanresources/nodes/:id/communications |
Bitrix24 methodhumanresources.node.communication.list | DescriptionNode communication channels |
| MethodPATCH | Path/v1/humanresources/nodes/:id/communications |
Bitrix24 methodhumanresources.node.communication.edit | DescriptionConfigure communication channels |
Node members:
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| MethodPOST | Path/v1/humanresources/nodes/:id/members/add |
Bitrix24 methodhumanresources.node.member.add | DescriptionAdd members |
| MethodPOST | Path/v1/humanresources/nodes/:id/members/remove |
Bitrix24 methodhumanresources.node.member.remove | DescriptionRemove members |
| MethodPOST | Path/v1/humanresources/nodes/:id/members/move |
Bitrix24 methodhumanresources.node.member.move | DescriptionMove members |
| MethodPOST | Path/v1/humanresources/nodes/:id/members/set |
Bitrix24 methodhumanresources.node.member.set | DescriptionReplace membership |
Employees:
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| MethodPOST | Path/v1/humanresources/employees/search |
Bitrix24 methodhumanresources.employee.search | DescriptionSearch employees by name |
| MethodGET | Path/v1/humanresources/employees/:id/subordinates |
Bitrix24 methodhumanresources.employee.subordinates | DescriptionEmployee subordinates |
| MethodGET | Path/v1/humanresources/employees/count |
Bitrix24 methodhumanresources.employee.count | DescriptionNumber of employees |
| MethodPOST | Path/v1/humanresources/employees/multidepartment |
Bitrix24 methodhumanresources.employee.multidepartment | DescriptionEmployees in several departments |
Error codes
Section errors
| Code | HTTP | Description |
|---|---|---|
CodeMISSING_REQUIRED_PARAMS |
HTTP400 | DescriptionThe required type parameter was not passed when listing nodes |
CodeINVALID_PARAMS |
HTTP400 | DescriptionInvalid :id in manual operations (id must be a positive integer) or request-body validation failed |
CodeENTITY_NOT_FOUND |
HTTP404 | DescriptionNode with the given id not found |
CodeNOT_FOUND |
HTTP404 | DescriptionUnknown member operation in the path (allowed: add, remove, move, set) |
CodeBITRIX_ERROR |
HTTP422 | DescriptionAn unsupported filter was passed when listing nodes |
System errors
| Code | HTTP | Description |
|---|---|---|
CodeSCOPE_DENIED |
HTTP403 | DescriptionThe key lacks the humanresources scope |
CodeTOKEN_MISSING |
HTTP401 | DescriptionThe API key has no Bitrix24 tokens configured |
CodeBITRIX_ACCESS_DENIED |
HTTP403 | DescriptionInsufficient permissions on the Bitrix24 portal |
CodeBITRIX_UNAVAILABLE |
HTTP502 | DescriptionThe Bitrix24 portal is unavailable |
Full reference of common errors — Errors.