POST

Upsert Domain Assignment


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Assigns a domain to a site, or moves the domain from a different site.

Upsert Domain Assignment creates or updates the domain assignment based on the domain's current state:

  • Domain isn't assigned: Creates a domain assignment.
  • Domain is assigned to the specified site: Returns the existing domain assignment unchanged, even if you specify a different assignmentType. To make the domain the site's primary domain, call Set Domain As Primary.
  • Domain is a redirect on a different site: Removes the domain from that site and assigns it to the specified site.
  • Domain is the primary domain of a different site: Fails. To move the domain, first call Set Domain As Primary to make a different domain that site's primary domain.

The site must have a Premium plan.

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.

When you assign a domain as REDIRECT to a site that has no domain assignments, the domain becomes the site's primary domain.

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

Permission Scopes
Manage Domains
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/domains/v1/domain-assignments/upsert/domain/{domainAssignment.domain}

Errors
428Failed Precondition

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?