> 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

# DeleteDomainAssignment

# Package: domains

# Namespace: DomainAssignmentService

# Method link: https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/delete-domain-assignment.md

## Permission Scopes:
Manage Domains: SCOPE.ACC-DC-PREMIUM.MANAGE-DOMAINS

## Introduction

Unassigns a domain from a site and deletes the domain assignment.


If the domain is the site's primary domain, all of the site's domain
assignments are deleted, including its redirects. To remove only the primary
domain and keep the redirects, first call
[Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md)
to make a different domain the site's primary domain. Then delete the previous
primary domain's assignment.

You must specify the Wix account ID in the `wix-account-id` header.

---

## REST API

### Schema

```
 Method: deleteDomainAssignment
 Description: Unassigns a domain from a site and deletes the domain assignment.   If the domain is the site's primary domain, all of the site's domain assignments are deleted, including its redirects. To remove only the primary domain and keep the redirects, first call [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md) to make a different domain the site's primary domain. Then delete the previous primary domain's assignment.  You must specify the Wix account GUID in the `wix-account-id` header.
 URL: https://www.wixapis.com/domains/v1/domain-assignments/{domainAssignmentId}
 Method: DELETE
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  domainAssignmentId
 Method parameters: 
   param name: domainAssignmentId | type:   none | required: true 
 Return type: DeleteDomainAssignmentResponse
  EMPTY-OBJECT {}


```

### Examples

### Unassign a redirect domain
Unassigns a redirect domain from a site and deletes its domain assignment.

```curl
curl -X DELETE \
'https://www.wixapis.com/domains/v1/domain-assignments/mystunningsite.org' \
-H 'wix-account-id: <ACCOUNT_ID>' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.domains.domainAssignments.deleteDomainAssignment(domainAssignmentId)
 Description: Unassigns a domain from a site and deletes the domain assignment.   If the domain is the site's primary domain, all of the site's domain assignments are deleted, including its redirects. To remove only the primary domain and keep the redirects, first call [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md) to make a different domain the site's primary domain. Then delete the previous primary domain's assignment.  You must specify the Wix account GUID in the `wix-account-id` header.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  domainAssignmentId
 Method parameters: 
   param name: domainAssignmentId | type: string | description: GUID of the domain assignment to delete. Identical to the domain name. | required: true | validation: format HOSTNAME
 Return type: PROMISE<DeleteDomainAssignmentResponse>
  EMPTY-OBJECT {}


```

### Examples

### Unassign a redirect domain
Unassigns a redirect domain from a site and deletes its domain assignment.

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

async function deleteDomainAssignment() {
  await domainAssignments.deleteDomainAssignment("mystunningsite.org");
}

```

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

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


async function deleteDomainAssignment(domainAssignmentId) {
  const response = await myWixClient.domainAssignments.deleteDomainAssignment(domainAssignmentId);
};
```

---