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 with the domain in domainAssignment.domain, the site ID in domainAssignment.siteInfo.id, and domainAssignment.siteInfo.assignmentType set to REDIRECT.
  2. Call Set Domain As Primary 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.
  3. Call List Domain Assignments 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 with the domain as domainAssignmentId to confirm that siteInfo.assignmentType is REDIRECT. You can't move a site's primary domain.
  2. Call Upsert Domain Assignment 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.
  3. To make the domain the new site's main address, call Set Domain As Primary 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 with the site ID in siteIds, and pick a redirect domain to become the new primary domain.
  2. Call Set Domain As Primary with the redirect domain as domainAssignmentId. The previous primary domain becomes a redirect.
  3. Call Delete Domain Assignment with the previous primary domain as domainAssignmentId.

Last updated: 1 November 2026

Did this help?