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

# Get community members

The full list of the community members can be retrieved by calling `getCommunityMembers` query.
The results will be returned with pagination and possibility to change the sorting order
(by default the query results are sorted by the user context label, ascending).
The query supports cursor-based pagination (`after`, `before`) or limit-based (`first`, `last`).

<Note>
  Query results will be returned only for the user associated with the given community (the owner or a member)
  or for users associated with the `ADMINISTRATOR` scope.
</Note>

The query accepts the following arguments:

| Argument      | Type      | Description                                                                                                                                                                      | Default |
| :------------ | :-------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ |
| `communityId` | `Id`      | **Required**. ID of the community to get the list of members.                                                                                                                    | —       |
| `after`       | `Cursor`  | Returns results that come after the specified cursor. Should be used together with `first` parameter. Cannot be used if `before` is set.                                         | —       |
| `before`      | `Cursor`  | Returns results that come before the specified cursor. Should be used together with `last` parameter. Cannot be used if `after` is set.                                          | —       |
| `first`       | `Integer` | Returns up to the first N elements from the list. Required if `after` parameter is set. Cannot be used together with `last`.                                                     | —       |
| `last`        | `Integer` | Returns up to the first N elements from the list. Required if `before` parameter is set. Cannot be used together with `first`.                                                   | —       |
| `reverse`     | `Boolean` | Reverse the order of the underlying list. Default sort order is ascending, by the user context label.                                                                            | `false` |
| `name`        | `String`  | Allows to search by the member user context label. **Note:** it makes sense only if the real user name is sent to Opigno Enterprise API during the user context synchronization. | —       |

<CodeGroup>
  ```filename GraphQL theme={null}
    query getCommunityMembers {
      getCommunityMembers(communityId: 1, first: 2) {
        edges {
          node {
            id
            userContext {
              displayName
              id
              uuid
            }
            cta {
              actionId
              arguments {
                key
                value
              }
            }
          }
        }
        totalItems
      }
    }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "getCommunityMembers": {
        "edges": [
          {
            "node": {
              "id": "345",
              "userContext": {
                "displayName": "Olha Rybak (LA)",
                "id": "345",
                "uuid": "fb76663e-a68e-43cb-ba0e-9316a56b1a4f"
              },
              "cta": [
                {
                  "actionId": "REMOVE_COMMUNITY_MEMBER",
                  "arguments": [
                    {
                      "key": "userContextUuid",
                      "value": "fb76663e-a68e-43cb-ba0e-9316a56b1a4f"
                    },
                    {
                      "key": "communityId",
                      "value": "1"
                    }
                  ]
                }
              ]
            }
          }
        ],
        "totalItems": 1
      }
    }
  }
  ```
</CodeGroup>
