Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Organization Invitations

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

getInvitations()

Retrieves a list of invitations for the currently active organization.

function getInvitations(params?: GetInvitationsParams): Promise<PaginatedResources<OrganizationInvitation>>;

GetInvitationsParams

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.
status?'pending' | 'accepted' | 'revoked'The status an invitation can have.

Returns

TypeDescription
Promise<PaginatedResponse<OrganizationInvitation>>This method returns a Promise which resolves with a list of OrganizationInvitation objects.

getPendingInvitations() (deprecated)

This method is deprecated in favor of getInvitations().

Retrieves a list of organization invitations that have not yet been accepted.

function getPendingInvitations(params?: GetPendingInvitationsParams): Promise<OrganizationInvitation[]>;

GetPendingInvitationsParams

NameTypeDescription
limitnumberLimit of the results returned.
offsetnumberThe offset of results to start the retrieval.

Returns

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

inviteMember()

Creates and sends an invitation to the target email address for becoming a member with the role passed on the function parameters.

function inviteMember(params: InviteMemberParams): Promise<OrganizationInvitation>;

InviteMemberParams

NameTypeDescription
emailAddressstringThe email address to invite.
rolestringThe role of the new member.

Returns

TypeDescription
Promise<OrganizationInvitation>This method returns a Promise which resolves to the OrganizationInvitation for the created invitation.

inviteMembers()

Creates and sends an invitation to the target email addresses for becoming a member with the role passed on the function parameters.

function inviteMembers(params: InviteMembersParams): Promise<OrganizationInvitation[]>;

InviteMembersParams

NameTypeDescription
emailAddressesstring[]The email addresses to invite.
rolestringThe role of the new members.

Returns

TypeDescription
Promise<OrganizationInvitation[]>This method returns a Promise which resolves to a list of OrganizationInvitations for the created invitations.

What did you think of this content?

Clerk © 2023