---
title: "Get Room Members Ordered by Role"
slug: "get-room-members-ordered-by-role"
updated: 2026-06-08T12:46:40Z
published: 2026-06-08T12:46:40Z
stale: true
---

> ## 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 Room Members Ordered by Role

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={&quot;rolePriority&quot;:-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 parametersX-Auth-TokenstringRequired

The `authToken` of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-IdstringRequired

The `userId` of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ

Query parametersroomIdstringRequired

Enter the room ID.

Example66cd971f6fcbb8e8b3cf8e69
roomNamestring

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

Exampletest-team
filterstring

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

Exampleuser
offsetinteger

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.

Example50
countinteger

The number of items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more.

Example50
sortstring

Sort the rooms in ascending (`1`) or descending (`-1`) order. The value must be entered as a JSON string. The options are as follows:

- `rolePriority`: Sort by priority of role (`Owners` > `Moderators` > all other members). For example, `sort={&quot;rolePriority&quot;:-1}`
- `username`: Sort by usernames. For example, `sort={&quot;username&quot;:-1}`

statusarray of string

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

Responses200

OK

<select class='api-response-data' aria-label='Media type'><option value='cea6a759-dd87-479b-9c65-b8957c3768af'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='5dd90ab1-a3e2-4a3a-a2fd-7e98c6b681b3'>Example 1</option>
</select>Example 1

```json
{
  "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 Allobject  members Array of object   object  _idstring    
usernamestring    
statusstring    
_updatedAtstring    
namestring    
roles Array of string   string    

countinteger    
offsetinteger    
totalinteger    
successboolean    

400

Bad Request

<select class='api-response-data' aria-label='Media type'><option value='a8d9492a-e43e-4b0a-b256-6b5515a36c84'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='307a1f93-2b88-4566-b09a-0b974f9ac7c6'>Example 1</option>
</select>Example 1

```json
{
  "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  successboolean    
errorstring    
errorTypestring    

401

Unauthorized

<select class='api-response-data' aria-label='Media type'><option value='6b7f2f3a-0b51-4981-9db7-e9e275a3d5e6'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='0cdac111-0091-4720-a0ed-ea7241037656'>Authorization Error</option>
</select>Authorization Error

```json
{
  "status": "error",
  "message": "You must be logged in to do this."
}
```

object  statusstring    
messagestring
