# createOrganizationDomain()

Creates a new [Verified Domain](https://clerk.com/docs/guides/organizations/add-members/verified-domains.md) for the given Organization. By default, the domain is verified, but can be optionally set to unverified.

Returns the newly created [`OrganizationDomain`](https://clerk.com/docs/reference/backend/types/backend-organization-domain.md) object.

```typescript
function createOrganizationDomain(params: CreateOrganizationDomainParams): Promise<OrganizationDomain>
```

## `CreateOrganizationDomainParams`

| Property                                     | Type                                                                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="enrollmentmode"></a> `enrollmentMode` | `"manual_invitation" | "automatic_invitation" | "automatic_suggestion" | "enterprise_sso"` | The enrollment mode that determines how matching users are added to the Organization. <ul> <li>`manual_invitation`: No automatic enrollment. Users with a matching email domain are not given any <a href="https://clerk.com/docs/guides/organizations/add-members/verified-domains.md#automatic-invitations">invitation</a> or <a href="https://clerk.com/docs/guides/organizations/add-members/verified-domains.md#automatic-suggestions">suggestion</a>; an <a href="https://clerk.com/docs/guides/organizations/control-access/roles-and-permissions.md#default-roles">admin</a> must invite them manually.</li> <li>`automatic_invitation`: Users with a matching email domain automatically receive a pending <a href="https://clerk.com/docs/reference/types/organization-invitation.md">invitation</a> (assigned the Organization's default role) which they can accept to join.</li> <li>`automatic_suggestion`: Users with a matching email domain automatically receive a <a href="https://clerk.com/docs/guides/organizations/add-members/verified-domains.md#automatic-suggestions">suggestion</a> to join, which they can request.</li> </ul> |
| <a id="name"></a> `name`                     | `string`                                                                                              | The name of the domain.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <a id="organizationid"></a> `organizationId` | `string`                                                                                              | The ID of the Organization to create the domain for.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| <a id="verified"></a> `verified?`            | `boolean`                                                                                             | Whether the domain is verified. Defaults to `true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Usage

> Using `clerkClient` varies based on the SDK you're using. Refer to the [overview](https://clerk.com/docs/reference/backend/overview.md) for usage details, including guidance on [how to access the `userId` and other properties](https://clerk.com/docs/reference/backend/overview.md#example-get-the-user-id-and-other-properties).

```tsx
const organizationId = 'org_123'
const domainName = 'example.com'
const enrollmentMode = 'automatic_invitation'

const response = await clerkClient.organizations.createOrganizationDomain({
  organizationId,
  domainName,
  enrollmentMode,
})
```

## Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint `POST/organizations/{organization_id}/domains`. See the [BAPI reference](https://clerk.com/docs/reference/backend-api/tag/organization-domains/POST/organizations/%7Borganization_id%7D/domains){{ target: '_blank' }} for more information.

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
