Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

createInvitation()

Creates a new invitation for the given email address and sends the invitation email.

Keep in mind that you cannot create an invitation if there is already one for the given email address. Also, trying to create an invitation for an email address that already exists in your application will result in an error.

const invitation = await clerkClient.invitations.createInvitation({ emailAddress: 'invite@example.com', redirectUrl: 'https://optionally-redirect-here', publicMetadata: { "example": "metadata", "example_nested": { "nested": "metadata", }, } });

CreateParams

NameTypeDescription
emailAddressstringThe email address of the user to invite.
redirectUrl?stringThe URL to redirect the user to after they accept the invitation.
publicMetadata?Record<string, unknown>Metadata saved on the invitation that is visible to both your Frontend and Backend APIs.

What did you think of this content?

Clerk © 2023