createOrganizationInvitationBulk()
Creates multiple invitations for users to join an Organization.
Returns a PaginatedResourceResponse object with a data property containing an array of OrganizationInvitation objects and a totalCount property containing the total number of Organization invitations.
function createOrganizationInvitationBulk(organizationId: string, params: Omit<CreateOrganizationInvitationParams, "organizationId">[]): Promise<PaginatedResourceResponse<OrganizationInvitation[]>>- Name
organizationId- Type
string- Description
The ID of the Organization to create the invitations for.
- Name
params- Type
Omit<CreateOrganizationInvitationParams, "organizationId">[]- Description
The parameters to create the invitations with.
- Name
params.emailAddress- Type
string- Description
The email address of the user being invited.
- Name
params.expiresInDays?- Type
number- Description
The number of days until the invitation expires. Defaults to
30.
- Name
params.inviterUserId?- Type
string- Description
The ID of the user creating the invitation.
- Name
params.privateMetadata?- Type
- OrganizationInvitationPrivateMetadata
- Description
Metadata that can be read and set only from the Backend API.
- Name
params.publicMetadata?- Type
- OrganizationInvitationPublicMetadata
- Description
Metadata that can be read from the Frontend API and Backend API, but can be set only from the Backend API.
- Name
params.redirectUrl?- Type
string- Description
The full URL or path where the user will land after accepting the invitation.
- Name
params.role- Type
- OrganizationCustomRoleKey
- Description
The Role to assign to the user.
const organizationId = 'org_123'
// Each object in the array represents a single invitation
const params = [
{
inviterUserId: 'user_1',
emailAddress: 'testclerk1@clerk.dev',
role: 'org:admin',
},
{
inviterUserId: 'user_2',
emailAddress: 'testclerk2@clerk.dev',
role: 'org:member',
},
]
const response = await clerkClient.organizations.createOrganizationInvitationBulk(
organizationId,
params,
)Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint POST/organizations/{organization_id}/invitations/bulk. See the BAPI reference for more information.
Feedback
Last updated on