Get the sub-department ID list
API call description
- This API is not restricted by the authorization scope.
- This API only supports getting the ID list of the next level of departments.
Request
| Basic information | |
|---|---|
| HTTP URL | https://oapi.dingtalk.io/topapi/v2/department/listsubid |
| HTTP Method | POST |
| Supported app types | appType-Internal app, appType-Third-party enterprise app |
| Permissions | permission-qyapi_get_department_list-Read permission for Contacts department information |
Query parameter
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The app credential used to call this API. - For an internal app, get it through the API for getting the access_token of an internal app. - For a third-party enterprise app, get it through the API for getting the access_token of a third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| dept_id | Number | Yes | 1 | The parent department ID. Pass 1 for the root department. To get the dept_id value, call the Get the department list API. |
Request example
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | 48vhxdnwhve6 | The request ID. |
| errcode | Number | 0 | The return code. |
| errmsg | String | Invalid department ID | The error message returned when the call fails. |
| result | DeptListSubIdResponse | The returned result. | |
| dept_id_list | Number[] | [2,3,4,5] | The sub-department list. |
Response body example
Error codes
If an error occurs when calling this API, refer to the Global error codes document to find a solution based on the error message.| Error code (errcode) | Error message (errmsg) | Solution |
|---|---|---|
| 60003 | The corresponding department is not found | Verify that dept_id is correct. |
| 400002 | Invalid parameter | Verify that the parameters are entered as required. |
| -1 | System busy | Try again later. |