Skip to main content
Version: 25.10

snorkelai.sdk.develop.User

final class snorkelai.sdk.develop.User(uid, username, role, default_view, email=None, timezone=None, is_superadmin=False, is_active=True)

Bases: Base

User management class for Snorkel SDK.

This class provides methods to create, retrieve, update, and delete users within Snorkel Flow. Each user is assigned a role that determines their permissions, and users are organized within workspaces.

__init__

__init__(uid, username, role, default_view, email=None, timezone=None, is_superadmin=False, is_active=True)

Create a user object in-memory with necessary properties. This constructor should not be called directly, and should instead be accessed through the create(), get(), and list() methods

Parameters

NameTypeDefaultInfo
uidintThe unique integer identifier for the user within Snorkel Flow.
usernamestrThe username of the user.
roleUserRoleThe role assigned to the user. Defaults to UserRole.standard if not set.
default_viewUserViewThe default view preference for the user. Defaults to UserView.standard if not set.
emailOptional[str]NoneThe email address of the user.
timezoneOptional[str]NoneThe timezone preference for the user.
is_superadminboolFalseWhether the user has superadmin privileges. Defaults to False if not set.
is_activeboolTrueWhether the user account is active. Defaults to True if not set.

Methods

__init__(uid, username, role, default_view)Create a user object in-memory with necessary properties.
create(username, password[, role, email, ...])Create a new user.
delete(user)Delete a user by UID or username.
get(user[, workspace])Get a user by UID or username.
list([include_inactive, ...])List all users in a workspace with optional filters.
reset_password(user, new_password)Reset any user's password without requiring old password.
update([email, role, timezone, ...])Update user properties.

Attributes

default_viewThe default view preference for the user
emailThe email address of the user
is_activeWhether the user account is active
is_superadminWhether the user has superadmin privileges
roleThe role assigned to the user
timezoneThe timezone preference for the user.
uidThe unique integer identifier for the user within Snorkel Flow
usernameThe username of the user

create

classmethod create(username, password, role=None, email=None, timezone=None)

Create a new user.

Examples

>>> from snorkelai.sdk.develop import User, UserRole
>>> new_user = User.create(username='jane_smith', password='SecurePass123!', role=UserRole.REVIEWER)
User jane_smith has been created with UID 42.
>>> new_user.username
'jane_smith'

Parameters

NameTypeDefaultInfo
usernamestrUsername for the new user.
passwordstrPassword for the new user (minimum 12 characters with at least 3 character types).
roleOptional[UserRole]NoneUser role - ‘standard’, ‘admin’, ‘reviewer’, ‘labeler’, or ‘superadmin’. Defaults to ‘standard’.
emailOptional[str]NoneEmail address for the user.
timezoneOptional[str]NoneIANA timezone (e.g., ‘America/Sao_Paulo’, ‘UTC’, ‘Europe/London’).

Returns

The created User object

Return type

User

delete

classmethod delete(user)

Delete a user by UID or username.

This performs a soft delete: sets is_active=False and clears email. Use list(include_inactive=True) to view deleted users.

Examples

>>> from snorkelai.sdk.develop import User
>>> User.delete("john_doe")
User john_doe has been deleted.

>>> User.delete(42)
User 42 has been deleted.

Parameters

NameTypeDefaultInfo
userUnion[str, int]User UID (int) or username (str).

Raises

ValueError – If the user is not found, or if there is a network error or HTTP error during the request.

Return type

None

get

classmethod get(user, workspace=None)

Get a user by UID or username.

Examples

>>> from snorkelai.sdk.develop import User
>>> user = User.get("john_doe")
>>> user.username
'john_doe'
>>> user.uid
42
>>> user.email
'john.doe@example.com'

>>> user = User.get(42, workspace="my-workspace")
>>> user.username
'jane_smith'

Parameters

NameTypeDefaultInfo
userUnion[str, int]User UID (int) or username (str).
workspaceUnion[str, int, None]NoneWorkspace UID (int) or workspace name (str). If None, uses the default workspace.

Returns

The user object with all user information

Return type

User

Raises

ValueError – If the user is not found in the specified workspace, or if there is a network error or HTTP error during the request.

list

classmethod list(include_inactive=False, include_superadmins=False, workspace=None)

List all users in a workspace with optional filters.

Examples

>>> from snorkelai.sdk.develop import User
>>> users = User.list()
>>> users[0].username
'john_doe'

>>> inactive_users = User.list(include_inactive=True)
>>> all_users = User.list(include_superadmins=True, workspace="my-workspace")

Parameters

NameTypeDefaultInfo
include_inactiveboolFalseInclude inactive/deleted users in the results.
include_superadminsboolFalseInclude superadmin users in the results.
workspaceUnion[str, int, None]NoneWorkspace UID (int) or workspace name (str). If None, uses the default workspace.

Returns

List of User objects matching the filter criteria

Return type

List[User]

reset_password

classmethod reset_password(user, new_password)

Reset any user’s password without requiring old password.

Accepts user UID (int) or username (str).

Examples

>>> from snorkelai.sdk.develop import User
>>> User.reset_password("john_doe", "NewSecurePass123!")
Password for user john_doe has been reset.

>>> User.reset_password(42, "AnotherPass456!")
Password for user 42 has been reset.

Parameters

NameTypeDefaultInfo
userUnion[str, int]User UID (int) or username (str).
new_passwordstrNew password to set for the user.

Raises

ValueError – If the user is not found, or if there is a network error or HTTP error during the request.

Return type

None

update

update(email=None, role=None, timezone=None, is_superadmin=None, default_view=None)

Update user properties.

Examples

>>> from snorkelai.sdk.develop import User
>>> user = User.get("john_doe")
>>> user.update(email="john.doe@example.com")
User john_doe (UID: 42) has been updated.
>>> user.email
'john.doe@example.com'

>>> user.update(timezone="America/New_York")
User john_doe (UID: 42) has been updated.
>>> user.timezone
'America/New_York'

Parameters

NameTypeDefaultInfo
emailOptional[str]NoneEmail address for the user.
roleOptional[UserRole]NoneUser role - ‘standard’, ‘admin’, ‘reviewer’, ‘labeler’, or ‘superadmin’.
timezoneOptional[str]NoneIANA timezone (e.g., ‘America/Sao_Paulo’, ‘UTC’, ‘Europe/London’).
is_superadminOptional[bool]NoneWhether the user should be a superadmin.
default_viewOptional[UserView]NoneDefault view for the user.

Return type

None

note
To deactivate a user (set is_active=False), use User.delete() which performs a soft delete.
property default_view: UserView

The default view preference for the user

property email: str | None

The email address of the user

property is_active: bool

Whether the user account is active

property is_superadmin: bool

Whether the user has superadmin privileges

property role: UserRole

The role assigned to the user

property timezone: str | None

The timezone preference for the user.

property uid: int

The unique integer identifier for the user within Snorkel Flow

property username: str

The username of the user