---
sidebar:
  hidden: true
title: roboto.domain.users.user
---
## Module Contents

### User

```python
class roboto.domain.users.user.User(
    record: roboto.domain.users.record.UserRecord,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
)
```

`from roboto import User`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L24-L226)

Represents an individual who has access to the Roboto platform.

Users are the fundamental identity entities in Roboto. They can be members of organizations, create and manage datasets and files within those organizations, and execute actions. Users are created during the signup process and cannot be instantiated directly by SDK users.

User IDs are globally unique across the entire Roboto platform and typically correspond to email addresses for human users or service identifiers for automated users.

**Parameters**

- **record** (`roboto.domain.users.record.UserRecord`)
- **roboto_client** (`Optional[roboto.http.RobotoClient]`)

**Properties**

- **User.name** (`str | None`): Human-readable display name for this user.

  **Returns**

  - `Optional[str]`: The user's display name, or None if not set.

- **User.record** (`roboto.domain.users.record.UserRecord`): Access the underlying user record.

  Provides access to the raw UserRecord containing all user data fields. This is useful for accessing fields not exposed as properties.

  **Returns**

  - `roboto.domain.users.record.UserRecord`: The underlying UserRecord instance.

- **User.user_id** (`str`): Unique identifier for this user.

  User IDs are globally unique across the Roboto platform and typically correspond to email addresses for human users.

  **Returns**

  - `str`: The user's unique identifier.

#### User.create()

```python
@classmethod
def create(
    request: roboto.domain.users.operations.CreateUserRequest,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> User
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L41-L73)

Create a new user in Roboto.

This API is only used by the Roboto platform itself as part of the signup process. Any other caller will receive an Unauthorized response from the Roboto service.

**Parameters**

- **request** (`roboto.domain.users.operations.CreateUserRequest`): User creation request containing user details.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `User`: A new User instance representing the created user.

**Raises**

- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not authorized to create users.
- [`RobotoInvalidRequestException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The request contains invalid data.

**Usage**

Create a new service user:

```python
from roboto import CreateUserRequest, User
request = CreateUserRequest(user_id="service@example.com", name="Service User", is_service_user=True)
user = User.create(request)  # Only works for platform itself
```

#### User.delete()

```python
def delete() -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L173-L190)

Delete this user from Roboto.

Permanently removes the user and all associated data. This action cannot be undone.

**Raises**

- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not authorized to delete this user.
- [`RobotoNotFoundException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The user no longer exists.

**Returns**

- `None`

**Usage**

Delete the current user:

```python
from roboto import User
user = User.for_self()
user.delete()  # Permanently removes the user
```

#### User.for_self()

```python
@classmethod
def for_self(roboto_client: Optional[roboto.http.RobotoClient] = None) -> User
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L76-L101)

Retrieve the current authenticated user.

Returns the User object for the currently authenticated user based on the authentication credentials in the provided or default client.

**Parameters**

- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `User`: User instance representing the authenticated user.

**Raises**

- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): No valid authentication credentials provided.

**Usage**

Get the current user:

```python
from roboto import User
current_user = User.for_self()
print(f"Current user: {current_user.name}")
```

#### User.from_id()

```python
@classmethod
def from_id(
    user_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> User
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L104-L131)

Load an existing user by their unique user ID.

User IDs are globally unique across the Roboto platform and typically correspond to email addresses for human users.

**Parameters**

- **user_id** (`str`): Unique identifier for the user to retrieve.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Optional Roboto client instance. If not provided, uses the default client.

**Returns**

- `User`: User instance for the specified user ID.

**Raises**

- [`RobotoNotFoundException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): No user exists with the specified ID.
- [`RobotoUnauthorizedException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The caller is not authorized to access this user.

**Usage**

Load a user by email:

```python
from roboto import User
user = User.from_id("alice@example.com")
print(f"User name: {user.name}")
```

#### User.to_dict()

```python
def to_dict() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L192-L208)

Convert this user to a dictionary representation.

Returns a JSON-serializable dictionary containing all user data.

**Returns**

- `dict[str, Any]`: Dictionary representation of the user.

**Usage**

Export user data:

```python
from roboto import User
user = User.for_self()
user_data = user.to_dict()
print(f"User created: {user_data.get('created')}")
```

#### User.update()

```python
def update(
    name: Optional[str] = None,
    picture_url: Optional[str] = None,
    notification_channels_enabled: Optional[dict[roboto.notifications.NotificationChannel, bool]] = None,
    notification_types_enabled: Optional[dict[roboto.notifications.NotificationType, bool]] = None,
) -> User
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/users/user.py#L210-L226)

**Parameters**

- **name** (`Optional[str]`)
- **picture_url** (`Optional[str]`)
- **notification_channels_enabled** (`Optional[dict[roboto.notifications.NotificationChannel, bool]]`)
- **notification_types_enabled** (`Optional[dict[roboto.notifications.NotificationType, bool]]`)

**Returns**

- `User`
