Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Organization Members

These are all methods on the Organization class that allow you to manage the members of an organization.

getMemberships()

function getMemberships(params?: GetMembershipsParams): Promise<OrganizationMembership[]>;

Retrieve the members of the selected

GetMembershipsParams

NameTypeDescription
limitnumber | undefinedLimit of the results returned.
offsetnumber | undefinedThe offset of results to start the retrieval.

Returns

TypeDescription
Promise<OrganizationMembership[]>This method returns a Promise which resolves with a list of OrganizationMembership objects.

addMember()

function addMember(params: AddMemberParams): Promise<OrganizationMembership>;

Adds a user as a member to an organization. A user can only be added to an organization if they are not already members of it and if they already exist in the same instance as the organization.

Please note that only administrators can add members to an organization.

AddMemberParams

NameTypeDescription
userIdstringThe id of the user that will be added as a member to the organization.
role'admin' | 'basic_member' | 'guest_member'The role that the user will have in the organization.

Returns

TypeDescription
Promise<OrganizationMembership>This method returns a Promise which resolves with the OrganizationMembership objects.

updateMember()

function updateMember(params: UpdateMembershipParams): Promise<OrganizationMembership>;

Updates a member based on the userId. For now only role can be changed.

UpdateMembershipParams

NameTypeDescription
userIdstringThe user identifier.
role'admin' | 'basic_member' | 'guest_member'The role of the new member.

Returns

TypeDescription
Promise<OrganizationMembership>This method returns a Promise which resolves with the updated OrganizationMembership object.

removeMember()

function removeMember(userId: string): Promise<OrganizationMembership>;

Removes a member from the organization based on the userId.

Props

NameTypeDescription
userIdstringThe user identifier.

Returns

TypeDescription
Promise<OrganizationMembership>This method returns a Promise which resolves with the removed OrganizationMembership object.

Was this helpful?

Clerk © 2023