# List of departments bound to the unit

Call this interface to obtain the department list bound to the specified unit.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/contact/v3/unit/list_department
HTTP Method | GET
Rate Limit | [1000 per minute & 50 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | Obtain unit information(contact:unit:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
unit_id | string | Yes | Unit ID.<br>When you create a unit, you can get the unit ID in the returned result. You can also call the [Get Unit List](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/unit/list) interface to get the unit ID.<br>**Example value**: BU121
department_id_type | string | No | The department ID type in this call. For a detailed description of department IDs, see [Department ID Description](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/field-overview#23857fe0).<br>**Example value**: open_department_id<br>**Optional values are**:<br>- department_id：Supports user-defined department ID. When customizing the configuration, the deleted department_id can be reused, so the department_id is unique within the scope of the non-deleted department.<br>- open_department_id：The department ID is automatically generated by the system. The ID prefix is ​​fixed as `od-` and is globally unique within the tenant.<br>**Default value**: `open_department_id`
page_token | string | No | Page identifier. It is not filled in the first request, indicating traversal from the beginning; when there will be more groups, the new page_token will be returned at the same time, and the next traversal can use the page_token to get more groups<br>**Example value**: AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JKiSIkdexPw
page_size | int | No | The paging size is used to limit the number of data items returned in one request.<br>**Example value**: 50<br>**Default value**: `50`<br>**Data validation rules**:<br>- Maximum value: `100`

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
departmentlist | unit_department\[\] | List of departments associated with a unit.
unit_id | string | Unit ID.
department_id | string | Department ID. You can call the [Get Single Department Information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/get) interface to get department details.
has_more | boolean | Whether the response body has more parameters
page_token | string | Page identifier, when has_more is true, a new page_token will also be returned. Otherwise, page_token will not be returned

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "departmentlist": [
            {
                "unit_id": "BU121",
                "department_id": "od-4e6ac4d14bcd5071a37a39de902c7141"
            }
        ],
        "has_more": true,
        "page_token": "AQD9/Rn9eij9Pm39ED40/dk53s4Ebp882DYfFaPFbz00L4CMZJrqGdzNyc8BcZtDbwVUvRmQTvyMYicnGWrde9X56TgdBuS+JdtW"
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
500 | 40003 | internal error | Internal error. Please obtain the X-Request-Id of the request and provide feedback to [Technical Support](https://applink.feishu.cn/TLJpeNdW).
400 | 40011 | page size is invalid | The page_size is invalid. You need to refer to the page_size parameter description in the interface documentation and set the correct value.
400 | 40012 | page token is invalid | page_token is invalid. You need to refer to the page_token parameter description in the API documentation and set the correct value.
400 | 43051 | unit_id invalid | Illegal unit ID. Call the [Get unit list](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/unit/list) interface to get the correct unit ID and try again.

For more error code information, see [General error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

