# Obtain a list of role members

This API is used to obtain a list of users in a given role. Apps invoking this API must have permission to read or write the organization’s Contacts. The result returned is a list of users in a given role within the app’s Contacts permission.<br>

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/contact/v2/role/members?role_id=or_846ea69995a259a27cc690182f27de87&page_size=2&page_token=763bd1e74d05e958
HTTP Method | GET
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.**<br>Enable any scope from the list | Access role information<br>Read contacts

### 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)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Query parameters
|Parameter|Type|Mandatory|Description|
|-|-|-|-|
|role_id|string|yes|Role ID|
|page_token|string|no|Page identifier. If not included in the first request, the list will iterate from the top. If a particular page is queried and there are more members in the role, a new page_token will also be returned. The next request can use that page_token to obtain more members|
|page_size|int|no|Page size，up to 200 items per page; default 20 items|

## Response
### Response body
|Parameter|Description|
|-|-|
|code|Error code, anything but 0 indicates failure|
|msg|Response code description|
|data|Response business data|
|&emsp;∟has_more|If there are more members. When has_more is true, a new page_token will also be returned|
|&emsp;∟page_token|Page identifier. When has_more is true, a new page_token will also be returned. Otherwise, page_token will not be returned|
|&emsp;∟user_list|User list|
|&emsp;&emsp;∟name|User name|
|&emsp;&emsp;∟open_id|User open_id|
|&emsp;&emsp;∟user_id|User ID. The field will be returned after apps have applied "Obtain user's userid" permission|
|&emsp;&emsp;∟scope|User's management scope within the role|
|&emsp;&emsp;&emsp;∟is_all_department|If management scope covers all departments of the company, this parameter is only returned when true|
|&emsp;&emsp;&emsp;∟department_ids|Custom department ID. If there is no is_all_department parameter, returns specific management department|
|&emsp;&emsp;&emsp;∟open_department_ids|Department open_id. If there is no is_all_department parameter, returns specific management department|
### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "has_more": true,
        "page_token": "763bd1e74d05e95e",
        "user_list": [
            {
                "name": "Jack",
                "open_id": "ou_84aad35d084aa403a838cf73ee144ec1",
                "user_id": "gbdfb31g"
                "scope": { 
                	"department_ids": ["TT-1234","TT-1235"],
                	"open_department_ids": ["od-c02cc3b685a711db3a0f14fc4cdb76dc","od-fa83d3690de01787618b85bb27a013bc"],
                }
            },
            {
                "name": "Hency",
                "open_id": "ou_6b77dbe8459863069c1a62f9cd810217",
                "user_id": "977ea122"
                "scope": {
                  "is_all_department": true
            	}
            }
        ]
    }
}
```
### Error code

For details, please refer to: [Service-side error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN)