> 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

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/introduction.md

## Article Content:

# About the Domain Assignments API

The Domain Assignments API lets you manage which domains point to the Wix sites in an account.
Each domain assignment connects a domain to a site, either as the site's primary domain
or as a redirect to the site's primary domain.
Read more about [primary and redirected domains](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains).

With the Domain Assignments API, you can:

+ Assign a domain to a site, or move it from another site.
+ Set a domain as a site's primary domain.
+ Retrieve the domain assignments of your sites.
+ Unassign a domain from a site.

To connect a domain that isn't registered with Wix, use the
[Connected Domains API](https://dev.wix.com/docs/api-reference/account-level/domains/connected-domains/introduction.md).

## Primary and redirect domains

A domain can be assigned to 1 site at a time.
A site has a single primary domain and can have up to 300 redirect domains.

Some calls change more than the domain you specify:

+ When you assign a domain as `PRIMARY` to a site that already has domain assignments,
  the site's existing domain assignments are removed, including its previous primary domain and all redirects.
  To keep them, assign the domain as `REDIRECT`, and then call
  [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md).
+ When you assign a domain as `REDIRECT` to a site that has no domain assignments,
  the domain becomes the site's primary domain.
+ When you set a domain as primary, the site's previous primary domain becomes a redirect,
  and all of the site's redirects point to the new primary domain.
+ When you delete the domain assignment of a site's primary domain,
  all of the site's domain assignments are deleted, including its redirects.
  To keep the redirects, first set a different domain as the site's primary domain.
+ You can't move a domain that's the primary domain of another site.
  First set a different domain as that site's primary domain.

## Before you begin

It's important to note the following points before starting to code:

+ You must specify the Wix account ID in the `wix-account-id` header of every call.
+ You can assign domains only to sites with a
  [Premium plan](https://support.wix.com/en/article/upgrading-your-site-to-premium-3066683).
  Use the [Resellers API](https://dev.wix.com/docs/api-reference/account-level/resellers/introduction.md)
  to add Premium plans to your customers' sites.
+ The ID of a domain assignment is the domain name. For example, the ID of the domain assignment of `mystunningsite.com` is `mystunningsite.com`.
+ You can specify the site in the `siteInfo.id` field or in the request header.
  If you specify it in both places, the site IDs must be identical.

## Use cases

+ [Assign a domain to a site as its primary domain](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/sample-flows.md#assign-a-domain-to-a-site-as-its-primary-domain)
+ [Move a domain from one site to another](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/sample-flows.md#move-a-domain-from-one-site-to-another)
+ [Remove a site's primary domain and keep its redirects](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/sample-flows.md#remove-a-sites-primary-domain-and-keep-its-redirects)

## Terminology

+ __Domain assignment__: The connection between a domain and a Wix site.
+ __Primary domain__: The domain that visitors see when they visit the site. A site has a single primary domain.
+ __Redirect domain__: A domain that sends visitors to the site's primary domain.

@sdk_package_setup