> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateConnectedDomain # Package: connectedDomains # Namespace: ConnectedDomainService # Method link: https://dev.wix.com/docs/api-reference/account-level/domains/connected-domains/connected-domain-v1/create-connected-domain.md ## Introduction Creates a `connectedDomain` object and starts the domain connection process. It may take up to 48 hours for the DNS changes to take effect. You must pass the relevant Wix account ID in the header of the call. You may also pass a Wix site ID in the header. You can only connect external domains using this endpoint. Domains purchased and billed through Wix can't be connected via this endpoint to a Wix site. You can connect both root domains and subdomains to Wix sites. The domain can be assigned as a primary domain or a redirect. You can read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). If you connect a domain as `"PRIMARY"` to a Wix site, the existing primary domain automatically becomes unassigned. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. --- ## REST API ### Schema ``` Method: createConnectedDomain Description: Creates a `connectedDomain` object and starts the domain connection process. It may take up to 48 hours for the DNS changes to take effect. You must pass the relevant Wix account GUID in the header of the call. You may also pass a Wix site GUID in the header. You can only connect external domains using this endpoint. Domains purchased and billed through Wix can't be connected via this endpoint to a Wix site. You can connect both root domains and subdomains to Wix sites. The domain can be assigned as a primary domain or a redirect. You can read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). If you connect a domain as `"PRIMARY"` to a Wix site, the existing primary domain automatically becomes unassigned. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. URL: https://www.wixapis.com/domains/v1/connected-domains Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: connectedDomain, connectedDomain.domain Method parameters: param name: connectedDomain | type: ConnectedDomain | description: A `connectedDomain` object holds information about an external domain and its connection to a Wix site. | required: true - name: domain | type: string | description: Domain name including TLD. Both root domains and subdomains are supported. | required: true - name: connectionType | type: ConnectionType | description: How the domain is connected to the Wix site. - enum: - POINTING: The domain is connected by pointing. Wix doesn't manage DNS information. - NAMESERVERS: The domain is connected by nameservers. Wix manages DNS information. - HIDDEN: The domain isn't visible to site visitors. - name: siteInfo | type: SiteInfo | description: Information about the site to which the domain is assigned, and whether it's the primary domain or a redirect. - name: assignmentType | type: AssignmentType | description: The relationship assigned for this domain to the site. Read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). - enum: - PRIMARY: The singular primary domain for a site. When this type is assigned, this domain will lead directly to the site. - REDIRECT: A redirect domain for a site. Each site can have multiple redirect domains. When this type is assigned, this domain will redirect to the primary domain. - name: suppressNotifications | type: boolean | description: Whether the site owner receives standard email notifications from Wix about the connected domain. Default: `false` Return type: CreateConnectedDomainResponse - name: connectedDomain | type: ConnectedDomain | description: Connected domain. - name: id | type: string | description: GUID of the connected domain. Identical to the domain name including TLD. - name: domain | type: string | description: Domain name including TLD. Both root domains and subdomains are supported. - name: connectionType | type: ConnectionType | description: How the domain is connected to the Wix site. - enum: - POINTING: The domain is connected by pointing. Wix doesn't manage DNS information. - NAMESERVERS: The domain is connected by nameservers. Wix manages DNS information. - HIDDEN: The domain isn't visible to site visitors. - name: siteInfo | type: SiteInfo | description: Information about the site to which the domain is assigned, and whether it's the primary domain or a redirect. - name: id | type: string | description: GUID of the site to which the domain is assigned. - name: assignmentType | type: AssignmentType | description: The relationship assigned for this domain to the site. Read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). - enum: - PRIMARY: The singular primary domain for a site. When this type is assigned, this domain will lead directly to the site. - REDIRECT: A redirect domain for a site. Each site can have multiple redirect domains. When this type is assigned, this domain will redirect to the primary domain. - name: suppressNotifications | type: boolean | description: Whether the site owner receives standard email notifications from Wix about the connected domain. Default: `false` - name: dnsPropagationStatus | type: DnsPropagationStatus | description: DNS propagation status. - enum: - COMPLETED: The domain's DNS propagation process has successfully finished. - FAILED: The domain's DNS propagation process has failed. - IN_PROGRESS: The domain's DNS propagation process has started but hasn't successfully completed yet. - name: createdDate | type: string | description: Date and time the `connectedDomain` object was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: updatedDate | type: string | description: Date and time the `connectedDomain` object was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format. ``` ### Examples ### Connect a subdomain ```curl curl -X POST 'https://www.wixapis.com/domains/v1/connected-domains' \ -H 'wix-account-id: ' \ -H 'wix-site-id: ' \ -H 'Authorization: ' \ -d '{ "connectedDomain": { "domain": "sub.mysite.com", "suppressNotifications": true } }' ``` ### Connect a domain using nameservers ```curl curl -X POST 'https://www.wixapis.com/domains/v1/connected-domains' \ -H 'wix-account-id: ' \ -H 'wix-site-id: ' \ -H 'Authorization: ' \ -d '{ "connectedDomain": { "domain": "mysite.com", "connectionType": "NAMESERVERS", "siteInfo": { "assignmentType": "PRIMARY" } } }' ``` ### Connect a domain by pointing ```curl curl -X POST 'https://www.wixapis.com/domains/v1/connected-domains' \ -H 'wix-account-id: ' \ -H 'wix-site-id: ' \ -H 'Authorization: ' \ -d '{ "connectedDomain": { "domain": "mysite.com", "connectionType": "POINTING", "siteInfo": { "assignmentType": "PRIMARY" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.connectedDomains.ConnectedDomainService.createConnectedDomain(connectedDomain) Description: Creates a `connectedDomain` object and starts the domain connection process. It may take up to 48 hours for the DNS changes to take effect. You must pass the relevant Wix account GUID in the header of the call. You may also pass a Wix site GUID in the header. You can only connect external domains using this endpoint. Domains purchased and billed through Wix can't be connected via this endpoint to a Wix site. You can connect both root domains and subdomains to Wix sites. The domain can be assigned as a primary domain or a redirect. You can read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). If you connect a domain as `"PRIMARY"` to a Wix site, the existing primary domain automatically becomes unassigned. > __Important:__ This call requires an account level API key and cannot be authenticated with the standard authorization header. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: connectedDomain, connectedDomain.domain Method parameters: param name: connectedDomain | type: ConnectedDomain | description: A `connectedDomain` object holds information about an external domain and its connection to a Wix site. | required: true - name: domain | type: string | description: Domain name including TLD. Both root domains and subdomains are supported. | required: true - name: connectionType | type: ConnectionType | description: How the domain is connected to the Wix site. - enum: - POINTING: The domain is connected by pointing. Wix doesn't manage DNS information. - NAMESERVERS: The domain is connected by nameservers. Wix manages DNS information. - HIDDEN: The domain isn't visible to site visitors. - name: siteInfo | type: SiteInfo | description: Information about the site to which the domain is assigned, and whether it's the primary domain or a redirect. - name: assignmentType | type: AssignmentType | description: The relationship assigned for this domain to the site. Read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). - enum: - PRIMARY: The singular primary domain for a site. When this type is assigned, this domain will lead directly to the site. - REDIRECT: A redirect domain for a site. Each site can have multiple redirect domains. When this type is assigned, this domain will redirect to the primary domain. - name: suppressNotifications | type: boolean | description: Whether the site owner receives standard email notifications from Wix about the connected domain. Default: `false` Return type: PROMISE - name: _id | type: string | description: GUID of the connected domain. Identical to the domain name including TLD. - name: domain | type: string | description: Domain name including TLD. Both root domains and subdomains are supported. - name: connectionType | type: ConnectionType | description: How the domain is connected to the Wix site. - enum: - POINTING: The domain is connected by pointing. Wix doesn't manage DNS information. - NAMESERVERS: The domain is connected by nameservers. Wix manages DNS information. - HIDDEN: The domain isn't visible to site visitors. - name: siteInfo | type: SiteInfo | description: Information about the site to which the domain is assigned, and whether it's the primary domain or a redirect. - name: _id | type: string | description: GUID of the site to which the domain is assigned. - name: assignmentType | type: AssignmentType | description: The relationship assigned for this domain to the site. Read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). - enum: - PRIMARY: The singular primary domain for a site. When this type is assigned, this domain will lead directly to the site. - REDIRECT: A redirect domain for a site. Each site can have multiple redirect domains. When this type is assigned, this domain will redirect to the primary domain. - name: suppressNotifications | type: boolean | description: Whether the site owner receives standard email notifications from Wix about the connected domain. Default: `false` - name: dnsPropagationStatus | type: DnsPropagationStatus | description: DNS propagation status. - enum: - COMPLETED: The domain's DNS propagation process has successfully finished. - FAILED: The domain's DNS propagation process has failed. - IN_PROGRESS: The domain's DNS propagation process has started but hasn't successfully completed yet. - name: _createdDate | type: Date | description: Date and time the `connectedDomain` object was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: _updatedDate | type: Date | description: Date and time the `connectedDomain` object was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format. ``` ### Examples ### Create a connected domain with an API key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { connectedDomains } from "@wix/domains"; const wixClient = createClient({ modules: { connectedDomains }, auth: ApiKeyStrategy({ siteId: "MY-SITE-ID", apiKey: "MY-API-KEY", }), }); async function createConnectedDomain(connectedDomain) { const response = await wixClient.connectedDomains.createConnectedDomain(connectedDomain); } ``` ### createConnectedDomain (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { connectedDomains } from '@wix/domains'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { connectedDomains }, // Include the auth strategy and host as relevant }); async function createConnectedDomain(connectedDomain) { const response = await myWixClient.connectedDomains.createConnectedDomain(connectedDomain); }; ``` ---