> 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

## Resource: Sample Flows

## Article: Sample Flows

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

## Article Content:

# Domain Assignments API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Assign a domain to a site as its primary domain

A customer adds a new domain to an existing site, and wants the new domain to become the site's main address
while their existing domains keep working as redirects.
Assigning the domain directly as `PRIMARY` would remove the site's existing domain assignments,
so assign it as a redirect first and then promote it.

> **Prerequisite:** The site must have a Premium plan.

To assign a domain to a site as its primary domain:

1. Call [Upsert Domain Assignment](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/upsert-domain-assignment.md) with the domain in `domainAssignment.domain`,
   the site ID in `domainAssignment.siteInfo.id`, and `domainAssignment.siteInfo.assignmentType` set to `REDIRECT`.
1. Call [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md) with the domain as `domainAssignmentId`.
   The site's previous primary domain becomes a redirect, and all of the site's redirects point to the new primary domain.
1. Call [List Domain Assignments](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/list-domain-assignments.md) with the site ID in `siteIds` to confirm the site's domains.

## Move a domain from one site to another

A customer rebuilds their business on a new site and wants a domain that's currently a redirect on the old site
to point to the new site instead.

> **Prerequisite:** The target site must have a Premium plan.

To move a domain from one site to another:

1. Call [Get Domain Assignment](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/get-domain-assignment.md) with the domain as `domainAssignmentId`
   to confirm that `siteInfo.assignmentType` is `REDIRECT`.
   You can't move a site's primary domain.
1. Call [Upsert Domain Assignment](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/upsert-domain-assignment.md) with the domain in `domainAssignment.domain`,
   the new site's ID in `domainAssignment.siteInfo.id`, and `domainAssignment.siteInfo.assignmentType` set to `REDIRECT`.
   The domain is removed from the old site and assigned to the new site.
1. To make the domain the new site's main address, call [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md) with the domain as `domainAssignmentId`.

## Remove a site's primary domain and keep its redirects

A customer stops using a site's primary domain, but wants the site to stay reachable through its other domains.
Deleting the primary domain's assignment directly would delete all of the site's domain assignments.

To remove a site's primary domain and keep its redirects:

1. Call [List Domain Assignments](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/list-domain-assignments.md) with the site ID in `siteIds`,
   and pick a redirect domain to become the new primary domain.
1. Call [Set Domain As Primary](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/set-domain-as-primary.md) with the redirect domain as `domainAssignmentId`.
   The previous primary domain becomes a redirect.
1. Call [Delete Domain Assignment](https://dev.wix.com/docs/api-reference/account-level/domains/domain-assignments/delete-domain-assignment.md) with the previous primary domain as `domainAssignmentId`.