Skip to content

client.account

Bases: SyncResource

Sync account namespace (client.account) — the cross-workspace view.

tenants

tenants() -> _TenantsEnvelope

Every workspace this account belongs to, newest membership first. Unpaginated ({items} envelope).

create_tenant

create_tenant(*, name: str, slug: str) -> TenantMembership

Create a workspace as this account, who becomes its admin (201).

Raises:

Type Description
ConflictError

slug already taken (TENANT_SLUG_TAKEN).

UnprocessableError

invalid name/slug (reserved, bad charset).

invitations

invitations() -> _InvitationsEnvelope

Pending, unexpired invitations whose email exactly equals this account's email ({items} envelope).

accept_invitation

accept_invitation(invitation_id: UUID | str) -> TenantMembership

Join the inviting workspace at the invited role.

Raises:

Type Description
NotFoundError

unknown id, or the invitation is addressed to a different email (INVITATION_NOT_FOUND — no cross-account oracle).

ConflictError

already resolved (INVITATION_NOT_PENDING) or the workspace is at its user quota (RESOURCE_LIMIT_EXCEEDED).

GoneError

expired, or the workspace was deleted (INVITATION_EXPIRED).

decline_invitation

decline_invitation(invitation_id: UUID | str) -> None

Turn the invitation down (204). Terminal; an admin can re-invite.

Response models

Models returned by client.account methods (fields, types, and what each means).

Account-surface + invitation domain models (ADR-0113).

The ACCOUNT is the WorkOS identity behind a JWT session; a membership ties it to one workspace. Invitations are offers of membership, accepted in-app by an account whose email exactly matches. Response models use extra="allow" (tolerant reader); leaf module, no cross-type imports.

TenantMembership

Bases: BaseModel

One workspace an account belongs to (client.account.tenants() item, and the result of accepting an invitation).

MyInvitation

Bases: BaseModel

A pending invitation addressed to this account's email.

Invitation

Bases: BaseModel

Admin view of one workspace invitation. accept_url is the copyable invite link (possession alone grants nothing — acceptance requires signing in with the invited email).