---
title: "User group SDK reference"
description: "Customer-hosted cloud features"
---

# User group SDK reference

#### Customer-hosted cloud features

:::note
Some features are only available on customer-hosted clouds. Reach out to [support@anyscale.com](mailto:support@anyscale.com) for info.
:::

## User group SDK

### `anyscale.user_group.list`

List user groups in the organization.

Returns a list of UserGroup objects.

**Arguments**

-   **`max_items` (int) = 50**: Maximum number of user groups to return.

**Returns**: List\[[UserGroup](#usergroup)\]

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale

user_groups = anyscale.user_group.list(max_items=50)
for ug in user_groups:
    print(f"{ug.id}: {ug.name}")
```
:::

::::

### `anyscale.user_group.get`

Get a specific user group by ID.

Returns a UserGroup object.

**Arguments**

-   **`id` (str)**: The ID of the user group to retrieve.

**Returns**: [UserGroup](#usergroup)

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale

user_group = anyscale.user_group.get(id="ug_abc123")
print(f"{user_group.id}: {user_group.name}")
```
:::

::::

## User group models

### `UserGroup`

A user group in the organization.

#### Fields

-   **`id` (str)**: The unique identifier of the user group.
-   **`name` (str)**: The name of the user group.
-   **`org_id` (str)**: The organization ID.
-   **`created_at` (datetime)**: When the user group was created.
-   **`updated_at` (datetime)**: When the user group was last updated.

#### Python Methods

```python
def to_dict(self) -> Dict[str, Any]
    """Return a dictionary representation of the model."""
```

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale

user_group = anyscale.user_group.get(id="ug_abc123")
print(f"{user_group.id}: {user_group.name}")
```
:::

::::

---

Previous: [Service](/reference/sdk/service.md) | Next: [User](/reference/sdk/user.md)