> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the list of users for a specified role

> Call this API to get the list of users assigned to a specified role for reviewing role membership.

Call this API to get the list of users for a specified role.

## Request

| **Basic information** |                                                                                                  |
| --------------------- | ------------------------------------------------------------------------------------------------ |
| HTTP URL              | [https://api.dingtalk.io/topapi/role/simplelist](https://api.dingtalk.io/topapi/role/simplelist) |
| HTTP Method           | POST                                                                                             |
| Supported app types   | appType-Internal appappType-Third-party enterprise app                                           |
| Required permissions  | permission-qyapi\_get\_department\_member-Read permission for department users in Contacts       |

### Query parameter

| Name          | Type   | Required | Example  | Description                                                                                                                                                                                                                                                                                                          |
| ------------- | ------ | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token | String | Yes      | bE74xxxx | The app credential used to call this API.   - For an internal app, obtain it through the API for obtaining the [access\_token of an internal app](/open/development/obtain-orgapp-token). - For a third-party enterprise app, obtain it through the API for obtaining the access\_token of a third-party enterprise. |

### Request body

| Name     | Type   | Required | Example | Description                                                                                                                                                     |
| -------- | ------ | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| role\_id | Number | Yes      | 1203141 | The role ID. To get this value, call the [Get the role list](/open/development/obtains-a-list-of-enterprise-roles) API and use the value of the `id` parameter. |
| size     | Number | No       | 20      | The page size.  **Note**  This parameter takes effect only when set together with the `offset` parameter. The default value is 20 and the maximum value is 100. |
| offset   | Number | No       | 0       | The pagination offset.  **Note**  This parameter takes effect only when set together with the `size` parameter. The offset starts from 0.                       |

### Request example

```curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST "https://api.dingtalk.io/topapi/role/simplelist" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d1812xxxxc53245' \
-d 'offset=0' \
-d 'role_id=1203141' \
-d 'size=20'
```

Java

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/simplelist");
OapiRoleSimplelistRequest req = new OapiRoleSimplelistRequest();
req.setRoleId(1203141L);
req.setSize(20L);
req.setOffset(0L);
OapiRoleSimplelistResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
```

Python

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import dingtalk.api

req=dingtalk.api.OapiRoleSimplelistRequest("https://api.dingtalk.io/topapi/role/simplelist")

req.role_id=1203141
req.offset=0
req.size=20
try:
  resp= req.getResponse(access_token)
  print(resp)
except Exception,e:
  print(e)
```

PHP

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');

$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiRoleSimplelistRequest;
$req->setRoleId("1203141");
$req->setOffset("0");
$req->setSize("20");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/role/simplelist");
```

C#

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/role/simplelist");
OapiRoleSimplelistRequest req = new OapiRoleSimplelistRequest();
req.RoleId = 1203141L;
req.Offset = 0L;
req.Size = 20L;
OapiRoleSimplelistResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
```

## Response

### Response body

| Name         | Type             | Example                          | Description                               |
| ------------ | ---------------- | -------------------------------- | ----------------------------------------- |
| request\_id  | String           | f6249uw1kuus                     | The request ID.                           |
| errcode      | Number           | 0                                | The return code.                          |
| errmsg       | String           | ok                               | The description of the return code.       |
| result       | PageVo           |                                  | The query result.                         |
| hasMore      | Boolean          | true                             | Indicates whether more data is available. |
| list         | OpenEmpSimple\[] |                                  | The list of users assigned to the role.   |
| userid       | String           | manager4220                      | The user ID of the user.                  |
| name         | String           | John                             | The name of the user.                     |
| manageScopes | OrgDeptVo\[]     |                                  | The management scope.                     |
| dept\_id     | Number           | 11                               | The department ID.                        |
| name         | String           | Discipline Inspection Department | The department name.                      |

### Response body example

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "errcode": 0,
  "result": {
    "hasMore": false,
    "list": [
      {
        "name": "John",
        "userid": "manager4220",
        "manageScopes":[
          {
            "dept_id":11,
            "name":"Discipline Inspection Department"
          }
        ]
      }
    ]
  },
  "request_id": "f6249uw1kuus"
}
```

### Error codes

If an error occurs when you call this API, look up the solution in the [Global error codes](/open/development/server-api-error-codes-1) document based on the error message.

| Error code (errorcode) | Error message (errmsg) | Solution                             |
| ---------------------- | ---------------------- | ------------------------------------ |
| 33011                  | Invalid roleId         | Check whether the roleId is correct. |
| 40069                  | Invalid size           | Adjust the page size.                |
| 40068                  | Invalid offset         | Adjust the offset.                   |
| 400001                 | System error           | Try again later.                     |
