# Method: groups.search

Searches for `Group` resources matching a specified query.

### HTTP request

`GET https://cloudidentity.googleapis.com/v1beta1/groups:search`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Query parameters

| Parameters ||
|---|---|
| `query` | `string` Required. The search query. - Must be specified in [Common Expression Language](https://opensource.google/projects/cel). - Must contain equality operators on the parent, e.g. `parent == 'customers/{customer_id}'`. The `customer_id` must begin with "C" (for example, 'C046psxkn'). [Find your customer ID.](https://support.google.com/cloudidentity/answer/10070793) - Can contain optional inclusion operators on `labels` such as `'cloudidentity.googleapis.com/groups.discussion_forum' in labels`). - Can contain an optional equality operator on `domain_name`. e.g. `domain_name == 'examplepetstore.com'` - Can contain optional `startsWith/contains/equality` operators on `group_key`, e.g. `group_key.startsWith('dev')`, `group_key.contains('dev'), group_key == 'dev@examplepetstore.com'` - Can contain optional `startsWith/contains/equality` operators on `display_name`, such as `display_name.startsWith('dev')` , `display_name.contains('dev')`, `display_name == 'dev'` |
| `view` | ``enum (`https://docs.cloud.google.com/identity/docs/reference/rest/v1beta1/groups/search#GroupView`)`` The level of detail to be returned. If unspecified, defaults to `View.BASIC`. |
| `pageSize` | `integer` The maximum number of results to return. Note that the number of results returned may be less than this value even if there are more available results. To fetch all results, clients must continue calling this method repeatedly until the response no longer contains a `next_page_token`. If unspecified, defaults to 200 for `GroupView.BASIC` and to 50 for `GroupView.FULL`. Must not be greater than 1000 for `GroupView.BASIC` or 500 for `GroupView.FULL`. |
| `pageToken` | `string` The `next_page_token` value returned from a previous search request, if any. |
| `orderBy` | `string` The ordering of groups for the display name or email in the search groups response. The syntax for this field can be found at <https://cloud.google.com/apis/design/design_patterns#sorting_order>. Example: Sort by the ascending name: order_by="display_name" Sort by the descending group key email: order_by="group_key desc" |

### Request body

The request body must be empty.

### Response body

The response message for `https://docs.cloud.google.com/identity/docs/reference/rest/v1beta1/groups/search#google.apps.cloudidentity.groups.v1beta1.GroupsService.SearchGroups`.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "groups": [ { object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1beta1/groups#Group`) } ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `groups[]` | ``object (`https://docs.cloud.google.com/identity/docs/reference/rest/v1beta1/groups#Group`)`` The `Group` resources that match the search query. |
| `nextPageToken` | `string` A continuation token to retrieve the next page of results, or empty if there are no more results available. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-identity.groups.readonly`
- `https://www.googleapis.com/auth/cloud-identity.groups`
- `https://www.googleapis.com/auth/cloud-identity`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authorization guide](https://developers.google.com/workspace/guides/configure-oauth-consent).

## GroupView

The view options for the `https://docs.cloud.google.com/identity/docs/reference/rest/v1beta1/groups/search#google.apps.cloudidentity.groups.v1beta1.GroupsService.SearchGroups` method.

| Enums ||
|---|---|
| `BASIC` | Default. Only basic resource information is returned. |
| `FULL` | All resource information is returned. |