# Searching for security groups

This page explains how to find all of your security groups with the
Cloud Identity Groups API.

> [!NOTE]
> **Note:** When a method requires the `customer_id`, you must prepend a "C" to the ID that you can view in the Google Admin console (for example, 'C046psxkn').

### REST

To search for all security groups, call
[`groups.search()`](https://docs.cloud.google.com/identity/docs/reference/rest/v1/groups/search.md.txt)
with a query string of `labels:cloudidentity.googleapis.com/groups.security`.

### Python

The following example shows a helper function to search for security groups
using the Python client library:

```python
def search_security_groups(service, identity_source_id, pageSize, view):
  # Set the label to search for all Google groups
  searchQuery = "&query=parent=='customers/{customer_id}'&&labels:cloudidentity.googleapis.com/groups.security" \
    + "&pageSize=" + pageSize + "&view=" + view
  try:
    searchGroupsRequest = service.groups().search()
    searchGroupsRequest.uri += searchQuery
    response = searchGroupsRequest.execute()
    print(response)
  except Exception as e:
    print(e)

```