Organizations

Work with active organizations, workspaces, and membership data.

useOrganizationList()

useOrganizationList() is the broad organization-management hook built on top of useOrganizationMemberships(). It derives the organization list from the current user’s memberships, then layers the organization-level management actions on top of that list: members, invitations, domains, roles, enterprise connections, SCIM tokens, and organization creation or deletion.

export default function OrganizationPicker() {  const { organizations, loading } = useOrganizationList();  if (loading) {    return <p>Loading organizations…</p>;  }  return (    <ul>      {organizations?.map((organization) => (        <li key={organization.id}>{organization.name}</li>      ))}    </ul>  );}
organizations: Organization[] | undefined;
Organizations derived from the current user’s organization memberships.
[].id?: string | undefined;
Organization identifier.
[].name?: string | undefined;
Organization name.
[].image_url?: string | undefined;
Organization image URL.
[].description?: string | undefined;
Organization description.
[].member_count?: number | undefined;
Organization member count.
[].enforce_mfa?: boolean | undefined;
Whether the organization enforces MFA.
[].enable_ip_restriction?: boolean | undefined;
Whether the organization uses IP restrictions.
[].whitelisted_ips?: string[] | undefined;
Whitelisted IP addresses for the organization.
[].auto_assigned_workspace_id?: string | undefined;
Workspace automatically assigned for new members when configured.
loading: boolean;
Whether the organization memberships query is still loading.
error: null;
This hook currently hardcodes `null` instead of exposing the underlying membership-query error.
refetch: () => Promise<void>;
Revalidates the underlying organization memberships query.
createOrganization: (organization: NewOrgnization) => Promise<ApiResult<{ organization: Organization; membership: OrganizationMembership }>>;
Creates a new organization and refreshes both the organization list and the current session.
organization.name?: string | undefined;
Organization name.
organization.description?: string | undefined | undefined;
Optional organization description.
organization.image?: File | undefined | undefined;
Optional organization image.
updateOrganization: (organization: Organization, update: OrganizationUpdate) => Promise<ApiResult<Organization>>;
Updates one organization and refreshes the membership-derived list.
deleteOrganization: (organization: Organization) => Promise<void>;
Deletes an organization, clears token cache, and refreshes both the list and the current session.
leaveOrganization: (organization: Organization) => Promise<void>;
Leaves an organization as the current user.
getOrganizationMembers: (organization: Organization, params?: { page: number; limit: number; search?: string }) => Promise<PaginatedResponse<OrganizationMembership[]>>;
Loads organization members, optionally with pagination and search.
removeOrganizationMember: (organization: Organization, member: OrganizationMembership) => Promise<void>;
Removes one member from an organization.
getOrganizationRoles: (organization: Organization) => Promise<OrganizationRole[]>;
Loads the role definitions for an organization.
addRole: (organization: Organization, newRole: RoleCreate) => Promise<ApiResult<OrganizationRole>>;
Creates a custom organization role.
removeOrganizationRoles: (organization: Organization, role: OrganizationRole) => Promise<void>;
Removes one organization role.
addRoleToOrganizationMember: (organization: Organization, member: OrganizationMembership, role: OrganizationRole) => Promise<OrganizationMembership>;
Adds a role to a specific organization member.
removeRoleFromOrganizationMember: (organization: Organization, member: OrganizationMembership, role: OrganizationRole) => Promise<OrganizationMembership>;
Removes a role from a specific organization member.
getOrganizationInvitations: (organization: Organization) => Promise<OrganizationInvitation[]>;
Loads pending invitations for an organization.
inviteOrganizationMember: (organization: Organization, invitation: OrganizationInvitationPayload) => Promise<OrganizationInvitation>;
Invites a user into an organization, optionally into a workspace with a workspace role.
discardOrganizationInvitation: (organization: Organization, invitation: OrganizationInvitation) => Promise<OrganizationInvitation>;
Discards a pending organization invitation.
resendOrganizationInvitation: (organization: Organization, invitation: OrganizationInvitation) => Promise<OrganizationInvitation>;
Resends a pending organization invitation.
getOrganizationDomains: (organization: Organization) => Promise<OrganizationDomain[]>;
Loads verified and unverified organization domains.
addOrganizationDomain: (organization: Organization, domain: NewDomain) => Promise<ApiResult<OrganizationDomain>>;
Adds a new domain to an organization.
verifyOrganizationDomain: (organization: Organization, domain: OrganizationDomain) => Promise<ApiResult<OrganizationDomain>>;
Verifies one organization domain.
removeOrganizationDomain: (organization: Organization, domain: OrganizationDomain) => Promise<ApiResult<OrganizationDomain>>;
Removes one organization domain.
getEnterpriseConnections: (organization: Organization) => Promise<EnterpriseConnection[]>;
Loads enterprise SSO connections for an organization.
createEnterpriseConnection: (organization: Organization, payload: CreateEnterpriseConnectionPayload) => Promise<EnterpriseConnection>;
Creates a new enterprise SSO connection.
updateEnterpriseConnection: (organization: Organization, connectionId: string, payload: UpdateEnterpriseConnectionPayload) => Promise<EnterpriseConnection>;
Updates an existing enterprise SSO connection.
deleteEnterpriseConnection: (organization: Organization, connectionId: string) => Promise<void>;
Deletes an enterprise SSO connection.
testEnterpriseConnectionConfig: (organization: Organization, payload: { protocol: 'saml' | 'oidc'; idp_entity_id?: string; idp_sso_url?: string; idp_certificate?: string; oidc_issuer_url?: string; oidc_client_id?: string; oidc_client_secret?: string }) => Promise<{ success: boolean; protocol: string; checks: Record<string, boolean>; errors?: Record<string, string> }>;
Tests an enterprise-connection configuration before it is saved.
testEnterpriseConnection: (organization: Organization, connectionId: string) => Promise<{ success: boolean; protocol: string; checks: Record<string, boolean>; errors?: Record<string, string> }>;
Tests an existing enterprise connection.
generateSCIMToken: (organization: Organization, connectionId: string) => Promise<SCIMTokenInfo>;
Generates a SCIM token for one enterprise connection.
getSCIMToken: (organization: Organization, connectionId: string) => Promise<SCIMTokenInfo>;
Loads the current SCIM token information.
revokeSCIMToken: (organization: Organization, connectionId: string) => Promise<void>;
Revokes the SCIM token for one enterprise connection.

useActiveOrganization()

useActiveOrganization() is the active-scope wrapper over useOrganizationList(). It resolves the current active organization and active organization membership from the session, then rebinds the organization-level management methods so they operate on that active organization automatically.

export default function ActiveOrgHeader() {  const { activeOrganization, loading } = useActiveOrganization();  if (loading) {    return <p>Loading organization…</p>;  }  return <p>{activeOrganization?.name ?? 'No active organization'}</p>;}
activeOrganization: Organization | null;
Organization whose membership identifier matches the active sign-in in the session.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
image_url?: string | undefined;
Organization image URL.
description?: string | undefined;
Organization description.
member_count?: number | undefined;
Organization member count.
enforce_mfa?: boolean | undefined;
Whether the organization enforces MFA.
activeMembership: OrganizationMembershipWithOrganization | null;
Current active organization membership resolved from the session.
id?: string | undefined;
Organization-membership identifier.
organization?: Organization | undefined;
Organization attached to the active membership.
roles?: OrganizationRole[] | undefined;
Roles attached to the active membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the membership when one exists.
loading: boolean;
Whether the session or the underlying organization list is still loading.
error: Error | null;
Combined loading error from the session branch or the organization-list branch.
refetch?: () => Promise<void> | undefined;
Revalidates the underlying organization memberships query.
getRoles?: () => Promise<OrganizationRole[]> | undefined;
Loads roles for the active organization.
getMembers?: () => Promise<PaginatedResponse<OrganizationMembership[]> | []> | undefined;
Loads members for the active organization.
updateOrganization?: (update: OrganizationUpdate) => Promise<ApiResult<Organization> | []> | undefined;
Updates the active organization.
getDomains?: () => Promise<OrganizationDomain[] | []> | undefined;
Loads domains for the active organization.
addDomain?: (domain: NewDomain) => Promise<ApiResult<OrganizationDomain> | undefined> | undefined;
Adds a domain to the active organization.
verifyDomain?: (domain: OrganizationDomain) => Promise<ApiResult<OrganizationDomain> | undefined> | undefined;
Verifies one domain on the active organization.
removeDomain?: (domain: OrganizationDomain) => Promise<ApiResult<OrganizationDomain> | undefined> | undefined;
Removes one domain from the active organization.
getInvitations?: () => Promise<OrganizationInvitation[] | []> | undefined;
Loads invitations for the active organization.
removeMember?: (member: OrganizationMembership) => Promise<void | []> | undefined;
Removes a member from the active organization.
addMemberRole?: (member: OrganizationMembership, role: OrganizationRole) => Promise<OrganizationMembership | undefined> | undefined;
Adds a role to a member in the active organization.
removeMemberRole?: (member: OrganizationMembership, role: OrganizationRole) => Promise<OrganizationMembership | undefined> | undefined;
Removes a role from a member in the active organization.
inviteMember?: (invitationPayload: OrganizationInvitationPayload) => Promise<OrganizationInvitation | undefined> | undefined;
Invites a member into the active organization.
discardInvitation?: (invitation: OrganizationInvitation) => Promise<OrganizationInvitation | undefined> | undefined;
Discards an invitation from the active organization.
resendInvitation?: (invitation: OrganizationInvitation) => Promise<OrganizationInvitation | undefined> | undefined;
Resends an invitation from the active organization.
leave?: () => Promise<void | undefined> | undefined;
Leaves the active organization.
removeRole?: (role: OrganizationRole) => Promise<void | undefined> | undefined;
Removes a role from the active organization.
getEnterpriseConnections?: () => Promise<EnterpriseConnection[] | []> | undefined;
Loads enterprise connections for the active organization.
createEnterpriseConnection?: (payload: CreateEnterpriseConnectionPayload) => Promise<EnterpriseConnection | undefined> | undefined;
Creates an enterprise connection on the active organization.
updateEnterpriseConnection?: (connectionId: string, payload: UpdateEnterpriseConnectionPayload) => Promise<EnterpriseConnection | undefined> | undefined;
Updates an enterprise connection on the active organization.
deleteEnterpriseConnection?: (connectionId: string) => Promise<void | undefined> | undefined;
Deletes an enterprise connection on the active organization.
testEnterpriseConnectionConfig?: (payload: { protocol: 'saml' | 'oidc'; idp_entity_id?: string; idp_sso_url?: string; idp_certificate?: string; oidc_issuer_url?: string; oidc_client_id?: string; oidc_client_secret?: string }) => Promise<{ success: boolean; protocol: string; checks: Record<string, boolean>; errors?: Record<string, string> } | null> | undefined;
Tests an enterprise-connection configuration for the active organization.
testEnterpriseConnection?: (connectionId: string) => Promise<{ success: boolean; protocol: string; checks: Record<string, boolean>; errors?: Record<string, string> } | null> | undefined;
Tests an existing enterprise connection on the active organization.
generateSCIMToken?: (connectionId: string) => Promise<SCIMTokenInfo | undefined> | undefined;
Generates a SCIM token for an enterprise connection on the active organization.
getSCIMToken?: (connectionId: string) => Promise<SCIMTokenInfo | undefined> | undefined;
Loads SCIM token information for an enterprise connection on the active organization.
revokeSCIMToken?: (connectionId: string) => Promise<void | undefined> | undefined;
Revokes the SCIM token for an enterprise connection on the active organization.

useActiveTenancy()

useActiveTenancy() resolves the current active organization membership and workspace membership from the active sign-in in the session. It is the broadest “where am I scoped right now?” hook in the multi-tenancy layer.

export default function ActiveTenancySummary() {  const { loading, orgMembership, workspaceMembership } = useActiveTenancy();  if (loading) {    return <p>Loading tenancy…</p>;  }  return (    <div>      <p>Organization: {orgMembership?.organization.name ?? 'None'}</p>      <p>Workspace: {workspaceMembership?.workspace.name ?? 'None'}</p>    </div>  );}
loading: boolean;
Whether the session, organization memberships, or workspace memberships are still loading.
orgMembership: OrganizationMembership | null;
Organization membership whose identifier matches the active sign-in in the session.
id?: string | undefined;
Organization-membership identifier.
organization?: Organization | undefined;
Organization attached to the active membership.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
image_url?: string | undefined;
Organization image URL.
description?: string | undefined;
Organization description.
member_count?: number | undefined;
Organization member count.
enforce_mfa?: boolean | undefined;
Whether the organization enforces MFA.
enable_ip_restriction?: boolean | undefined;
Whether the organization uses IP restrictions.
user?: PublicUserData | undefined;
Public user data for the membership owner.
id?: string | undefined;
User identifier.
first_name?: string | undefined;
User first name.
last_name?: string | undefined;
User last name.
username?: string | undefined;
Username when one is set.
roles?: OrganizationRole[] | undefined;
Roles attached to the membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
public_metadata?: Record<string, unknown> | undefined;
Public metadata stored on the membership.
created_at?: string | undefined;
Creation timestamp for the membership.
updated_at?: string | undefined;
Last update timestamp for the membership.
workspaceMembership: WorkspaceMembership | null;
Workspace membership whose identifier matches the active sign-in in the session.
id?: string | undefined;
Workspace-membership identifier.
workspace?: Workspace | undefined;
Workspace attached to the active membership.
id?: string | undefined;
Workspace identifier.
name?: string | undefined;
Workspace name.
image_url?: string | undefined;
Workspace image URL.
description?: string | undefined;
Workspace description.
member_count?: number | undefined;
Workspace member count.
enforce_2fa?: boolean | undefined;
Whether the workspace enforces 2FA.
enable_ip_restriction?: boolean | undefined;
Whether the workspace uses IP restrictions.
organization?: Organization | undefined;
Parent organization for the workspace membership.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
roles?: WorkspaceRole[] | undefined;
Roles attached to the workspace membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the membership when one exists.
type?: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required" | undefined;
Restriction type.
message?: string | undefined;
Restriction message.

useWorkspaceList()

useWorkspaceList() is the broad workspace-management hook built on top of useWorkspaceMemberships(). It derives the workspace list from the current user’s workspace memberships, then layers workspace-level management actions on top of that list: members, roles, invitations, updates, and deletion.

export default function WorkspacePicker() {  const { workspaces, loading } = useWorkspaceList();  if (loading) {    return <p>Loading workspaces…</p>;  }  return (    <ul>      {workspaces.map((workspace) => (        <li key={workspace.id}>{workspace.name}</li>      ))}    </ul>  );}
workspaces: WorkspaceWithOrganization[];
Workspaces derived from the current user’s workspace memberships.
[].id?: string | undefined;
Workspace identifier.
[].name?: string | undefined;
Workspace name.
[].image_url?: string | undefined;
Workspace image URL.
[].description?: string | undefined;
Workspace description.
[].member_count?: number | undefined;
Workspace member count.
[].enforce_2fa?: boolean | undefined;
Whether the workspace enforces 2FA.
[].enable_ip_restriction?: boolean | undefined;
Whether the workspace uses IP restrictions.
[].organization?: Organization | undefined;
Parent organization attached to the workspace entry.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
[].eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the workspace membership when one exists.
loading: boolean;
Whether the workspace memberships query is still loading.
error: Error | null;
Underlying workspace-memberships query error.
refetch: () => Promise<void>;
Revalidates the underlying workspace memberships query.
createWorkspace: (organizationId: string, name: string, image?: File, description?: string) => Promise<{ workspace: Workspace; membership: WorkspaceMembership }>;
Creates a new workspace under one organization and refreshes the workspace list.
updateWorkspace: (workspace: Workspace, data: { name?: string; description?: string; image?: File; enforce_2fa?: boolean; enable_ip_restriction?: boolean; whitelisted_ips?: string[] }) => Promise<unknown>;
Updates one workspace and refreshes the list.
deleteWorkspace: (workspace: Workspace) => Promise<unknown>;
Deletes one workspace, clears token cache, and refreshes the list.
leaveWorkspace: (id: string, userId: string) => Promise<void>;
Leaves one workspace as one specific user and refreshes the list.
getWorkspaceMembers: (workspace: Workspace, params?: { page: number; limit: number; search?: string }) => Promise<PaginatedResponse<WorkspaceMembership[]>>;
Loads members for a workspace, optionally with pagination and search.
removeWorkspaceMember: (workspace: Workspace, memberId: string) => Promise<unknown>;
Removes one member from a workspace and refreshes the list.
getWorkspaceRoles: (workspace: Workspace) => Promise<WorkspaceRole[]>;
Loads roles for a workspace.
createWorkspaceRole: (workspace: Workspace, name: string, permissions: string[]) => Promise<WorkspaceRole>;
Creates a custom workspace role.
deleteWorkspaceRole: (workspace: Workspace, role: WorkspaceRole) => Promise<unknown>;
Deletes one workspace role.
addWorkspaceMemberRole: (workspace: Workspace, membershipId: string, roleId: string) => Promise<unknown>;
Adds one role to a workspace membership.
removeWorkspaceMemberRole: (workspace: Workspace, membershipId: string, roleId: string) => Promise<unknown>;
Removes one role from a workspace membership.
getWorkspaceInvitations: (workspace: WorkspaceWithOrganization) => Promise<any[]>;
Loads invitations for a workspace through the parent organization invitation surface.
createWorkspaceInvitation: (workspace: WorkspaceWithOrganization, email: string, workspaceRoleId?: string) => Promise<unknown>;
Creates a workspace invitation through the parent organization invitation surface.
discardWorkspaceInvitation: (workspace: WorkspaceWithOrganization, invitationId: string) => Promise<unknown>;
Discards a workspace invitation through the parent organization invitation surface.
resendWorkspaceInvitation: (workspace: WorkspaceWithOrganization, invitationId: string) => Promise<unknown>;
Resends a workspace invitation through the parent organization invitation surface.

useActiveWorkspace()

useActiveWorkspace() is the active-scope wrapper over useWorkspaceList(). It resolves the current active workspace and active workspace membership from the session, then rebinds the workspace-level management methods so they operate on that active workspace automatically.

export default function ActiveWorkspaceHeader() {  const { activeWorkspace, loading } = useActiveWorkspace();  if (loading) {    return <p>Loading workspace…</p>;  }  return <p>{activeWorkspace?.name ?? 'No active workspace'}</p>;}
activeWorkspace: Workspace | null;
Workspace whose membership identifier matches the active sign-in in the session.
id?: string | undefined;
Workspace identifier.
name?: string | undefined;
Workspace name.
image_url?: string | undefined;
Workspace image URL.
description?: string | undefined;
Workspace description.
member_count?: number | undefined;
Workspace member count.
enforce_2fa?: boolean | undefined;
Whether the workspace enforces 2FA.
enable_ip_restriction?: boolean | undefined;
Whether the workspace uses IP restrictions.
activeMembership: WorkspaceMembership | null;
Current active workspace membership resolved from the session.
id?: string | undefined;
Workspace-membership identifier.
workspace?: Workspace | undefined;
Workspace attached to the active membership.
organization?: Organization | undefined;
Parent organization attached to the active workspace membership.
roles?: WorkspaceRole[] | undefined;
Roles attached to the active workspace membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the membership when one exists.
loading: boolean;
Whether the session or the underlying workspace list is still loading.
error: Error | null;
Combined loading error from the session branch or the workspace-list branch.
refetch: () => Promise<void>;
Revalidates the underlying workspace memberships query.
leave?: () => Promise<void | undefined> | undefined;
Leaves the active workspace using the current sign-in user ID.
updateWorkspace?: (data: { name?: string; description?: string; image?: File; enforce_2fa?: boolean; enable_ip_restriction?: boolean; whitelisted_ips?: string[] }) => Promise<unknown> | undefined;
Updates the active workspace.
deleteWorkspace?: () => Promise<unknown> | undefined;
Deletes the active workspace.
getMembers?: (params?: { page: number; limit: number; search?: string }) => Promise<PaginatedResponse<WorkspaceMembership[]> | { data: []; meta: { total: number; page: number; limit: number } }> | undefined;
Loads members for the active workspace.
getRoles?: () => Promise<WorkspaceRole[]> | undefined;
Loads roles for the active workspace.
createRole?: (name: string, permissions: string[]) => Promise<WorkspaceRole | undefined> | undefined;
Creates a role on the active workspace.
deleteRole?: (role: WorkspaceRole) => Promise<unknown> | undefined;
Deletes a role from the active workspace.
removeMember?: (memberId: string) => Promise<unknown> | undefined;
Removes a member from the active workspace.
addMemberRole?: (membershipId: string, roleId: string) => Promise<unknown> | undefined;
Adds a role to a member in the active workspace.
removeMemberRole?: (membershipId: string, roleId: string) => Promise<unknown> | undefined;
Removes a role from a member in the active workspace.
getInvitations?: () => Promise<any[]> | undefined;
Loads invitations for the active workspace.
inviteMember?: (params: { email: string; workspaceRoleId?: string }) => Promise<unknown> | undefined;
Invites a member into the active workspace.
discardInvitation?: (invitationId: string) => Promise<unknown> | undefined;
Discards an invitation from the active workspace.
resendInvitation?: (invitationId: string) => Promise<unknown> | undefined;
Resends an invitation from the active workspace.

useOrganizationMemberships()

useOrganizationMemberships() is the raw organization-membership query that higher-level organization hooks build on top of. It loads the current user’s organization memberships with SWR and exposes the membership rows together with a manual refetch path.

export default function MembershipList() {  const { organizationMemberships, loading } = useOrganizationMemberships();  if (loading) {    return <p>Loading memberships…</p>;  }  return (    <ul>      {organizationMemberships?.map((membership) => (        <li key={membership.id}>{membership.organization.name}</li>      ))}    </ul>  );}
organizationMemberships: OrganizationMembershipWithOrganization[] | undefined;
Organization memberships for the current user.
[].id?: string | undefined;
Organization-membership identifier.
[].organization?: Organization | undefined;
Organization attached to the membership.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
image_url?: string | undefined;
Organization image URL.
description?: string | undefined;
Organization description.
member_count?: number | undefined;
Organization member count.
[].user_id?: string | undefined;
User identifier attached to the membership.
[].roles?: OrganizationRole[] | undefined;
Roles attached to the membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
[].public_metadata?: Record<string, unknown> | undefined;
Public metadata stored on the membership.
[].created_at?: string | undefined;
Creation timestamp for the membership.
[].updated_at?: string | undefined;
Last update timestamp for the membership.
[].eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the membership when one exists.
type?: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required" | undefined;
Restriction type.
message?: string | undefined;
Restriction message.
loading: boolean;
Whether the shared client or the organization-memberships query is still loading.
error: Error | undefined;
Underlying SWR error for the organization-memberships query.
refetch: () => Promise<void>;
Revalidates the organization-memberships query.

useWorkspaceMemberships()

useWorkspaceMemberships() is the raw workspace-membership query that higher-level workspace hooks build on top of. It loads the current user’s workspace memberships with SWR and exposes the membership rows together with a manual refetch path.

export default function WorkspaceMembershipList() {  const { workspaceMemberships, loading } = useWorkspaceMemberships();  if (loading) {    return <p>Loading memberships…</p>;  }  return (    <ul>      {workspaceMemberships?.map((membership) => (        <li key={membership.id}>{membership.workspace.name}</li>      ))}    </ul>  );}
workspaceMemberships: WorkspaceMembership[] | undefined;
Workspace memberships for the current user.
[].id?: string | undefined;
Workspace-membership identifier.
[].workspace?: Workspace | undefined;
Workspace attached to the membership.
id?: string | undefined;
Workspace identifier.
name?: string | undefined;
Workspace name.
image_url?: string | undefined;
Workspace image URL.
description?: string | undefined;
Workspace description.
member_count?: number | undefined;
Workspace member count.
enforce_2fa?: boolean | undefined;
Whether the workspace enforces 2FA.
enable_ip_restriction?: boolean | undefined;
Whether the workspace uses IP restrictions.
[].organization_id?: string | undefined;
Parent organization identifier for the workspace membership.
[].user_id?: string | undefined;
User identifier attached to the membership.
[].organization?: Organization | undefined;
Parent organization attached to the workspace membership.
id?: string | undefined;
Organization identifier.
name?: string | undefined;
Organization name.
[].roles?: WorkspaceRole[] | undefined;
Roles attached to the membership.
[].id?: string | undefined;
Role identifier.
[].name?: string | undefined;
Role name.
[].permissions?: string[] | undefined;
Permissions granted by the role.
[].public_metadata?: Record<string, unknown> | undefined;
Public metadata stored on the membership.
[].created_at?: string | undefined;
Creation timestamp for the membership.
[].updated_at?: string | undefined;
Last update timestamp for the membership.
[].eligibility_restriction?: { type: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required"; message: string } | undefined | undefined;
Eligibility restriction attached to the membership when one exists.
type?: "none" | "ip_not_allowed" | "mfa_required" | "ip_and_mfa_required" | undefined;
Restriction type.
message?: string | undefined;
Restriction message.
loading: boolean;
Whether the shared client or the workspace-memberships query is still loading.
error: Error | undefined;
Underlying SWR error for the workspace-memberships query.
refetch: () => Promise<void>;
Revalidates the workspace-memberships query.