> 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

# ValidateAuthorizationCode

# Package: domains

# Namespace: DomainTransferInValidationsService

# Method link: https://dev.wix.com/docs/api-reference/account-level/domains/domain-transfer-in/validate-authorization-code.md

## Introduction

Validates an authorization code for transferring a domain to Wix.

Checks with the domain's current registrar whether the authorization code is valid for the specified domain. Call this method before starting a transfer to catch invalid or expired codes early.

Validation problems are returned in `validationResult.violations`, not as errors. If the code isn't valid, the list includes `DOMAIN_TRANSFER_IN_AUTHORIZATION_CODE_NOT_VALID`.

To check whether the domain itself can be transferred, call [Validate Domain Transferability](https://dev.wix.com/docs/api-reference/account-level/domains/domain-transfer-in/validate-domain-transferability.md).

---

## REST API

### Schema

```
 Method: validateAuthorizationCode
 Description: Validates an authorization code for transferring a domain to Wix.  Checks with the domain's current registrar whether the authorization code is valid for the specified domain. Call this method before starting a transfer to catch invalid or expired codes early.  Validation problems are returned in `validationResult.violations`, not as errors. If the code isn't valid, the list includes `DOMAIN_TRANSFER_IN_AUTHORIZATION_CODE_NOT_VALID`.  To check whether the domain itself can be transferred, call [Validate Domain Transferability](https://dev.wix.com/docs/api-reference/account-level/domains/domain-transfer-in/validate-domain-transferability.md).
 URL: https://www.wixapis.com/premium/domains/v1/transfer-in-domains/{domain}/validate-authorization-code
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  authorizationCode
 Method parameters: 
   param name: authorizationCode | type: authorizationCode | description: Authorization code from the domain's current registrar. Also known as an EPP code or transfer code. | required: true | validation: maxLength 225
 Return type: ValidateAuthorizationCodeResponse
  - name: validationResult | type: DomainTransferInValidationResult | description: Validation result, including any violations found.  
     - name: id | type: string | description: Validated domain name, including the TLD. For example, `example.com`.  | read-only: true | validation: format HOSTNAME
     - name: violations | type: array<Violation> | description: Issues that prevent the transfer. Empty if the domain passed every check.  | validation: maxItems 100
         - enum:
         -     UNKNOWN_VIOLATION: Unknown violation.
         -     DOMAIN_NOT_FOUND: Domain isn't registered, or the current registrar can't confirm that it can be transferred.
         -     DOMAIN_TRANSFER_IN_AUTHORIZATION_CODE_NOT_VALID: Authorization code isn't valid for this domain. The Wix user must request a new code from the current registrar.
         -     DOMAIN_TRANSFER_IN_TLD_NOT_SUPPORTED: Domain's TLD doesn't support transfers to Wix.
         -     DOMAIN_TRANSFER_IN_REQUEST_ALREADY_EXIST: A transfer to Wix is already in progress for this domain.
         -     DOMAIN_ALREADY_TAKEN: Domain is already registered with Wix.
         -     TRANSFER_IN_PREMIUM_DOMAIN_NOT_SUPPORTED: Domain is a premium domain. Premium domains can't be transferred to Wix.
         -     DOMAIN_TRANSFER_IN_CLIENT_TRANSFER_PROHIBITED: Domain is locked with a `clientTransferProhibited` status. The Wix user must unlock it at the current registrar.
         -     DOMAIN_TRANSFER_IN_CREATION_DATE_LESS_THAN_60_DAYS: Domain was registered or last transferred less than 60 days ago.


```

### Examples

### Validate an authorization code
Validates an authorization code from the current registrar before transferring the domain to Wix.

```curl
curl -X POST \
'https://www.wixapis.com/premium/domains/v1/transfer-in-domains/example.com/validate-authorization-code' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "authorizationCode": "Xq7#vB2m!Lp9"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.domains.transferInValidations.validateAuthorizationCode(domain, authorizationCode)
 Description: Validates an authorization code for transferring a domain to Wix.  Checks with the domain's current registrar whether the authorization code is valid for the specified domain. Call this method before starting a transfer to catch invalid or expired codes early.  Validation problems are returned in `validationResult.violations`, not as errors. If the code isn't valid, the list includes `DOMAIN_TRANSFER_IN_AUTHORIZATION_CODE_NOT_VALID`.  To check whether the domain itself can be transferred, call [Validate Domain Transferability](https://dev.wix.com/docs/api-reference/account-level/domains/domain-transfer-in/validate-domain-transferability.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  domain, authorizationCode
 Method parameters: 
   param name: authorizationCode | type: string | description: Authorization code from the domain's current registrar. Also known as an EPP code or transfer code. | required: true | validation: maxLength 225
   param name: domain | type: string | description: Domain name to validate, including the TLD. For example, `example.com`.  A leading `www.` is removed and the name is converted to lowercase before validation. Subdomains aren't supported. | required: true | validation: format HOSTNAME
 Return type: PROMISE<ValidateAuthorizationCodeResponse>
  - name: validationResult | type: DomainTransferInValidationResult | description: Validation result, including any violations found.  
     - name: _id | type: string | description: Validated domain name, including the TLD. For example, `example.com`.  | read-only: true | validation: format HOSTNAME
     - name: violations | type: array<Violation> | description: Issues that prevent the transfer. Empty if the domain passed every check.  | validation: maxItems 100
         - enum:
         -     UNKNOWN_VIOLATION: Unknown violation.
         -     DOMAIN_NOT_FOUND: Domain isn't registered, or the current registrar can't confirm that it can be transferred.
         -     DOMAIN_TRANSFER_IN_AUTHORIZATION_CODE_NOT_VALID: Authorization code isn't valid for this domain. The Wix user must request a new code from the current registrar.
         -     DOMAIN_TRANSFER_IN_TLD_NOT_SUPPORTED: Domain's TLD doesn't support transfers to Wix.
         -     DOMAIN_TRANSFER_IN_REQUEST_ALREADY_EXIST: A transfer to Wix is already in progress for this domain.
         -     DOMAIN_ALREADY_TAKEN: Domain is already registered with Wix.
         -     TRANSFER_IN_PREMIUM_DOMAIN_NOT_SUPPORTED: Domain is a premium domain. Premium domains can't be transferred to Wix.
         -     DOMAIN_TRANSFER_IN_CLIENT_TRANSFER_PROHIBITED: Domain is locked with a `clientTransferProhibited` status. The Wix user must unlock it at the current registrar.
         -     DOMAIN_TRANSFER_IN_CREATION_DATE_LESS_THAN_60_DAYS: Domain was registered or last transferred less than 60 days ago.


```

### Examples

### Validate an authorization code
Validates an authorization code from the current registrar before transferring the domain to Wix.

```javascript
import { transferInValidations } from "@wix/domains";

async function validateAuthorizationCode() {
  const response = await transferInValidations.validateAuthorizationCode(
    "example.com",
    "Xq7#vB2m!Lp9",
  );
}

/* Promise resolves to:
 * {
 *   "validationResult": {
 *     "_id": "example.com",
 *     "violations": []
 *   }
 * }
 */

```

### validateAuthorizationCode (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 { transferInValidations } from '@wix/domains';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function validateAuthorizationCode(domain,authorizationCode) {
  const response = await myWixClient.transferInValidations.validateAuthorizationCode(domain,authorizationCode);
};
```

---