For AI agents: markdown of this page — /docs-content-en/entities/departments/fields.md documentation index — /llms.txt
Department fields
GET /v1/departments/fields
Returns the directory of department fields with their types and the read-only flag, along with the list of operations available in POST /v1/batch.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/departments/fields" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/departments/fields" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/departments/fields', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
console.log('Fields:', Object.keys(data.fields).length)
console.log('Available batch operations:', data.batch)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/departments/fields', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | RO | Description |
|---|---|---|---|
id |
number | yes | Department identifier |
name |
string | Department name | |
parentId |
number | Parent department ID. For a top-level department 1 is used (the virtual root of the tree). Source: GET /v1/departments |
|
headId |
number | Department head ID. Source: GET /v1/users |
|
sort |
number | Sort order of the department among its siblings (integer, ascending) |
Response example
{
"success": true,
"data": {
"fields": {
"id": { "type": "number", "readonly": true, "label": "ID", "description": "Unique department identifier." },
"name": { "type": "string", "readonly": false, "label": "Name", "description": "Department name shown in the company structure." },
"parentId": { "type": "number", "readonly": false, "label": "Parent department", "description": "ID of the parent department in the hierarchy. For a top-level department 1 is used — the virtual root of the tree." },
"headId": { "type": "number", "readonly": false, "label": "Head", "description": "ID of the user assigned as the department head." },
"sort": { "type": "number", "readonly": false, "label": "Sort", "description": "Order of the department among its siblings. Defaults to 500." }
},
"batch": ["create", "update", "delete"]
}
}
Error response example
403 — no scope:
{
"success": false,
"error": {
"code": "SCOPE_DENIED",
"message": "This endpoint requires 'department' scope"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 403 | SCOPE_DENIED |
The API key does not have the department scope |
| 401 | TOKEN_MISSING |
The API key has no configured tokens |
Full list of common API errors — Errors.
See also
- Create a department — which fields to pass
- Update a department — which fields can be changed
- List departments — filtering by these fields
- Batch — bulk operations
create,update,delete - Entity API — select to fetch only the needed fields