users
Client for user management and admin user endpoints.
Classes
UsersClient
UsersClient(client: OWUIClientBase)
Bases: ResourceBase
Client for User management endpoints.
This client handles operations related to user accounts, profiles, settings, permissions, and groups.
- Code Reference client Classes OpenWebUI Attributes users
Source code in src/owui_client/client_base.py
Functions
get_users
get_users(
query: Optional[str] = None,
order_by: Optional[str] = None,
direction: Optional[str] = None,
page: Optional[int] = 1,
) -> UserGroupIdsListResponse
Get users with pagination and filtering.
This endpoint is typically used by admins to manage users. Note: While the backend model layer supports complex filtering (e.g., by channel_id, user_ids), this endpoint currently only exposes query, order_by, direction, and page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Optional[str]
|
Search query for name or email. |
None
|
order_by
|
Optional[str]
|
Field to order by (e.g., 'name', 'email', 'created_at', 'last_active_at', 'updated_at', 'role'). |
None
|
direction
|
Optional[str]
|
Sort direction ('asc' or 'desc'). |
None
|
page
|
Optional[int]
|
Page number (starts at 1). |
1
|
Returns:
| Type | Description |
|---|---|
UserGroupIdsListResponse
|
|
Source code in src/owui_client/routers/users.py
get_all_users
get_all_users() -> UserInfoListResponse
Get all users (abbreviated info).
Retrieves a list of all users with basic information. This is an admin-only endpoint.
Returns:
| Type | Description |
|---|---|
UserInfoListResponse
|
|
Source code in src/owui_client/routers/users.py
search_users
search_users(
query: Optional[str] = None,
) -> UserIdNameListResponse
Search users by query (name or email).
Searches for users matching the query string. Returns the first page of results (limit 30).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Optional[str]
|
Search query string. |
None
|
Returns:
| Type | Description |
|---|---|
UserIdNameListResponse
|
|
Source code in src/owui_client/routers/users.py
get_user_groups
get_user_groups() -> List[GroupModel]
Get the groups the current user belongs to.
Returns:
| Type | Description |
|---|---|
List[GroupModel]
|
List[GroupModel]: List of groups the user is a member of. |
Source code in src/owui_client/routers/users.py
get_user_permissions
Get the current user's permissions.
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
Dictionary of user permissions (workspace, sharing, chat, features). |
Source code in src/owui_client/routers/users.py
get_default_user_permissions
get_default_user_permissions() -> UserPermissions
Get the default user permissions.
This is an admin-only endpoint.
Returns:
| Type | Description |
|---|---|
UserPermissions
|
|
Source code in src/owui_client/routers/users.py
update_default_user_permissions
update_default_user_permissions(
permissions: UserPermissions,
) -> UserPermissions
Update the default user permissions.
This is an admin-only endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
permissions
|
UserPermissions
|
The new default permissions. |
required |
Returns:
| Type | Description |
|---|---|
UserPermissions
|
|
Source code in src/owui_client/routers/users.py
get_default_user_permission_defaults
get_default_user_permission_defaults() -> UserPermissions
Get the built-in default user permission set.
Returns the hardcoded DEFAULT_USER_PERMISSIONS shipped with Open WebUI,
unaffected by the currently configured defaults returned by
get_default_user_permissions. Intended for a "reset permissions to
defaults" workflow.
This is an admin-only endpoint.
Returns:
| Type | Description |
|---|---|
UserPermissions
|
|
Source code in src/owui_client/routers/users.py
get_user_settings
get_user_settings() -> Optional[UserSettings]
Get the current session user's settings.
Returns:
| Type | Description |
|---|---|
Optional[UserSettings]
|
Optional[UserSettings]: User settings if available. |
Source code in src/owui_client/routers/users.py
update_user_settings
update_user_settings(
settings: UserSettings,
) -> UserSettings
Update the current session user's settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
UserSettings
|
The new user settings. |
required |
Returns:
| Type | Description |
|---|---|
UserSettings
|
|
Source code in src/owui_client/routers/users.py
get_user_status
get_user_status() -> UserModel
Get the current session user's status.
Returns:
| Type | Description |
|---|---|
UserModel
|
|
Source code in src/owui_client/routers/users.py
update_user_status
update_user_status(status: UserStatus) -> UserModel
Update the current session user's status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
UserStatus
|
The new user status. |
required |
Returns:
| Type | Description |
|---|---|
UserModel
|
|
Source code in src/owui_client/routers/users.py
get_user_info
Get the current session user's info.
This returns extra info stored in the user's 'info' JSON field.
Returns:
| Type | Description |
|---|---|
Optional[Dict[str, Any]]
|
Optional[Dict[str, Any]]: User info dictionary. |
Source code in src/owui_client/routers/users.py
update_user_info
Update the current session user's info.
Merges the provided dictionary with the existing info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
Dict[str, Any]
|
The new info dictionary to merge/update. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Dict[str, Any]]
|
Optional[Dict[str, Any]]: The updated user info dictionary. |
Source code in src/owui_client/routers/users.py
get_user_variables
get_user_variables() -> UserVariablesResponse
Get the calling (session) user's variables.
Variables are template substitutions available in system prompts via
{{ user.variables.KEY }}. The response is normalized to dict[str, str].
Returns:
| Type | Description |
|---|---|
UserVariablesResponse
|
|
Source code in src/owui_client/routers/users.py
update_user_variables
update_user_variables(
variables: Dict[str, str],
) -> UserVariablesResponse
Update the calling (session) user's variables.
Replaces the user's stored variables with the supplied mapping. Keys
must match ^[a-z][a-z0-9_]*$ and values must be strings; the backend
rejects invalid input with HTTP 400.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables
|
Dict[str, str]
|
Mapping of variable key to string value. |
required |
Returns:
| Type | Description |
|---|---|
UserVariablesResponse
|
|
UserVariablesResponse
|
the user. |
Source code in src/owui_client/routers/users.py
get_user_usage
get_user_usage(
days: Optional[int] = None,
start_date: Optional[int] = None,
end_date: Optional[int] = None,
) -> UserUsageResponse
Get usage info for the calling (session) user.
Returns aggregate token/message totals, daily/weekly/cumulative activity heatmaps, derived insights, and top models/tools over a time window.
The period is determined by the first available of: an explicit
start_date/end_date window, a days count back from end_date
(or now), or a default spanning up to two years from the user's
creation date. When days is given it must be between 7 and 732.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
days
|
Optional[int]
|
Number of days to cover (must be between 7 and 732). Used
only if |
None
|
start_date
|
Optional[int]
|
Period start as a Unix epoch timestamp (seconds). |
None
|
end_date
|
Optional[int]
|
Period end as a Unix epoch timestamp (seconds); defaults to now. |
None
|
Returns:
| Type | Description |
|---|---|
UserUsageResponse
|
|
Source code in src/owui_client/routers/users.py
get_user_by_id
get_user_by_id(user_id: str) -> UserActiveResponse
Get a user by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Type | Description |
|---|---|
UserActiveResponse
|
|
Source code in src/owui_client/routers/users.py
update_user_by_id
update_user_by_id(
user_id: str, form_data: UserUpdateForm
) -> UserModel
Update a user by ID.
This is an admin-only endpoint. It can be used to update user details including role and password.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user to update. |
required |
form_data
|
UserUpdateForm
|
The update form data. |
required |
Returns:
| Type | Description |
|---|---|
UserModel
|
|
Source code in src/owui_client/routers/users.py
delete_user_by_id
Delete a user by ID.
This is an admin-only endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user to delete. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if successful. |
Source code in src/owui_client/routers/users.py
get_user_oauth_sessions_by_id
get_user_oauth_sessions_by_id(
user_id: str,
) -> List[OAuthSessionModel]
Get OAuth sessions for a user by ID.
This is an admin-only endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Type | Description |
|---|---|
List[OAuthSessionModel]
|
List[OAuthSessionModel]: List of OAuth sessions. |
Source code in src/owui_client/routers/users.py
get_user_profile_image_by_id
Get a user's profile image by ID.
Returns the image content (bytes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bytes |
bytes
|
Image content. |
Source code in src/owui_client/routers/users.py
get_user_active_status_by_id
Get a user's active status by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, bool]
|
Dict[str, bool]: Dictionary with 'active' status key. |
Source code in src/owui_client/routers/users.py
get_user_groups_by_id
get_user_groups_by_id(user_id: str) -> List[GroupModel]
Get the groups a user belongs to by user ID.
This is an admin-only endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user. |
required |
Returns:
| Type | Description |
|---|---|
List[GroupModel]
|
List[GroupModel]: List of groups. |
Source code in src/owui_client/routers/users.py
get_user_preview_by_id
get_user_preview_by_id(user_id: str) -> UserPreview
Get a preview of the resources a user can access.
Returns a summary showing which models, knowledge bases, and tools the specified user can access across all groups they belong to. Useful for administrators to audit a user's effective permissions.
This is an admin-only endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The ID of the user to preview. |
required |
Returns:
| Type | Description |
|---|---|
UserPreview
|
|
UserPreview
|
groups, and the accessible models/knowledge/tools with totals. |