Organizations Module

Complete API reference for sso.organizations module - organization management, members, end-users, audit logs, webhooks, and SCIM.

Updated Dec 31, 2025 Edit this page

Organizations Module

The organizations module (sso.organizations) manages multi-tenant organizations, their members, end-users, billing credentials, audit logs, and webhooks.

Core Organization Methods

sso.organizations.create()

Signature:

create(payload: CreateOrganizationPayload): Promise<CreateOrganizationResponse>

Description: Create a new organization (requires authentication). The authenticated user becomes the organization owner. Returns JWT tokens with organization context, eliminating the need to re-authenticate.

Parameters:

Name Type Description
payload CreateOrganizationPayload Organization creation payload
payload.slug string Unique organization slug
payload.name string Organization display name

Returns: Promise<CreateOrganizationResponse> - Created organization details and tokens.

Example:

const result = await sso.organizations.create({
  slug: 'acme-corp',
  name: 'Acme Corporation'
});
authStore.setTokens(result.access_token, result.refresh_token);

sso.organizations.list()

Signature:

list(params?: ListOrganizationsParams): Promise<OrganizationResponse[]>

Description: List all organizations the authenticated user is a member of.

Parameters:

Name Type Description
params ListOrganizationsParams (optional) Filtering and pagination options

Returns: Promise<OrganizationResponse[]> - Array of organizations.


sso.organizations.get()

Signature:

get(orgSlug: string): Promise<OrganizationResponse>

Description: Get detailed information for a specific organization.

Parameters:

Name Type Description
orgSlug string Organization slug

Returns: Promise<OrganizationResponse> - Organization details.


sso.organizations.select()

Signature:

select(orgSlug: string): Promise<SelectOrganizationResponse>

Description: Switch to a different organization context. Issues new JWT tokens with the organization claim.

Parameters:

Name Type Description
orgSlug string Organization slug to switch to

Returns: Promise<SelectOrganizationResponse> - New tokens with organization context.


sso.organizations.update()

Signature:

update(orgSlug: string, payload: UpdateOrganizationPayload): Promise<OrganizationResponse>

Description: Update organization details. Requires ‘owner’ or ‘admin’ role.

Parameters:

Name Type Description
orgSlug string Organization slug
payload UpdateOrganizationPayload Update payload

Returns: Promise<OrganizationResponse> - Updated organization details.


sso.organizations.delete()

Signature:

delete(orgSlug: string): Promise<void>

Description: Delete an organization and all associated data. Requires ‘owner’ role.

Parameters:

Name Type Description
orgSlug string Organization slug

Returns: Promise<void>


Members Module

The members module (sso.organizations.members) manages organization members.

sso.organizations.members.list()

Signature:

members.list(orgSlug: string): Promise<MemberListResponse>

Description: List all members of an organization.

Returns: Promise<MemberListResponse> - List of members.


sso.organizations.members.add()

Signature:

members.add(orgSlug: string, payload: CreateInvitationPayload): Promise<Invitation>

Description: Add a member immediately (auto-accept invitation). Useful for testing/admin.

Returns: Promise<Invitation>


End-Users Module

The end-users module (sso.organizations.endUsers) manages customers.

sso.organizations.endUsers.list()

Signature:

endUsers.list(orgSlug: string, params?: ListEndUsersParams): Promise<EndUserListResponse>

Description: List all end-users for an organization.

Returns: Promise<EndUserListResponse>


Audit Logs Module

The audit logs module (sso.organizations.auditLogs) accesses administrative audit trails.

sso.organizations.auditLogs.get()

Signature:

auditLogs.get(orgSlug: string, params?: AuditLogQueryParams): Promise<AuditLogResponse>

Description: Get audit logs for an organization.

Returns: Promise<AuditLogResponse>


sso.organizations.auditLogs.getEventTypes()

Signature:

auditLogs.getEventTypes(orgSlug: string): Promise<EventTypeInfo[]>

Description: Get available audit event types.

Returns: Promise<EventTypeInfo[]>


Webhooks Module

The webhooks module (sso.organizations.webhooks) manages event notifications.

sso.organizations.webhooks.create()

Signature:

webhooks.create(orgSlug: string, webhook: CreateWebhookRequest): Promise<WebhookResponse>

Description: Create a new webhook.

Returns: Promise<WebhookResponse>


sso.organizations.webhooks.list()

Signature:

webhooks.list(orgSlug: string): Promise<WebhookListResponse>

Description: List all webhooks.

Returns: Promise<WebhookListResponse>


sso.organizations.webhooks.get()

Signature:

webhooks.get(orgSlug: string, webhookId: string): Promise<WebhookResponse>

Description: Get a specific webhook.

Returns: Promise<WebhookResponse>


sso.organizations.webhooks.update()

Signature:

webhooks.update(orgSlug: string, webhookId: string, updates: UpdateWebhookRequest): Promise<WebhookResponse>

Description: Update a webhook.

Returns: Promise<WebhookResponse>


sso.organizations.webhooks.delete()

Signature:

webhooks.delete(orgSlug: string, webhookId: string): Promise<void>

Description: Delete a webhook.

Returns: Promise<void>


sso.organizations.webhooks.test()

Signature:

webhooks.test(orgSlug: string, webhookId: string): Promise<{ success: boolean; job_id: string; delivery_id: string }>

Description: Trigger a test event for a webhook.

Returns: Promise<{ success: boolean; job_id: string; delivery_id: string }>


sso.organizations.webhooks.getDeliveries()

Signature:

webhooks.getDeliveries(orgSlug: string, webhookId: string, params?: WebhookDeliveryQueryParams): Promise<WebhookDeliveryListResponse>

Description: Get delivery history for a webhook.

Returns: Promise<WebhookDeliveryListResponse>


sso.organizations.webhooks.getEventTypes()

Signature:

webhooks.getEventTypes(orgSlug: string): Promise<EventTypeInfo[]>

Description: Get available webhook event types.

Returns: Promise<EventTypeInfo[]>


SCIM Tokens Module

The SCIM module manages tokens for Directory Sync (SCIM).

sso.organizations.createToken()

Signature:

createToken(orgSlug: string, payload: CreateScimTokenRequest): Promise<ScimTokenResponse>

Description: Create a new SCIM token. The token is returned only once.

Parameters:

Name Type Description
orgSlug string Organization slug
payload CreateScimTokenRequest Description of the token

Returns: Promise<ScimTokenResponse>


sso.organizations.listTokens()

Signature:

listTokens(orgSlug: string): Promise<ListScimTokensResponse>

Description: List all SCIM tokens.

Returns: Promise<ListScimTokensResponse>


sso.organizations.revokeToken()

Signature:

revokeToken(orgSlug: string, tokenId: string): Promise<void>

Description: Revoke (disable) a SCIM token.

Returns: Promise<void>


sso.organizations.deleteToken()

Signature:

deleteToken(orgSlug: string, tokenId: string): Promise<void>

Description: Delete a SCIM token permanently.

Returns: Promise<void>


Billing Credentials Module

The billing credentials module (sso.organizations.billingCredentials) manages provider-specific billing keys (Stripe/Polar).

sso.organizations.billingCredentials.post()

Signature:

billingCredentials.post(orgSlug: string, provider: 'stripe' | 'polar', payload: any): Promise<void>

Description: Set billing credentials for a provider.

Parameters:

Name Type Description
orgSlug string Organization slug
provider ‘stripe’ | ‘polar’ Billing provider
payload any Credential payload

Returns: Promise<void>


sso.organizations.billingCredentials.delete()

Signature:

billingCredentials.delete(orgSlug: string, provider: 'stripe' | 'polar'): Promise<void>

Description: Delete billing credentials for a provider.

Returns: Promise<void>


Type Definitions

Refer to the main SDK type definitions or individual method signatures.