- create - Create a new organization domain.
- list - Get a list of all domains of an organization.
- update - Update an organization domain.
- delete - Remove a domain from an organization.
- list_all - List all organization domains
Creates a new organization domain. By default the domain is verified, but can be optionally set to unverified.
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.organization_domains.create(organization_id="<id>", name="<value>", enrollment_mode="<value>", verified=False)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id |
str | ✔️ | The ID of the organization where the new domain will be created. |
name |
Optional[str] | ➖ | The name of the new domain |
enrollment_mode |
Optional[str] | ➖ | The enrollment_mode for the new domain. This can be automatic_invitation, automatic_suggestion or manual_invitation |
verified |
OptionalNullable[bool] | ➖ | The status of domain's verification. Defaults to true |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ClerkErrors | 400, 403, 404, 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Get a list of all domains of an organization.
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.organization_domains.list(organization_id="<id>", verified="<value>", enrollment_mode="<value>", limit=20, offset=10)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
organization_id |
str | ✔️ | The organization ID. | |
verified |
Optional[str] | ➖ | Filter domains by their verification status. true or false |
|
enrollment_mode |
Optional[str] | ➖ | Filter domains by their enrollment mode | |
limit |
Optional[int] | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
20 |
offset |
Optional[int] | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
10 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ClerkErrors | 401, 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Updates the properties of an existing organization domain.
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.organization_domains.update(organization_id="<id>", domain_id="<id>", enrollment_mode="<value>", verified=True)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id |
str | ✔️ | The ID of the organization to which the domain belongs |
domain_id |
str | ✔️ | The ID of the domain |
enrollment_mode |
OptionalNullable[str] | ➖ | The enrollment_mode for the new domain. This can be automatic_invitation, automatic_suggestion or manual_invitation |
verified |
OptionalNullable[bool] | ➖ | The status of the domain's verification |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ClerkErrors | 400, 404, 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Removes the given domain from the organization.
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.organization_domains.delete(organization_id="<id>", domain_id="<id>")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
organization_id |
str | ✔️ | The ID of the organization to which the domain belongs |
domain_id |
str | ✔️ | The ID of the domain |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ClerkErrors | 400, 401, 404 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Retrieves a list of all organization domains within the current instance. This endpoint can be used to list all domains across all organizations or filter domains by organization, verification status, enrollment mode, or search query.
The response includes pagination information and details about each domain including its verification status, enrollment mode, and associated counts.
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.organization_domains.list_all(organization_id="<id>", verified=clerk_backend_api.Verified.TRUE, enrollment_mode=[
clerk_backend_api.QueryParamEnrollmentMode.AUTOMATIC_SUGGESTION,
], query="<value>", domains=[
"<value 1>",
], order_by="-created_at", offset=10, limit=20)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
organization_id |
Optional[str] | ➖ | The ID of the organization to filter domains by | |
verified |
Optional[models.Verified] | ➖ | Filter by verification status | |
enrollment_mode |
List[models.QueryParamEnrollmentMode] | ➖ | Filter by enrollment mode | |
query |
Optional[str] | ➖ | Search domains by name or organization ID. If the query starts with "org_", it will search by exact organization ID match. Otherwise, it performs a case-insensitive partial match on the domain name. Note: An empty string or whitespace-only value is not allowed and will result in a validation error. |
|
domains |
List[str] | ➖ | Filter by exact domain names. Accepts multiple values (e.g. domains=example.com&domains=test.org). | |
order_by |
Optional[str] | ➖ | Allows to return organization domains in a particular order. At the moment, you can order the returned domains by their name or created_at.In order to specify the direction, you can use the +/- symbols prepended to the property to order by.For example, if you want domains to be returned in descending order according to their created_at property, you can use -created_at.If you don't use + or -, then + is implied.Defaults to -created_at. |
|
offset |
Optional[int] | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
10 |
limit |
Optional[int] | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
20 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models.ClerkErrors | 401, 403, 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |