--- title: "Get Room Members Ordered by Role" slug: "get-room-members-ordered-by-role" updated: 2026-09-03T14:50:33Z published: 2026-09-03T14:50:33Z canonical: "developer.rocket.chat/get-room-members-ordered-by-role" 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={"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 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={"rolePriority":-1}` - `username`: Sort by usernames. For example, `sort={"username":-1}` statusarray of string Enter the user status for which you want the results. For example, `online`, `away`, `offline`. Responses200 OK 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 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 Authorization Error ```json { "status": "error", "message": "You must be logged in to do this." } ``` object statusstring messagestring