API
Invitation API endpoints and routes.
Create Invite
POST/invite/create
All parameters default to the plugin's options defaults, except for role and email.
const { data, error } = await authClient.invite.create({ role, // Required email, // If email is present, the invite is private tokenType, redirectToSignUp, redirectToSignIn, maxUses, expiresIn, redirectToAfterUpgrade, shareInviterName, senderResponse, senderResponseRedirect, customInviteUrl, inviteUrlType,});Prop
Type
Activate Invite
POST/invite/activate
If the user is not logged in, it redirects the user to the callback URL with the token in a cookie.
const { data, error } = await authClient.invite.activate({ callbackURL, token, // Required});Prop
Type
Activate Invite Callback
Note
This endpoint is not recommended for direct usage. It exists mainly for internal use (e.g. the default link sent in invite emails).
The email link opens in the browser and triggers a GET request to /api/auth/invite/{token}?callbackURL=....
For most apps, you should use Activate Invite instead.
GET/invite/:token
If the user is not logged in, it redirects the user to the callback URL with the token in a cookie.
const { data, error } = await authClient.invite[":token"]({ query: { callbackURL, }, fetchOptions: { params: { token } }});Prop
Type
Reject Invite
POST/invite/reject
Only available for private invites.
const { data, error } = await authClient.invite.reject({ token, // Required});Prop
Type
Cancel Invite
POST/invite/cancel
Only the user that created the invite can cancel it.
const { data, error } = await authClient.invite.cancel({ token, // Required});Prop
Type
Get Invite
Get basic information about an invitation.
How is this guide?
Last updated on