(Invitations)
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 to an error.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
using System.Collections.Generic;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
CreateInvitationRequestBody req = new CreateInvitationRequestBody() {
EmailAddress = "[email protected]",
PublicMetadata = new Dictionary<string, object>() {
},
RedirectUrl = "https://example.com/welcome",
};
var res = await sdk.Invitations.CreateAsync(req);
// handle response
CreateInvitationResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 422 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Returns all non-revoked invitations for your application, sorted by creation date
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
ListInvitationsRequest req = new ListInvitationsRequest() {
OrderBy = "pending",
};
var res = await sdk.Invitations.ListAsync(req);
// handle response
Parameter |
Type |
Required |
Description |
request |
ListInvitationsRequest |
✔️ |
The request object to use for the request. |
ListInvitationsResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Use this API operation to create multiple invitations for the provided email addresses. You can choose to send the
invitations as emails by setting the notify
parameter to true
. There cannot be an existing invitation for any
of the email addresses you provide unless you set ignore_existing
to true
for specific email addresses. Please
note that there must be no existing user for any of the email addresses you provide, and this rule cannot be bypassed.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
using System.Collections.Generic;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
List<RequestBody> req = new List<RequestBody>() {
new RequestBody() {
EmailAddress = "[email protected]",
},
};
var res = await sdk.Invitations.BulkCreateAsync(req);
// handle response
Parameter |
Type |
Required |
Description |
request |
List<RequestBody> |
✔️ |
The request object to use for the request. |
CreateBulkInvitationsResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 422 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |
Revokes the given invitation.
Revoking an invitation will prevent the user from using the invitation link that was sent to them.
However, it doesn't prevent the user from signing up if they follow the sign up flow.
Only active (i.e. non-revoked) invitations can be revoked.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.Invitations.RevokeAsync(invitationId: "inv_123");
// handle response
Parameter |
Type |
Required |
Description |
Example |
InvitationId |
string |
✔️ |
The ID of the invitation to be revoked |
inv_123 |
RevokeInvitationResponse
Error Type |
Status Code |
Content Type |
Clerk.BackendAPI.Models.Errors.ClerkErrors |
400, 404 |
application/json |
Clerk.BackendAPI.Models.Errors.SDKError |
4XX, 5XX |
*/* |