(organizationDomains())
- create - Create a new organization domain.
- list - Get a list of all domains of an organization.
- delete - Remove a domain from an organization.
Creates a new organization domain. By default the domain is verified, but can be optionally set to unverified.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.CreateOrganizationDomainRequestBody;
import com.clerk.backend_api.models.operations.CreateOrganizationDomainResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
CreateOrganizationDomainResponse res = sdk.organizationDomains().create()
.organizationId("<id>")
.requestBody(CreateOrganizationDomainRequestBody.builder()
.build())
.call();
if (res.organizationDomain().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
organizationId |
String | ✔️ | The ID of the organization where the new domain will be created. |
requestBody |
CreateOrganizationDomainRequestBody | ✔️ | N/A |
CreateOrganizationDomainResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 403, 404, 422 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |
Get a list of all domains of an organization.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ListOrganizationDomainsRequest;
import com.clerk.backend_api.models.operations.ListOrganizationDomainsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
ListOrganizationDomainsRequest req = ListOrganizationDomainsRequest.builder()
.organizationId("<id>")
.build();
ListOrganizationDomainsResponse res = sdk.organizationDomains().list()
.request(req)
.call();
if (res.organizationDomains().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
request |
ListOrganizationDomainsRequest | ✔️ | The request object to use for the request. |
ListOrganizationDomainsResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 401, 422 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |
Removes the given domain from the organization.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.DeleteOrganizationDomainResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
DeleteOrganizationDomainResponse res = sdk.organizationDomains().delete()
.organizationId("<id>")
.domainId("<id>")
.call();
if (res.deletedObject().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
organizationId |
String | ✔️ | The ID of the organization the domain belongs to |
domainId |
String | ✔️ | The ID of the domain |
DeleteOrganizationDomainResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 401, 404 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |