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

# User 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 SDK

### `anyscale.user.admin_batch_create`

Batch create, as an admin, users without email verification.

**Arguments**

-   **`admin_create_users` (List\[[AdminCreateUser](#admincreateuser)\])**: Users to be created by an admin.

**Returns**: List\[[AdminCreatedUser](#admincreateduser)\]

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.user.models import AdminCreateUser

anyscale.user.admin_batch_create(
    [AdminCreateUser(
        name="name",
        email="test@anyscale.com",
        password="",
        is_sso_user=False,
        lastname="lastname",
        title="title",
    ),],
)
```
:::

::::

### `anyscale.user.list`

List collaborators within the organization.

**Arguments**

-   **`email` (str | None) = None**: Filter collaborators by exact email address.
-   **`name` (str | None) = None**: Filter collaborators by exact display name.
-   **`collaborator_type` (str | None) = None**: Filter by collaborator type. Accepts values such as 'all\_accounts', 'only\_service\_accounts', or 'only\_user\_accounts'.
-   **`is_service_account` (bool | None) = None**: If provided, filter collaborators by whether they are service accounts.
-   **`max_items` (int | None) = None**: Maximum total number of users to yield (default: iterate all).
-   **`page_size` (int | None) = None**: Number of users fetched per API request (default: API default).

**Returns**: ResultIterator\[[User](#user)\]

#### Examples

::::tabs

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

for user in anyscale.user.list(max_items=10):
    print(user.email)
```
:::

::::

### `anyscale.user.get`

Retrieve a single collaborator by email or name.

**Arguments**

-   **`email` (str | None) = None**: Email address of the user to retrieve.
-   **`name` (str | None) = None**: Display name of the user to retrieve.
-   **`collaborator_type` (str | None) = None**: Optional collaborator type constraint when fetching the user.
-   **`is_service_account` (bool | None) = None**: Filter by whether the user is a service account.

**Returns**: [User](#user)

#### Examples

::::tabs

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

user = anyscale.user.get(email="owner@anyscale.com")
print(user.permission_level)
```
:::

::::

## User models

### `AdminCreateUser`

User to be created by an admin.

#### Fields

-   **`name` (str)**: First name of the user to be created.
-   **`email` (str)**: Email of the user to be created.
-   **`password` (str | None)**: Password for the user account being created.
-   **`is_sso_user` (bool)**: Whether the user is an SSO user. SSO users can log in using SSO.
-   **`lastname` (str | None)**: Optional last name of the user to be created.
-   **`title` (str | None)**: Optional title of the user to be created.

#### Python Methods

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

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.user.models import AdminCreateUser

admin_create_user = AdminCreateUser(
    # First name of the user to be created.
    name="name",
    # Email of the user to be created.
    email="test@anyscale.com",
    # Password for the user account being created.
    password="",
    # Whether the user is an SSO user. SSO users can log in using SSO.
    is_sso_user=False,
    # Optional last name of the user to be created.
    lastname="lastname",
    # Optional title of the user to be created.
    title="title",
)
```
:::

::::

### `AdminCreateUsers`

Users to be created by an admin.

#### Fields

-   **`create_users` (List\[Dict\[str, Any\]\])**: Users to be created by an admin.

#### Python Methods

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

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.user.models import AdminCreateUser

admin_create_user = AdminCreateUser(
    # First name of the user to be created.
    name="name",
    # Email of the user to be created.
    email="test@anyscale.com",
    # Password for the user account being created.
    password="",
    # Whether the user is an SSO user. SSO users can log in using SSO.
    is_sso_user=False,
    # Optional last name of the user to be created.
    lastname="lastname",
    # Optional title of the user to be created.
    title="title",
)
admin_create_users = AdminCreateUsers(
    # Users to be created by an admin.
    create_users=[admin_create_user]
)
```
:::

::::

### `AdminCreatedUser`

User account created by an admin that has organization collaborator permissions.

#### Fields

-   **`user_id` (str)**: ID of the user that has been created.
-   **`name` (str)**: First name of the user that has been created.
-   **`email` (str)**: Email of the user that has been created.
-   **`created_at` (datetime)**: The timestamp of when the user is created.
-   **`is_sso_user` (bool)**: Whether the user is an SSO user. SSO users can log in using SSO.
-   **`lastname` (str | None)**: Optional last name of the user that has been created.
-   **`title` (str | None)**: Optional title of the user that has been created.

#### Python Methods

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

#### Examples

::::tabs

:::tab[Python]
```python
import anyscale
from anyscale.user.models import AdminCreatedUser

admin_create_user = AdminCreateUser(
    # First name of the user to be created.
    name="name",
    # Email of the user to be created.
    email="test@anyscale.com",
    # Password for the user account being created.
    password="",
    # Whether the user is an SSO user. SSO users can log in using SSO.
    is_sso_user=False,
    # Optional last name of the user to be created.
    lastname="lastname",
    # Optional title of the user to be created.
    title="title",
)
admin_created_users: List[AdminCreatedUser] = anyscale.user.admin_batch_create([admin_create_user])
```
:::

::::

### `User`

Collaborator returned by `anyscale.user` APIs.

#### Fields

-   **`email` (str)**: Email address associated with the collaborator.
-   **`name` (str)**: Display name of the collaborator.
-   **`created_at` (datetime)**: Timestamp for when the collaborator was created.
-   **`permission_level` (str)**: Organization permission level for the collaborator.
-   **`user_id` (str | None)**: Optional user ID backing the collaborator (may be absent for service accounts).

#### Python Methods

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

#### Examples

::::tabs

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

for user in anyscale.user.list(max_items=5):
    print(f"{user.email} ({user.permission_level})")
```
:::

::::

---

Previous: [User group](/reference/sdk/user-group.md) | Next: [Workspaces](/reference/sdk/workspaces.md)