Skip to main content

aip_sdk.User

aip_sdk.User(data: dict[str, Any], client: APIClient)

A platform user account.

Users are created and managed by platform admins. Non-admin users must be created with an initial workspace assignment.

Use reset_token() to generate a token_id that the user can pass as an x-api-key header for SDK / CI access without a password.

aip_sdk.User.create​

aip_sdk.User.create(username: str, password: str, is_platform_admin: bool = False, workspace_id: str | None = None, workspace_role: str = 'workspace_viewer', client: APIClient | None = None) -> User

Create a new user account.

Parameters

  • username str: User's username address (must be unique).
  • password str: Initial password (min 8 characters).
  • is_platform_admin bool: Grant platform admin privileges (default False).
  • workspace_id str | None: Required for non-admin users. Initial workspace assignment.
  • workspace_role str: Initial role in the assigned workspace.
  • client APIClient | None: Optional API client.

Returns

Raises

  • APIError: If the username is already in use (409) or password is too short (422).
  • ForbiddenError: If the caller is not a platform admin.
  • InvalidArgumentError: If a non-admin user is created with no workspace_id.

aip_sdk.User.created_at​

aip_sdk.User.created_at: datetime = parse_dt(data['created_at']) or datetime.now(tz=UTC)

No docstring is defined in the source.

aip_sdk.User.deactivate​

aip_sdk.User.deactivate() -> User

Deactivate this user account.

The user's row is preserved — so attribution on the runs, projects, and datasets they created survives — but they are denied login, API-key, and bearer-token access until reactivate() is called. Idempotent.

Sets is_active to False in-place and returns self.

Raises

  • ForbiddenError: If the caller is not a platform admin.
  • APIError: If you attempt to deactivate your own account (422).

aip_sdk.User.get​

aip_sdk.User.get(user_id: str, client: APIClient | None = None) -> User

Fetch a user by ID.

Parameters

  • user_id str: User ID.
  • client APIClient | None: Optional API client.

Raises

aip_sdk.User.has_token​

aip_sdk.User.has_token: bool = bool(data.get('has_token', False))

No docstring is defined in the source.

aip_sdk.User.id​

aip_sdk.User.id: str = data['id']

No docstring is defined in the source.

aip_sdk.User.is_active​

aip_sdk.User.is_active: bool = bool(data.get('is_active', True))

No docstring is defined in the source.

aip_sdk.User.is_platform_admin​

aip_sdk.User.is_platform_admin: bool = bool(data.get('is_platform_admin', False))

No docstring is defined in the source.

aip_sdk.User.list​

aip_sdk.User.list(page: int = 1, per_page: int = 20, client: APIClient | None = None) -> list[User]

Return a paginated list of users.

Parameters

  • page int: Page number (1-based).
  • per_page int: Items per page (max 100).
  • client APIClient | None: Optional API client.

Raises

aip_sdk.User.reactivate​

aip_sdk.User.reactivate() -> User

Reactivate a previously deactivated user.

Restores login, API-key, and bearer-token access using the user's existing credentials. Idempotent.

Sets is_active to True in-place and returns self.

Raises

aip_sdk.User.reset_password​

aip_sdk.User.reset_password(new_password: str) -> User

Set a new password for this user.

Parameters

  • new_password str: New password (min 8 characters).

Raises

aip_sdk.User.reset_token​

aip_sdk.User.reset_token() -> str

Generate a new API token for programmatic access.

Issues a new x-api-key token for this user, suitable for SDK and CI/CD contexts where password-based login is not practical.

The raw token is returned and also stored as raw_token for immediate use. Store it securely now — it is shown exactly once and cannot be retrieved again. Calling this method again issues a new token and immediately invalidates the previous one.

Updates has_token to True in-place.

Returns

  • str: The raw API token string (aip_...). Pass this as api_key
  • to str: func:~aip_sdk.init or set as AIP_API_KEY in CI secrets.

Raises

aip_sdk.User.update​

aip_sdk.User.update(username: str | None = None, is_platform_admin: bool | None = None) -> User

Update this user's username and/or platform-admin flag.

Mutates the instance in-place and returns self.

Parameters

  • username str | None: New username address (must be unique).
  • is_platform_admin bool | None: New platform-admin flag value.

Raises

aip_sdk.User.updated_at​

aip_sdk.User.updated_at: datetime = parse_dt(data['updated_at']) or datetime.now(tz=UTC)

No docstring is defined in the source.

aip_sdk.User.username​

aip_sdk.User.username: str = data['username']

No docstring is defined in the source.