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 department field reference with field types and read-only flags, 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

The table describes the response envelope and the schema fields in data.fields. For department fields, the type refers to the field value. Each schema field is an object with type, readonly, label, and description keys.

The label and description field captions are returned in English. Request headers do not switch the language.

Field Type RO Description
Fieldsuccess Typeboolean RO DescriptionAlways true on success
Fielddata Typeobject RO DescriptionDepartment schema and available operations
Fielddata.fields Typeobject RO DescriptionDictionary of department fields: each key is a field name, and each value is a metadata object. The dictionary fields are listed below
Fielddata.batch Typearray RO DescriptionWrite operations available in batch calls: create, update, delete
Fieldid Typenumber ROyes DescriptionDepartment identifier
Fieldname Typestring RO DescriptionDepartment name
FieldparentId Typenumber RO DescriptionParent department ID. For a top-level department pass 1 (the virtual root of the tree). Source: GET /v1/departments
FieldheadId Typenumber RO DescriptionDepartment head ID. Source: GET /v1/users. If no head is assigned, the value is 0 or the field is absent. It can point to an account that GET /v1/users does not return, such as a chatbot — see What to know before you start
Fieldsort Typenumber RO DescriptionSort 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 identifier of the department." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "Department name as displayed in the company structure." },
      "parentId": { "type": "number", "readonly": false, "label": "Parent department", "description": "ID of the parent department in the hierarchy; the top-level department specifies 1 — the virtual tree root." },
      "headId": { "type": "number", "readonly": false, "label": "Head", "description": "ID of the user assigned as the department head." },
      "sort": { "type": "number", "readonly": false, "label": "Sort order", "description": "Order of the department among its siblings at the same level; default is 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
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the department scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionRate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the x-ratelimit-limit header. Retry after the delay in the Retry-After header

For the full list of common API errors, see Errors.

See also