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

# UserGroups

> Querying user groups

## Overview

The user\_groups query is designed to fetch a list of all user groups within the team. This query allows you to retrieve information about user groups including their members.

## Arguments

**mine** `Boolean`

`mine` is an optional boolean argument. If set to `true`, returns only user groups that the
current user belongs to. If not provided or set to `false`, returns all user groups in the team.

## Schema

Fields available to the [UserGroup](https://docs.fireflies.ai/schema/user-groups.md) query

## Usage Example

```graphql theme={null}
query UserGroups($mine: Boolean) {
  user_groups(mine: $mine) {
    id
    name
    handle
    members {
      user_id
      first_name
      last_name
      email
    }
  }
}
```

```bash curl theme={null}
curl -X POST \
	-H "Content-Type: application/json" \
	-H "Authorization: Bearer your_api_key" \
	--data '{ "query": "{ user_groups { name handle members { first_name last_name email } } }" }' \
	https://api.fireflies.ai/graphql
```

```javascript javascript theme={null}
const axios = require('axios');

const url = 'https://api.fireflies.ai/graphql';
const headers = {
  'Content-Type': 'application/json',
  Authorization: 'Bearer your_api_key'
};
const data = {
  query: '{ user_groups { name handle members { first_name last_name email } } }'
};

axios
  .post(url, data, { headers: headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
```

```python python theme={null}
import requests

url = 'https://api.fireflies.ai/graphql'
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_api_key'
}
data = '{"query": "{ user_groups { name handle members { first_name last_name email } } }"}'

response = requests.post(url, headers=headers, data=data)
print(response.json())
```

```java java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpRequest.BodyPublishers;

public class ApiRequest {
    public static void main(String[] args) {
        HttpClient client = HttpClient.newHttpClient();
        String jsonRequest = "{\"query\": \"{ user_groups { name handle members { first_name last_name email } } }\"}";
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.fireflies.ai/graphql"))
            .header("Content-Type", "application/json")
            .header("Authorization", "Bearer your_api_key")
            .POST(BodyPublishers.ofString(jsonRequest))
            .build();

        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
            .thenApply(HttpResponse::body)
            .thenAccept(System.out::println)
            .join();
    }
}

```

```json Response theme={null}
{
  "data": {
    "user_groups": [
      {
        "id": "group_123",
        "name": "Engineering Team",
        "handle": "engineering",
        "members": [
          {
            "user_id": "user_456",
            "first_name": "John",
            "last_name": "Doe",
            "email": "john.doe@example.com"
          },
          {
            "user_id": "user_789",
            "first_name": "Jane",
            "last_name": "Smith",
            "email": "jane.smith@example.com"
          }
        ]
      },
      {
        "id": "group_124",
        "name": "Sales Team",
        "handle": "sales",
        "members": [
          {
            "user_id": "user_101",
            "first_name": "Bob",
            "last_name": "Johnson",
            "email": "bob.johnson@example.com"
          }
        ]
      }
    ]
  }
}
```

## Error Codes

List of possible error codes that may be returned by the `user_groups` query. Full list of error codes can be found [here](https://docs.fireflies.ai/miscellaneous/error-codes.md).

> [accordion] not\_authorized
>
> You do not have permission to access user groups for this team.

## Audit Trail

Successful `user_groups` queries emit `USER_GROUPS_LISTED` with the returned group count
(`groupCount`) and access level (`level`: `user` or `team`).

## Additional Resources

> [card] [Users](https://docs.fireflies.ai/graphql-api/query/users.md)
>
> Querying list of users

> [card] [User](https://docs.fireflies.ai/graphql-api/query/user.md)
>
> Querying user details


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.