Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/topapi/v2/department/listsub |
| HTTP Method | POST |
| Supported app types | appType-Internal appappType-Third-party enterprise app |
| Permissions | permission-qyapi_get_department_list-Read permission for department information in Contacts |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The app credential used to call this API. - For an internal app, get it by calling the API for getting the access_token of an internal app. - For a third-party enterprise app, get it by calling the API for getting the access_token of a third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| dept_id | Number | No | 1 | The parent department ID. Call the Get the department list API to get the value of the dept_id parameter. |
| language | String | No | zh_CN | The language of Contacts: - zh_CN (default): Chinese - en_US: English |
Request example
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | 5um7ykyaalsj | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | Invalid access_token | The error message returned when the call failed. |
| result | DeptBaseResponse[] | The department list. | |
| dept_id | Number | 100 | The department ID. |
| name | String | HR | The department name. |
| parent_id | Number | 50 | The parent department ID. |
| create_dept_group | Boolean | true | Whether to create an organization chat associated with this department at the same time: - true: Create - false: Do not create |
| auto_add_user | Boolean | false | After the Department Chat is created, whether new members who join the department are automatically added to the chat: - true: Automatically added - false: Not added |
Response example
Error codes
If the API call returns an error, find the solution in the Global error codes document based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 60003 | Department not found | Verify that the dept_id is correct. |
| 400002 | Invalid parameter | Verify that the parameters are entered as required. |
| -1 | System busy | Try again later. |