createOrganizationInvitation()
Creates an invitation for a user to join an Organization.
Returns the newly created OrganizationInvitation object.
function createOrganizationInvitation(params: CreateOrganizationInvitationParams): Promise<OrganizationInvitation>- Name
-
privateMetadata? - Type
- OrganizationInvitationPrivateMetadata
- Description
Metadata that can be read and set only from the Backend API.
- Name
-
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
-
role - Type
- OrganizationCustomRoleKey
- Description
The Role to assign to the user.
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 for more information.
Feedback
Last updated on