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

Terminal
curl "https://vibecode.bitrix24.com/v1/departments/fields" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/departments/fields" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
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

javascript
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

JSON
{
  "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:

JSON
{
  "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