---
sidebar_position: 3
description: Get departments and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get departments
 Gets a list of departments by ID or filter



`Function GetDepartments(Val URL, Val DepartmentID = "", Val Name = "", Val ParentID = "", Val HeadID = "", Val Token = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | URL of webhook or a Bitrix24 domain, when token used |
  | DepartmentID | --depid | String, Number | &#x2716; | Selection by department ID |
  | Name | --title | String | &#x2716; | Filter by name |
  | ParentID | --parentid | String, Number | &#x2716; | Filter by parent ID |
  | HeadID | --headid | String, Number | &#x2716; | Filter by manager ID |
  | Token | --token | String | &#x2716; | Access token, when app auth method used |

  
  Returns:  Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API

:::tip
Method at API documentation: [department.get](https://dev.1c-bitrix.ru/rest_help/departments/department_get.php)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    URL          = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";
    DepartmentID = "3090";

    Result = OPI_Bitrix24.GetDepartments(URL, DepartmentID);

    URL    = "b24-ar17wx.bitrix24.by";
    Token  = "6ad03969006e9f06006b12e400000001000...";
    HeadID = 1;

    Result = OPI_Bitrix24.GetDepartments(URL, , , , HeadID, Token);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint bitrix24 GetDepartments \
             --url "b24-ar17wx.bitrix24.by" \
             --headid 1 \
             --token "***"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint bitrix24 GetDepartments ^
             --url "b24-ar17wx.bitrix24.by" ^
             --headid 1 ^
             --token "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "result": [
  {
   "ID": "3094",
   "NAME": "Subordinate department",
   "SORT": 500,
   "PARENT": "3092",
   "UF_HEAD": "1"
  },
  {
   "ID": "638",
   "NAME": "Подчиненное подразделение",
   "SORT": 500,
   "PARENT": "636",
   "UF_HEAD": "1"
  }
 ],
 "total": 2,
 "time": {
  "start": 1765396854,
  "finish": 1765396854.77359,
  "duration": 0.77358603477478,
  "processing": 0,
  "date_start": "2025-12-10T20:00:54+00:00",
  "date_finish": "2025-12-10T20:00:54+00:00",
  "operating_reset_at": 1765397454,
  "operating": 0
 }
}
```
