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 reference 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

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

Field Type RO Description
id number yes Department identifier
name string Department name
parentId number Parent department ID. For a top-level department pass 1 (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 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
403 SCOPE_DENIED The API key does not have the department scope
401 TOKEN_MISSING The API key has no configured tokens
429 RATE_LIMITED Rate limit exceeded: 300 requests per minute per portal, all API keys of the portal share one limit. The exact value arrives in the x-ratelimit-limit header (the cap is divided across replicas). Retry after the delay in the Retry-After header

Full list of common API errors — Errors.

See also