createOrganizationInvitationBulk()
Creates multiple OrganizationInvitations in bulk for new users to join an organization.
function createOrganizationInvitationBulk(
  organizationId: string,
  params: CreateBulkOrganizationInvitationParams,
): Promise<OrganizationInvitation>Parameters
createOrganizationInvitationBulk() accepts the following parameters:
- Name
- organizationId
- Type
- string
- Description
- The organization ID of the organization you want to invite users to. 
 
- Name
- params
- Type
- CreateBulkOrganizationInvitationParams[]
- Description
- An array of objects, each representing a single invitation. 
 
- Name
- inviterUserId
- Type
- string | null
- Description
- The user ID of the user creating the invitation. 
 
- Name
- emailAddress
- Type
- string
- Description
- The email address to send the invitation to. 
 
- Name
- role
- Type
- Description
- The role to assign the invited user within the organization. 
 
- Name
- redirectUrl?
- Type
- string
- Description
- The full URL or path where users will land once the organization invitation has been accepted. 
 
- Name
- publicMetadata?
- Type
- Description
- Metadata that can be read from both the Frontend API and Backend API, but can be set only from the Backend API. 
 
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