# createOrganizationInvitation()

Creates an [`OrganizationInvitation`](https://clerk.com/docs/reference/backend/types/backend-organization-invitation.md) for new users to join an Organization.

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

```ts
function createOrganizationInvitation(
  params: CreateOrganizationInvitationParams,
): Promise<OrganizationInvitation>
```

## `CreateOrganizationInvitationParams`

| Name             | Type                                  | Description                                                                                                     |
| ---------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| organizationId   | string                                | The Organization ID of the Organization a user is being invited to.                                             |
| inviterUserId    | string | null                        | The user ID of the user creating the invitation.                                                                |
| emailAddress     | string                                | The email address to send the invitation to.                                                                    |
| role             | string                                | The Role to assign the invited user within the Organization.                                                    |
| redirectUrl?     | string                                | The full URL or path where users will land once the Organization invitation has been accepted.                  |
| publicMetadata?  | OrganizationInvitationPublicMetadata  | Metadata that can be read from both the Frontend API and Backend API, but can be set only from the Backend API. |
| privateMetadata? | OrganizationInvitationPrivateMetadata | Metadata that can be read and set only from the Backend API.                                                    |
| expiresInDays?   | number                                | The number of days the invitation will be valid for. By default, the invitation expires after 30 days.          |

## 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
const organizationId = 'org_123'

const inviterUserId = 'user_123'

const emailAddress = 'testclerk123@clerk.dev'

const role = 'org:member'

const response = await clerkClient.organizations.createOrganizationInvitation({
  organizationId,
  inviterUserId,
  emailAddress,
  role,
})
```

## Backend API (BAPI) endpoint

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

---

## Sitemap

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