Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerk.com

Organization

This is a class that represents an organization. It's returned from the createOrganization and getOrganization methods on the Clerk class instance.

Properties

NameTypeDescription
idstringThe unique identifier of the related organization.
namestringThe name of the related organization.
slugstring | nullThe organization slug. If supplied, it must be unique for the instance.
logoUrl (deprecated)string | nullDeprecated in favor of imageUrl.
imageUrlstringHolds the organization logo or default logo. Compatible with Clerk's Image Optimization.
hasImagebooleanA getter boolean to check if the organization has an uploaded image. Returns false if Clerk is displaying an avatar for the organization.
membersCountnumberThe number of members the associated organization contains.
pendingInvitationsCountnumberThe number of pending invitations to users to join the organization.
adminDeleteEnabledbooleanA getter boolean to check if the admin of the organization can delete it.
maxAllowedMembershipsnumberThe maximum number of memberships allowed for the organization.
createdAtDateDate of the time the organization was created.
updatedAtDateDate of the last time the user was updated.
publicMetadataobjectAdditional information about the organization that can be read through the Frontend API, but written only from the Backend API.

Methods

update()

Updates an organization's attributes.

function update(params: UpdateOrganizationParams): Promise<Organization>;

UpdateOrganizationParams

NameTypeDescription
namestringThe organization name.
slug?string | undefinedThe organization slug.

Returns

TypeDescription
Promise<Organization>This method returns a Promise which resolves to an Organization.

destroy()

Deletes the organization. Only administrators can delete an organization.

Please note that deleting an organization will also delete all memberships and invitations. This is not reversible.

function destroy(): Promise<void>;

Returns

TypeDescription
Promise<void>This method returns a Promise which doesn't resolve to any value.

Sets or replaces an organization's logo. Accept the logo as a file or blob. The logo must be an image and its size cannot exceed 10MB.

function setLogo(params: SetOrganizationLogoParams): Promise<Organization>;

SetOrganizationLogoParams

NameTypeDescription
fileFile | Blob | nullAn image file which cannot exceed 10MB. Passing null will delete the organization's current logo.

Returns

TypeDescription
Promise<Organization>This method returns a Promise which resolves to an Organization.

getRoles()

Returns a paginated list of roles in the organization.

function getRoles: (params?: GetRolesParams) => Promise<ClerkPaginatedResponse<RoleResource>>;

GetRolesParams

NameTypeDescription
initialPage?numberA number that can be used to skip the first n-1 pages. For example, if initialPage is set to 10, it is will skip the first 9 pages and will fetch the 10th page.
pageSize?numberA number that indicates the maximum number of results that should be returned for a specific page.

getRoles() returns

TypeDescription
Promise<ClerkPaginatedResponse>This method returns a Promise which resolves to a ClerkPaginatedResponse.

Additional methods

In addition to the methods listed above, the Organization class also has the following methods:

Members

Invitations

Domains

Last updated on March 1, 2024

What did you think of this content?

Clerk © 2024