Skip to content

Users Module

SDK reference for user CRUD operations

The users module provides CRUD over user accounts. Mutations require platform-admin privileges; non-admins can list() and get() users within their own organization.

from bifrost import users
MethodReturnsDescription
users.list()list[UserPublic]List users (optionally filter by org or include inactive)
users.get()UserPublic | NoneLook up a user by ID or email
users.create()UserPublicCreate a new user (admin only)
users.update()UserPublicPatch user fields (admin only)
users.delete()boolPermanently delete a user (admin only)
async def list(
org_id: str | None = None,
include_inactive: bool = False,
) -> list[UserPublic]
ParameterTypeDescription
org_idstr | NoneFilter by organization (admin only)
include_inactiveboolInclude disabled users
team = await users.list(org_id="org-123")
all_users = await users.list(include_inactive=True)
async def get(user_id: str) -> UserPublic | None

Returns None (not an exception) when the user doesn’t exist. Accepts either a UUID or an email.

user = await users.get("alice@example.com")
if user:
print(user.name)
async def create(
email: str,
name: str,
is_superuser: bool = False,
org_id: str | None = None,
is_active: bool = True,
) -> UserPublic
ParameterTypeDescription
emailstrEmail address (must be unique)
namestrDisplay name
is_superuserboolMake this user a platform admin
org_idstr | NoneOrganization ID (required for non-superusers)
is_activeboolWhether the account is enabled

Raises PermissionError if the caller is not a platform admin, ValueError on validation failure (e.g. missing org_id for a non-superuser).

new_user = await users.create(
email="alice@acme.com",
name="Alice Smith",
org_id="org-123",
)
async def update(user_id: str, **updates: Any) -> UserPublic

Accepts any patchable field as a keyword argument (email, name, is_active, is_superuser, …). Raises ValueError if the user is not found.

await users.update("user-123", name="Alice Smith-Jones", is_active=True)
async def delete(user_id: str) -> bool

Permanently deletes the user. Raises ValueError if the user doesn’t exist or if the caller tries to delete their own account.

await users.delete("user-123")

The public-safe shape of a user record. Defined in bifrost.models. Common fields include id, email, name, organization_id, is_superuser, is_active, roles, and timestamps. See the bifrost.models module for the canonical definition.