Organization

@Serializable
data class Organization(val id: String, val name: String, val slug: String?, val imageUrl: String, val hasImage: Boolean = false, val membersCount: Int? = null, val pendingInvitationsCount: Int? = null, val maxAllowedMemberships: Int, val adminDeleteEnabled: Boolean, val createdAt: Long, val updatedAt: Long, val publicMetadata: JsonElement)

The Organization object holds information about an organization, as well as methods for managing it.

Organizations in Clerk represent a collection of users and provide a structured way to manage permissions, roles, and memberships within your application. This data class contains all the essential information about an organization and provides companion methods for creation and retrieval.

Constructors

Link copied to clipboard
constructor(id: String, name: String, slug: String?, imageUrl: String, hasImage: Boolean = false, membersCount: Int? = null, pendingInvitationsCount: Int? = null, maxAllowedMemberships: Int, adminDeleteEnabled: Boolean, createdAt: Long, updatedAt: Long, publicMetadata: JsonElement)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Whether the admin of an organization can delete it.

Link copied to clipboard

The timestamp the organization was created at (Unix timestamp in milliseconds).

Link copied to clipboard
val hasImage: Boolean = false

Whether the organization has an uploaded image.

Link copied to clipboard
val id: String

The unique identifier of the related organization.

Link copied to clipboard

Holds the organization logo or default logo. Compatible with Clerk's Image Optimization.

Link copied to clipboard

The maximum number of memberships allowed for the organization.

Link copied to clipboard
val membersCount: Int? = null

The number of members the associated organization contains.

Link copied to clipboard

The name of the related organization.

Link copied to clipboard

The number of pending invitations to users to join the organization.

Link copied to clipboard
val publicMetadata: JsonElement

Metadata that can be read from the Frontend API and Backend API and can be set only from the Backend API.

Link copied to clipboard
val slug: String?

The organization slug. If supplied, it must be unique for the instance.

Link copied to clipboard

The timestamp the organization was last updated at (Unix timestamp in milliseconds).

Functions

Link copied to clipboard

Bulk create an invitation for a user to join an organization.

Link copied to clipboard

Creates a new domain for this organization.

Link copied to clipboard

Create an invitation for a user to join an organization. *

Link copied to clipboard

Creates a new membership for this organization.

Link copied to clipboard

Deletes this organization.

Link copied to clipboard

Deletes a domain from this organization.

Link copied to clipboard

Deletes the organization's current logo image.

Link copied to clipboard

Retrieves a specific domain by its unique identifier.

Link copied to clipboard
suspend fun Organization.getDomains(limit: Int = 20, offset: Int = 0, enrollmentMode: String? = null): ClerkResult<ClerkPaginatedResponse<OrganizationDomain>, ClerkErrorResponse>

Retrieves all domains associated with this organization.

Link copied to clipboard

Retrieve all invitations for an organization. The current user must have permissions to manage the members of the organization.

Link copied to clipboard

Retrieves all membership requests for this organization.

Link copied to clipboard

Retrieves the memberships for this organization.

Link copied to clipboard
suspend fun Organization.getRoles(offset: Int = 0, limit: Int = 20): ClerkResult<List<Role>, ClerkErrorResponse>

Retrieves the list of roles available within this organization.

Link copied to clipboard

Removes a member from the organization.

Link copied to clipboard
suspend fun Organization.update(name: String? = null, slug: String? = null): ClerkResult<Organization, ClerkErrorResponse>

Updates the organization's name and/or slug.

Link copied to clipboard

Updates the organization's logo image.