Skip to main content

Users

Read platform users, manage your own profile, and administer users.

Access it as client.users on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: search, active, sort
for user in client.users.list():
print(user.id)

Methods​

Core​

list​

list(*, search: str | None = None, active: bool | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[User]

List the users you can see, newest first.

On Strongly Cloud these are the members of your organization; otherwise every user (a platform admin sees every user). An archived user is never listed.

Parameters

  • search (str | None, optional): Only users whose email address or name contains this text (case insensitive).
  • active (bool | None, optional): True lists only active users, False only deactivated ones. The API's default is both.
  • sort (str | None, optional): The order, as comma-separated wire field names, each prefixed with - for descending, on the stored user record (for example "profile.name"). The API's default is "-createdAt".
  • limit (int | None, optional): The most users to return; None returns every one.

Returns

  • SyncPaginator[User]: Each user's id, username, email and role, fetched a page at a time.

create​

create(*, email: str, name: str, role: str | None = None, send_email: bool | None = None, profile: Mapping[str, Any] | None = None) -> CreatedUser

Create a user (platform admins).

The user gets a temporary password, a default API key and an organization of their own.

Parameters

  • email (str): The user's email address, not already registered.
  • name (str): The person's name, never an email address (refused with 400). Their own organization is named after it: "<name>'s Organization".
  • role (str | None, optional): The user's platform role: "admin", "developer" or "app". The API's default (and its choice for any other value) is "app".
  • send_email (bool | None, optional): False sends no welcome email. The API's default emails the user a link to set their password, when the platform sends mail.
  • profile (Mapping[str, Any] | None, optional): More profile fields to store on the user, with their wire names.

Returns

  • CreatedUser: The new user, as retrieve shows them, and their temporary password.

Raises

  • PermissionDeniedError: You are not a platform admin.
  • ConflictError: A user with this email already exists (error_code duplicate).
  • ValidationError: email is not a valid address.

retrieve​

retrieve(user_id: str) -> User

Retrieve a user you can see.

Parameters

  • user_id (str): The user's id.

Returns

  • User: The user's id, username, email and role.

Raises

  • NotFoundError: There is no such user, or it is outside your organization.

update​

update(user_id: str, *, name: str | None = None, email: str | None = None, active: bool | None = None, is_admin: bool | None = None, is_developer: bool | None = None) -> User

Update a user (platform admins).

Only the fields you give change. Returns the user, as retrieve does.

Parameters

  • user_id (str): The user's id.
  • name (str | None, optional): The user's display name.
  • email (str | None, optional): The user's email address; it becomes unverified.
  • active (bool | None, optional): False deactivates the user and revokes their API keys; True reactivates them and issues a new default API key.
  • is_admin (bool | None, optional): With is_developer, sets the user's one platform role: "admin" when is_admin is true, else "developer" when is_developer is true, else "app". Giving either replaces the user's role.
  • is_developer (bool | None, optional): See is_admin.

Raises

  • PermissionDeniedError: You are not a platform admin.
  • NotFoundError: There is no such user.
  • ConflictError: email belongs to another user.

Lifecycle & actions​

archive​

archive(user_id: str, *, transfer_to: str | None = None, delete_resources: bool = False) -> UserArchiveResult

Archive a user (platform admins).

The user is deactivated and signed out, and their API keys are deleted. Their memberships (organization memberships, app-user entries, team seats) are archived with them, never deleted, so they no longer count as members, app users or seats; Stripe stops collecting the app subscriptions they pay for. Users are never deleted. An archived user is never listed or returned by the API, and the API cannot unarchive one: an administrator does that by hand in the dashboard.

Their resources are either transferred (transfer_to) or deleted (delete_resources=True): when they own anything one of the two is required. Only a user who owns nothing is archived with neither.

Parameters

  • user_id (str): The user's id; not your own.
  • transfer_to (str | None, optional): Who receives their resources: one of Users.assets' transfer_recipients (any active admin or developer; on Strongly Cloud any active developer of their organization, never an admin). They own every resource with its access and sharing, and its FinOps cost from that moment on, running workloads included; what it cost before stays with the archived user. Resources stay in their organization.
  • delete_resources (bool, optional): True deletes everything they own. Not with transfer_to. One of the two is required unless they own nothing.

Returns

  • UserArchiveResult: The user, with what was done with their resources (transferred or deleted; asset_action None when they owned nothing).

Raises

  • PermissionDeniedError: You are not a platform admin.
  • NotFoundError: There is no such user.
  • ValidationError: Both transfer_to and delete_resources were given, neither was given for a user who owns resources (validation-error), or transfer_to is not someone who may receive them.

Other​

app_cards​

app_cards(*, limit: int | None = None) -> SyncPaginator[AppCard]

List the apps you may open, as cards: your Home App first, then the others by name.

Each card is the app's name, display name and icon, and whether it opens now; nothing else of an app. It is an app user's whole view of the platform.

Parameters

  • limit (int | None, optional): The most to return; all of them when omitted.

Returns

  • SyncPaginator[AppCard]: Your app cards.

assets​

assets(user_id: str) -> UserAssetSummary

Summarize the resources a user owns (platform admins).

Read it before archiving a user, to see what a transfer or deletion would affect and who the resources may be transferred to.

Parameters

  • user_id (str): The user's id.

Returns

  • UserAssetSummary: The counts of the user's resources by type, what deleting them would remove, and who they may be transferred to (transfer_recipients).

Raises

  • PermissionDeniedError: You are not a platform admin.
  • NotFoundError: There is no such user.

delete_me​

delete_me() -> AccountDeletionResult

Delete your own account.

Every resource you own is deleted, your account is archived, your API keys are deleted (including the one this client uses) and your sessions end. Your memberships (organization, app-user entries, team seats) are archived with the account. This cannot be undone from the API.

Returns

  • AccountDeletionResult: What was deleted (nothing, when the account was already deleted).

github_ssh_keys​

github_ssh_keys(*, limit: int | None = None) -> SyncPaginator[GithubSSHKey]

List your GitHub SSH keys.

A GitHub source for an app, volume or project names one of these keys by id. Keys are added in the platform's profile settings.

Parameters

  • limit (int | None, optional): The most to return; all of them when omitted.

Returns

  • SyncPaginator[GithubSSHKey]: Your keys: their public halves, never the private keys.

me​

me() -> CurrentUser

Return who you are authenticated as.

Returns

  • CurrentUser: Your user id, username, email and role, your organization, the api_key the request used, an app user's home_app_id, and governance_email.

reset_password​

reset_password(user_id: str) -> PasswordResetResult

Start a password reset for a user (platform admins).

The user is emailed a reset link when the platform sends mail.

Parameters

  • user_id (str): The user's id.

Returns

  • PasswordResetResult: The user, with whether the link was emailed and the reset token when it was not.

Raises

  • PermissionDeniedError: You are not a platform admin.
  • NotFoundError: There is no such user.
  • UnprocessableEntityError: The user has no email address.

update_me​

update_me(*, name: str | None = None, photo: str | None = None, governance_email: bool | None = None) -> CurrentUser

Update your own profile.

Only the fields you give change. Returns you, as me does.

Parameters

  • name (str | None, optional): Your display name (an empty name is ignored).
  • photo (str | None, optional): Your profile photo, as a URL or a base64 data URL.
  • governance_email (bool | None, optional): Whether governance events (approval requests, decisions, escalations) are emailed to you. They always appear in your notifications in the app.
  • STAN's personality is a STAN setting:
  • ```client.stan_settings.update_personality``.`