> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Search for Group Members

API documentation for the FusionAuth Search for Group Members API.

# Search for Group Members

version

This API has been available since 1.36.0

The Group Member Search API allows you to search for Group Members with a paginated response.

## Request

[!API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#api-key-authentication)

Search for all Group Members by Group Id

GET/api/group/member/search?groupId={groupId}

When calling the API using a `GET` request you will send the search criteria on the URL using request parameters. In order to simplify the example URL above, only the `groupId` parameter is shown, however you may add any of the documented request parameters to the URL.

### Request Parameters

`groupId`UUIDoptional

The unique Id of the Group used to search for Group Members.

`numberOfResults`IntegeroptionalDefaults to 25

The number of results to return from the search.

`orderBy`StringoptionalDefaults to insertInstant ASC, userId ASC, groupId ASC

The database column to order the search results on plus the order direction.

The possible values are:

*   `groupId` - the unique Id of the Group
*   `id` - the id of the Group Member
*   `insertInstant` - the [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the Group Member was created
*   `userId` - the unique Id of the User

For example, to order the results by the insert instant in descending order, the value would be provided as `insertInstant DESC`. The final string is optional, can be set to `ASC` or `DESC`, or omitted and will default to `ASC`.

Prior to version `1.52.0` this defaults to `insertInstant ASC`.

`startRow`IntegeroptionalDefaults to 0

The offset row to return results from. If the search has 200 records in it and this is 50, it starts with row 50.

`userId`UUIDoptional

The unique Id of the User to search for Group Members. A single user may belong to one or more Groups, so searching on this field may still produce multiple results.

  

[!API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#api-key-authentication)

Search Group Members using the given search criteria

POST/api/group/member/search

OpenAPI Spec

When calling the API using a `POST` request you will send the search criteria in a JSON request body.

### Request Body

`search.groupId`UUIDoptional

The unique Id of the Group used to search for Group Members.

`search.numberOfResults`IntegeroptionalDefaults to 25

The number of results to return from the search.

`search.orderBy`StringoptionalDefaults to insertInstant ASC, userId ASC, groupId ASC

The database column to order the search results on plus the order direction.

The possible values are:

*   `groupId` - the unique Id of the Group
*   `id` - the id of the Group Member
*   `insertInstant` - the [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the Group Member was created
*   `userId` - the unique Id of the User

For example, to order the results by the insert instant in descending order, the value would be provided as `insertInstant DESC`. The final string is optional, can be set to `ASC` or `DESC`, or omitted and will default to `ASC`.

Prior to version `1.52.0` this defaults to `insertInstant ASC`.

`search.startRow`IntegeroptionalDefaults to 0

The offset row to return results from. If the search has 200 records in it and this is 50, it starts with row 50.

`search.userId`UUIDoptional

The unique Id of the User to search for Group Members. A single user may belong to one or more Groups, so searching on this field may still produce multiple results.

## Response

*Response Codes*

| Code | Description |
| --- | --- |
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an [Errors](https://fusionauth.io/docs/apis/errors.md) JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See [Authentication](https://fusionauth.io/docs/apis/authentication.md). |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |

#### Response Body

`members`Array

A list of the Group Members that matched the search criteria.

`members[x].data`Object

An object that can hold any information about the Group Member that should be persisted.

`members[x].groupId`UUID

The unique Group Id that indicates the Group this membership represents.

`members[x].id`UUID

The unique Id of this Group Member.

`members[x].insertInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that this membership was created.

`members[x].userId`UUID

The unique User Id that represents the User this membership represents.

`total`Integer

The total number of Group Members matching the search criteria. Use this value along with the **numberOfResults** and **startRow** in the Search request to perform pagination.

*Example Response JSON*

```json
{
  "members": [
    {
      "id": "47ffe8c2-920a-49cc-bfa8-b84889db615e",
      "groupId": "1188edfc-cef3-4555-910e-181ddf6153c0",
      "insertInstant": 1503513015493,
      "userId": "00000000-0000-0001-0000-000000000000"
    }
  ],
  "total": 1
}
```