Modify the settings of your instance.
- Get - Fetch the current instance
- Update - Update instance settings
- UpdateRestrictions - Update instance restrictions
- ChangeDomain - Update production instance domain
- UpdateOrganizationSettings - Update instance organization settings
- GetInstanceProtect - Get instance protect settings
- UpdateInstanceProtect - Update instance protect settings
Fetches the current instance
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.InstanceSettings.GetAsync();
// handle response| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Updates the settings of an instance
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>");
UpdateInstanceRequestBody req = new UpdateInstanceRequestBody() {
TestMode = true,
Hibp = false,
SupportEmail = "support@example.com",
ClerkJsVersion = "2.3.1",
DevelopmentOrigin = "http://localhost:3000",
AllowedOrigins = new List<string>() {
"http://localhost:3000",
"chrome-extension://extension_uiid",
"capacitor://localhost",
},
UrlBasedSessionSyncing = true,
};
var res = await sdk.InstanceSettings.UpdateAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
UpdateInstanceRequestBody | ✔️ | The request object to use for the request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Updates the restriction settings of an instance
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
UpdateInstanceRestrictionsRequestBody req = new UpdateInstanceRestrictionsRequestBody() {
Allowlist = false,
Blocklist = true,
BlockEmailSubaddresses = true,
BlockDisposableEmailDomains = true,
};
var res = await sdk.InstanceSettings.UpdateRestrictionsAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
UpdateInstanceRestrictionsRequestBody | ✔️ | The request object to use for the request. |
UpdateInstanceRestrictionsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 402, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Change the domain of a production instance.
Changing the domain requires updating the DNS records accordingly, deploying new SSL certificates, updating your Social Connection's redirect URLs and setting the new keys in your code.
WARNING: Changing your domain will invalidate all current user sessions (i.e. users will be logged out). Also, while your application is being deployed, a small downtime is expected to occur.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
ChangeProductionInstanceDomainRequestBody req = new ChangeProductionInstanceDomainRequestBody() {
HomeUrl = "https://www.newdomain.com",
};
var res = await sdk.InstanceSettings.ChangeDomainAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
ChangeProductionInstanceDomainRequestBody | ✔️ | The request object to use for the request. |
ChangeProductionInstanceDomainResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Updates the organization settings of the instance
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>");
UpdateInstanceOrganizationSettingsRequestBody req = new UpdateInstanceOrganizationSettingsRequestBody() {
Enabled = true,
MaxAllowedMemberships = 10,
AdminDeleteEnabled = false,
DomainsEnabled = true,
DomainsEnrollmentModes = new List<string>() {
"automatic_invitation",
"automatic_suggestion",
},
CreatorRoleId = "creator_role",
DomainsDefaultRoleId = "member_role",
};
var res = await sdk.InstanceSettings.UpdateOrganizationSettingsAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
UpdateInstanceOrganizationSettingsRequestBody | ✔️ | The request object to use for the request. |
UpdateInstanceOrganizationSettingsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 402, 404, 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Get instance protect settings
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.InstanceSettings.GetInstanceProtectAsync();
// handle response| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
Update instance protect settings
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
UpdateInstanceProtectRequestBody? req = null;
var res = await sdk.InstanceSettings.UpdateInstanceProtectAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
UpdateInstanceProtectRequestBody | ✔️ | The request object to use for the request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| Clerk.BackendAPI.Models.Errors.ClerkErrors | 422 | application/json |
| Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |