Skip to main content

createOrganizationDomain()

Creates a new Verified Domain for the given Organization. By default, the domain is verified, but can be optionally set to unverified.

Returns the newly created OrganizationDomain object.

function createOrganizationDomain(params: CreateOrganizationDomainParams): Promise<OrganizationDomain>
  • Name
    enrollmentMode
    Type
    "manual_invitation" | "automatic_invitation" | "automatic_suggestion" | "enterprise_sso"
    Description

    The enrollment mode that determines how matching users are added to the Organization.

    • manual_invitation: No automatic enrollment. Users with a matching email domain are not given any invitation or suggestion; an admin must invite them manually.
    • automatic_invitation: Users with a matching email domain automatically receive a pending invitation (assigned the Organization's default role) which they can accept to join.
    • automatic_suggestion: Users with a matching email domain automatically receive a suggestion to join, which they can request.
  • Name
    name
    Type
    string
    Description

    The name of the domain.

  • Name
    organizationId
    Type
    string
    Description

    The ID of the Organization to create the domain for.

  • Name
    verified?
    Type
    boolean
    Description

    Whether the domain is verified. Defaults to true.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

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 for more information.

Feedback

What did you think of this content?

Last updated on