For AI agents: markdown of this page — /docs-content-en/entities/departments/get.md documentation index — /llms.txt

Get a department

GET /v1/departments/:id

Returns a single department by identifier with all its fields.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionDepartment ID

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/departments/47" \
  -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/47', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Department:', data.name, '— head ID', data.headId)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/departments/47', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionThe department. Field descriptions — Department fields
Fielddata.id Typenumber DescriptionDepartment ID
Fielddata.name Typestring DescriptionDepartment name
Fielddata.parentId Typenumber DescriptionParent department ID. Source: GET /v1/departments
Fielddata.headId Typenumber DescriptionDepartment head ID. Source: GET /v1/users. If no head is assigned, the value is 0 or the field is absent
Fielddata.sort Typenumber DescriptionDepartment order among siblings

Response example

JSON
{
  "success": true,
  "data": {
    "id": 47,
    "name": "Sales department",
    "sort": 500,
    "parentId": 1,
    "headId": 99
  }
}

Error response example

404 — department not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "department 9999 not found"
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo department with this ID was found
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the department scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens

Full list of common API errors — Errors.

See also