Get Room Members Ordered by Role

Prev Next
Get
/api/v1/rooms.membersOrderedByRole

Get room members ordered by their roles. This endpoint sorts the members according to their role in the room in the order Owners > Moderators > all other members. This can be reversed using the query paramter sort={"rolePriority":-1}. You need not be a member of the room.

If the room is a broadcast room, you need the view-broadcast-member-list permission to view the room members.

Changelog

Version Description
7.3.0 Added
Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Query parameters
roomId
stringRequired

Enter the room ID.

Example66cd971f6fcbb8e8b3cf8e69
roomName
string

Instead of using the room ID, you can enter the room name.

Exampletest-team
filter
string

Filter the results by using the text that you want to view.

Exampleuser
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

The number of items to return. Refer to the official documentation to learn more.

Example50
sort

List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.

status
array of string

Enter the user status for which you want the results. For example, online, away, offline.

Responses
200

OK

Example 1
{
  "members": [
    {
      "_id": "C38WSSzrGd2NCjzqJ",
      "username": "test.cat",
      "status": "online",
      "_updatedAt": "2025-01-22T07:49:47.830Z",
      "name": "test.cat",
      "roles": [
        "owner"
      ]
    },
    {
      "_id": "P2dgWPPw5veigwcdK",
      "status": "offline",
      "_updatedAt": "2025-01-22T07:13:19.734Z",
      "name": "Fun Smith",
      "username": "fun.smith",
      "roles": [
        "moderator"
      ]
    },
    {
      "_id": "CNmyTxexxauJ4wrTW",
      "username": "agent1",
      "status": "offline",
      "_updatedAt": "2025-01-22T07:32:57.238Z",
      "name": "agent1"
    },
    {
      "_id": "FSA63o85Poa2EQvAH",
      "status": "offline",
      "name": "cat kate",
      "username": "cat.kate",
      "_updatedAt": "2025-01-22T08:04:12.251Z",
      "roles": [
        "leader"
      ]
    }
  ],
  "count": 4,
  "offset": 0,
  "total": 4,
  "success": true
}
Expand All
object
members
Array of object
object
_id
string
username
string
status
string
_updatedAt
string
name
string
roles
Array of string
string
count
integer
offset
integer
total
integer
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "must have required property 'roomId'\n must have required property 'roomName'\n must match exactly one schema in oneOf [invalid-params]",
  "errorType": "invalid-params"
}
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