āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/clerk/clerk-docs/reference/backend/organization/create-organization-invitation-bulk ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
createOrganizationInvitationBulk()'
description: Use Clerk's JS Backend SDK to create multiple invitations for new users to join an organization.
sdk: js-backend{/* clerk/javascript file: https://github.com/clerk/javascript/blob/main/packages/backend/src/api/endpoints/OrganizationApi.ts#L292-L303 */}
Creates multiple OrganizationInvitations in bulk for new users to join an organization.
function createOrganizationInvitationBulk(
organizationId: string,
params: CreateBulkOrganizationInvitationParams,
): Promise<OrganizationInvitation>
createOrganizationInvitationBulk() accepts the following parameters:
The organization ID of the organization you want to invite users to.
An array of objects, each representing a single invitation. </Properties>
CreateBulkOrganizationInvitationParamsThe user ID of the user creating the invitation.
emailAddressstringThe email address to send the invitation to.
The role to assign the invited user within the organization.
redirectUrl?stringThe full URL or path where users will land once the organization invitation has been accepted.
publicMetadata?OrganizationInvitationPublicMetadataMetadata that can be read from both the Frontend API and Backend API{{ target: '_blank' }}, but can be set only from the Backend API. </Properties>
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,
)
This method in the SDK is a wrapper around the BAPI endpoint POST/organizations/{organization_id}/invitations/bulk. See the BAPI reference{{ target: '_blank' }} for more information.
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā