Get Users of a Role

Prev Next
Get
/api/v1/roles.getUsersInRole

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
Header parameters
X-User-Id
stringRequired

The authenticated user ID.

ExamplerbAXPnMktTFbNpwtJ
X-Auth-Token
stringRequired

The authenticated user token.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
Query parameters
role
stringRequired

The role name or the role ID. For custom roles, use the role ID.

Example653ec9873c7460e18e6f
roomId
string

The room ID.

Examplehfiec783ifjl
offset
integer

Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.

Example50
count
integer

How many items to return. Refer to the official documentation to learn more.

Example50
Responses
200

OK

Success Example
{
  "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
}
Expand All
object
users
Array of object
object
_id
string
username
string
type
string
status
string
active
boolean
name
string
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "Query param \"role\" is required [error-param-not-provided]",
  "errorType": "error-param-not-provided"
}
Example 2
{
  "success": false,
  "error": "[error-invalid-roleId]",
  "errorType": "error-invalid-roleId"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string