> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# AuthenticateSendingDomain

# Package: emails

# Namespace: SendingDomainService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/authenticate-sending-domain.md

## Permission Scopes:
Manage Sending Domains: SCOPE.SENDING-DOMAINS.MANAGE

## Introduction

Authenticates a sending domain by verifying the required DNS records.

Call this method only when the domain's `status` property is `NOT_AUTHENTICATED` and after DNS records have been added and propagated. If Wix manages DNS for the domain (domain purchased from Wix or connected via nameservers), you don't need to call this method.

If authentication succeeds, the domain's `status` property changes to `AUTHENTICATED` and the domain can be used for sending emails.

For detailed steps and prerequisites, see [Authenticate a custom domain for email sending](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/sample-flows.md#authenticate-a-custom-domain-for-email-sending).

---

## REST API

### Schema

```
 Method: authenticateSendingDomain
 Description: Authenticates a sending domain by verifying the required DNS records.  Call this method only when the domain's `status` property is `NOT_AUTHENTICATED` and after DNS records have been added and propagated. If Wix manages DNS for the domain (domain purchased from Wix or connected via nameservers), you don't need to call this method.  If authentication succeeds, the domain's `status` property changes to `AUTHENTICATED` and the domain can be used for sending emails.  For detailed steps and prerequisites, see [Authenticate a custom domain for email sending](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/sample-flows.md#authenticate-a-custom-domain-for-email-sending).
 URL: https://www.wixapis.com/sending-domains/v1/sending-domains/{sendingDomainId}/authenticate
 Method: POST
 Return type: AuthenticateSendingDomainResponse
  - name: sendingDomain | type: SendingDomain | description: Authenticated sending domain.  
     - name: id | type: string | description: Sending domain GUID.  | read-only: true | validation: format GUID
     - name: createdDate | type: string | description: Date and time the sending domain was created.  | read-only: true | validation: format date-time
     - name: domain | type: string | description: Domain name to authenticate for sending emails. For example, `example.com`.  | validation: minLength 4, maxLength 64, format HOSTNAME, immutable
     - name: status | type: Status | description: Authentication status. Indicates whether the domain is ready for sending emails.  | read-only: true 
         - enum:
         -     INITIALIZING: Domain is being set up. DNS records are being generated. Wait for this to change to NOT_AUTHENTICATED before proceeding.
         -     NOT_AUTHENTICATED: Domain is ready to be authenticated. DNS records are available in dnsRecords. Add these records at the DNS provider, then call [Authenticate Sending Domain](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/authenticate-sending-domain.md) to verify them.
         -     AUTHENTICATED: Domain is authenticated and ready for sending emails. This domain can now be used in the **From** field for email campaigns and transactional emails.
     - name: dnsRecords | type: array<DnsRecord> | description: DNS records required to authenticate the domain. These records must be added to the domain's DNS configuration at the DNS provider (such as GoDaddy, Cloudflare, or Namecheap) to verify domain ownership and enable email sending.  To authenticate the domain, add these records at the DNS provider and use DNS lookup tools (such as `dig` or online DNS checkers) to verify the records are visible globally. Then call [Authenticate Sending Domain](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/authenticate-sending-domain.md).  | read-only: true | validation: maxItems 5
        - name: hostName | type: string | description: Hostname for the DNS record. Add this as the subdomain or record name at the DNS provider.  | validation: format HOSTNAME
        - name: value | type: string | description: Value for the DNS record. Add this as the target value at the DNS provider.  | validation: format HOSTNAME
        - name: type | type: Type | description: DNS record type.  
             - enum:
             -     CNAME: CNAME record for domain authentication.

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SENDER_DETAILS_DO_NOT_EXIST | Description: Sender details must be configured before using the Sending Domains API. See the [Sender Details API](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sender-details/introduction.md).
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_READY_FOR_AUTHENTICATION | Description: Domain isn't ready for authentication yet. DNS records are still being generated.


```

### Examples

### Authenticate a sending domain
Verifies DNS records and authenticates a sending domain

```curl
curl -X POST \
'https://www.wixapis.com/sending-domains/v1/sending-domains/12345678-1234-1234-1234-123456789012/authenticate' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.sendingDomains.sendingDomains.authenticateSendingDomain(sendingDomainId)
 Description: Authenticates a sending domain by verifying the required DNS records.  Call this method only when the domain's `status` property is `NOT_AUTHENTICATED` and after DNS records have been added and propagated. If Wix manages DNS for the domain (domain purchased from Wix or connected via nameservers), you don't need to call this method.  If authentication succeeds, the domain's `status` property changes to `AUTHENTICATED` and the domain can be used for sending emails.  For detailed steps and prerequisites, see [Authenticate a custom domain for email sending](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/sample-flows.md#authenticate-a-custom-domain-for-email-sending).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  sendingDomainId
 Method parameters: 
   param name: sendingDomainId | type: string | description: Sending domain GUID. | required: true | validation: format GUID
 Return type: PROMISE<AuthenticateSendingDomainResponse>
  - name: sendingDomain | type: SendingDomain | description: Authenticated sending domain.  
     - name: _id | type: string | description: Sending domain GUID.  | read-only: true | validation: format GUID
     - name: _createdDate | type: Date | description: Date and time the sending domain was created.  | read-only: true 
     - name: domain | type: string | description: Domain name to authenticate for sending emails. For example, `example.com`.  | validation: minLength 4, maxLength 64, format HOSTNAME, immutable
     - name: status | type: Status | description: Authentication status. Indicates whether the domain is ready for sending emails.  | read-only: true 
         - enum:
         -     INITIALIZING: Domain is being set up. DNS records are being generated. Wait for this to change to NOT_AUTHENTICATED before proceeding.
         -     NOT_AUTHENTICATED: Domain is ready to be authenticated. DNS records are available in dnsRecords. Add these records at the DNS provider, then call [Authenticate Sending Domain](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/authenticate-sending-domain.md) to verify them.
         -     AUTHENTICATED: Domain is authenticated and ready for sending emails. This domain can now be used in the **From** field for email campaigns and transactional emails.
     - name: dnsRecords | type: array<DnsRecord> | description: DNS records required to authenticate the domain. These records must be added to the domain's DNS configuration at the DNS provider (such as GoDaddy, Cloudflare, or Namecheap) to verify domain ownership and enable email sending.  To authenticate the domain, add these records at the DNS provider and use DNS lookup tools (such as `dig` or online DNS checkers) to verify the records are visible globally. Then call [Authenticate Sending Domain](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sending-domains/authenticate-sending-domain.md).  | read-only: true | validation: maxItems 5
        - name: hostName | type: string | description: Hostname for the DNS record. Add this as the subdomain or record name at the DNS provider.  | validation: format HOSTNAME
        - name: value | type: string | description: Value for the DNS record. Add this as the target value at the DNS provider.  | validation: format HOSTNAME
        - name: type | type: Type | description: DNS record type.  
             - enum:
             -     CNAME: CNAME record for domain authentication.

 Possible Errors:
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SENDER_DETAILS_DO_NOT_EXIST | Description: Sender details must be configured before using the Sending Domains API. See the [Sender Details API](https://dev.wix.com/docs/api-reference/business-management/marketing/emails/sender-details/introduction.md).
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_READY_FOR_AUTHENTICATION | Description: Domain isn't ready for authentication yet. DNS records are still being generated.


```

### Examples

### authenticateSendingDomain
```javascript
import { sendingDomains } from '@wix/sending-domains';

async function authenticateSendingDomain(sendingDomainId) {
  const response = await sendingDomains.authenticateSendingDomain(sendingDomainId);
};
```

### authenticateSendingDomain (with elevated permissions)
```javascript
import { sendingDomains } from '@wix/sending-domains';
import { auth } from '@wix/essentials';

async function myAuthenticateSendingDomainMethod(sendingDomainId) {
  const elevatedAuthenticateSendingDomain = auth.elevate(sendingDomains.authenticateSendingDomain);
  const response = await elevatedAuthenticateSendingDomain(sendingDomainId);
}
```

### authenticateSendingDomain (self-managed)
Self-managed 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 { sendingDomains } from '@wix/sending-domains';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { sendingDomains },
  // Include the auth strategy and host as relevant
});


async function authenticateSendingDomain(sendingDomainId) {
  const response = await myWixClient.sendingDomains.authenticateSendingDomain(sendingDomainId);
};
```

---