# createInvitationBulk()

Creates multiple [`Invitation`](https://clerk.com/docs/reference/backend/types/backend-invitation.md)s in bulk for the given email addresses and sends the invitation emails.

If an email address has already been invited or already exists in your application, trying to create a new invitation will return an error. To bypass this error and create a new invitation anyways, set `ignoreExisting` to `true`.

> This endpoint is [rate limited](https://clerk.com/docs/guides/how-clerk-works/system-limits.md#backend-api-requests) to **25 requests per hour** per application instance.

```ts
function createInvitationBulk(params: CreateBulkParams): Promise<Invitation[]>
```

## Parameters

| Name   | Type                | Description                                                 |
| ------ | ------------------- | ----------------------------------------------------------- |
| params | CreateBulkParams[] | An array of objects, each representing a single invitation. |

## `CreateBulkParams`

| Name            | Type                                   | Description                                                                                                                                                                                                                  |
| --------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| emailAddress    | string                                 | The email address of the user to invite.                                                                                                                                                                                     |
| redirectUrl?    | string                                 | The full URL or path where the user is redirected upon visiting the invitation link, where they can accept the invitation. Required if you have implemented a custom flow for handling application invitations.              |
| publicMetadata? | UserPublicMetadata                     | Metadata that can be read from both the Frontend API and Backend API, but can be set only from the Backend API. Once the user accepts the invitation and signs up, these metadata will end up in the user's public metadata. |
| notify?         | boolean                                | Whether an email invitation should be sent to the given email address. Defaults to true.                                                                                                                                     |
| ignoreExisting? | boolean                                | Whether an invitation should be created if there is already an existing invitation for this email address, or if the email address already exists in the application. Defaults to false.                                     |
| expiresInDays?  | number                                 | The number of days the invitation will be valid for. By default, the invitation expires after 30 days.                                                                                                                       |
| templateSlug?   | 'invitation' | 'waitlist\_invitation' | The slug of the email template to use for the invitation email. Defaults to invitation.                                                                                                                                      |

## Example

> Using `clerkClient` varies based on the SDK you're using. Refer to the [overview](https://clerk.com/docs/reference/backend/overview.md) for usage details, including guidance on [how to access the `userId` and other properties](https://clerk.com/docs/reference/backend/overview.md#example-get-the-user-id-and-other-properties).

```tsx
// Each object in the array represents a single invitation
const params = [
  {
    emailAddress: 'invite@example.com',
    redirectUrl: 'https://www.example.com/my-sign-up',
    publicMetadata: {
      example: 'metadata',
      example_nested: {
        nested: 'metadata',
      },
    },
  },
  {
    emailAddress: 'invite2@example.com',
    redirectUrl: 'https://www.example.com/my-sign-up',
    publicMetadata: {
      example: 'metadata',
      example_nested: {
        nested: 'metadata',
      },
    },
  },
]

const response = await clerkClient.invitations.createInvitationBulk(params)
```

## Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint `POST/invitations/bulk`. See the [BAPI reference](https://clerk.com/docs/reference/backend-api/tag/invitations/POST/invitations/bulk){{ target: '_blank' }} for more information.

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
