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

# Get Users of a Role

> Gets the users that belong to a specific role.
**Permissions required**: 
- `access-permissions`: Required to modify permissions for various roles
- `view-other-user-channels`: Permission to view channels owned by other users. Required if the request includes a `roomId`

### Changelog
| Version      | Description |
| ---------------- | ------------|
|1.3.0            | Added       |

## OpenAPI

````json GET /api/v1/roles.getUsersInRole
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "User Management"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "LDAP"
    },
    {
      "name": "Permissions"
    },
    {
      "name": "Roles"
    },
    {
      "name": "Users"
    }
  ],
  "paths": {
    "/api/v1/roles.getUsersInRole": {
      "get": {
        "tags": [
          "Roles"
        ],
        "summary": "Get Users of a Role",
        "operationId": "get-api-v1-roles.getUsersInRole",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "description": "The ID of the role",
            "required": "true",
            "schema": {
              "type": "string",
              "example": "653ec9873c7460e18e6f"
            }
          },
          {
            "name": "roomId",
            "in": "query",
            "description": "The room ID.",
            "schema": {
              "type": "string"
            },
            "example": "hfiec783ifjl"
          },
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "$ref": "#/components/parameters/Auth-Token"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/count"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "users": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "username": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "users": [
                        {
                          "_id": "voakrL3cHjYBwwRPq",
                          "username": "a",
                          "type": "user",
                          "status": "offline",
                          "active": "true",
                          "name": "a"
                        },
                        {
                          "_id": "N2s7KG6YkzgJfXbyn",
                          "username": "b",
                          "type": "user",
                          "status": "offline",
                          "active": "true",
                          "name": "b"
                        }
                      ],
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "Query param \"role\" is required [error-param-not-provided]",
                      "errorType": "error-param-not-provided"
                    }
                  },
                  "Example 2": {
                    "value": {
                      "success": "false",
                      "error": "[error-invalid-roleId]",
                      "errorType": "error-invalid-roleId"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "description": "Gets the users that belong to a specific role.\n**Permissions required**: \n- `access-permissions`: Required to modify permissions for various roles\n- `view-other-user-channels`: Permission to view channels owned by other users. Required if the request includes a `roomId`\n\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|1.3.0            | Added       |"
      }
    }
  },
  "components": {
    "parameters": {
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The authenticated user ID.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      },
      "Auth-Token": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The authenticated user token.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "50",
        "description": "Number of items to \"skip\" in the query, i.e. requests return count items, skipping the first offset items. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "count": {
        "name": "count",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "50",
        "description": "How many items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      }
    },
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

