Change the main domain

POST /api/v2/shared-hosting/{accountId}/actions/change-main-domain

Change the main (primary) domain of a cPanel-backed shared-hosting account.

Get accountId from GET /api/v2/shared-hosting data[].id, and check the change first with GET on this path.

The control-panel username, files and databases stay as they are: the same website folder is served on the new domain, and mailboxes on the previous main domain get addresses on the new one.

The previous domain is detached unless keepPreviousDomain is true, which attaches it again to the same website folder without changing its DNS.

No domain registration is cancelled, renewed or transferred.

If the new domain is delegated to HostUp's nameservers and has no website or email records elsewhere, its DNS is pointed to the hosting account; if it has such records, the request is refused with dns_setup_choice_required until dnsSetupPreference is supplied.

A domain that is an addon domain on the account today (see promotableDomains on GET) can take over as main domain: its website folder becomes public_html, the previous main domain's website files are kept in a folder named after that domain, its subdomains, mailboxes, certificate and DKIM key are kept, its DNS is not changed, and promotion in the response says what was put back; the website can be unreachable for a couple of minutes while the web server switches over.

The change can take up to a minute, longer for an addon domain with several subdomains.

The request is safe to repeat: a request for a domain that is already the main domain completes whatever an interrupted earlier request left undone and returns 200 with changed: false.

Web Hosting Hosting Accounts

Authentication

Required API scopes: write:hostingconsole:services

Authenticate with an API key in the Authorization: Bearer <token> header.

Context

Path Parameters

accountId string required Example: acct_01hxa3b4c5d6e7f8g9h0j1k2m3

Public shared-hosting account ID. Get it from GET /api/v2/shared-hosting data[].id. Do not invent this value; use the exact ID returned by the referenced API response.

Headers

Authorization Bearer <token>
Accept application/json
Content-Type application/json

Body

required
application/json
domain string required · Example: example.net

The new main domain, without www. (the www name is attached automatically). It must be a registered domain (not a subdomain) with public nameservers, must not be attached to any hosting account, and, when it is registered with HostUp or has a DNS zone at HostUp, must be on the caller's own account.

keepPreviousDomain boolean

Keep the previous main domain attached to the same website folder so it keeps showing the site. Uses one addon domain slot; see actions.canKeepPreviousDomain on GET. The previous domain's DNS is not changed, and its old mailbox addresses are not recreated.

dnsSetupPreference string · enum

What to point at the hosting account for the NEW domain when it already has records elsewhere: full = website and email, website-only = website (existing email records are kept), email-only = email (existing website records are kept), none = change no DNS. Required when GET reports target.dnsSetup.requiresChoice.

full
email-only
website-only
none

Responses

200 The main domain is the requested domain.
mainDomain string required · Example: example.net
previousMainDomain string · nullable required · Example: example.com

The main domain before the change. null when the requested domain was already the main domain and nothing remained to finish.

changed boolean required

True when this request changed the main domain. False when it was already in place and only remaining steps were completed.

emailAccounts array<any> · nullable required

Mailboxes on the new main domain after the change. null when they could not be read.

previousDomain object · nullable required

What happened to the previous main domain. null when previousMainDomain is null.

certificate object required
certificate.status string · enum required

requested = issuance of an SSL certificate for the new domain was started and normally completes within minutes. request_failed = it could not be started now and is issued at the next automatic check.

requested
request_failed
dns object · nullable required

DNS handling for the new main domain. null when the domain was already the main domain or its DNS could not be inspected.

promotion object · nullable required

Outcome of the parts an addon-domain-to-main-domain change puts back. null when the new main domain was not an addon domain on the account, and on a repeated request for a domain that is already the main domain.

400 The request body is invalid.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
401 Unauthorized. Authentication is required.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
403 The domain is registered to another customer account, or has a DNS zone with HostUp that is not on the caller's account.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
404 Not found. The resource does not exist or is not owned by the caller.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
409 The main domain cannot be changed in the current state. Nothing was changed.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
429 Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
500 Internal error. Retry later or contact support if the issue persists.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
502 The change could not be completed or confirmed. Sending the same request again is safe. mainDomainChanged: true means the main domain was changed and only the final step is missing; repeat the request to finish it. For an addon domain, a change that stopped part-way and could not be put back automatically is reported here with a detail asking to contact support.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
503 The domain's ownership could not be verified right now. Retry later.
type string · Example: https://developer.hostup.se/errors/invalid_request
title string · Example: Validation failed
status integer · Example: 400
detail string · Example: The request body failed validation.
code string · Example: invalid_request

Stable machine-readable code. Branch on this field, not on detail.

instance string · Example: /api/v2/orders
requestId string · Example: req_01hxa3b4c5d6e7f8g9h0j1k2m3
timestamp string · Example: 2026-04-27T12:34:56.000Z
errors array<object>

Field-level validation errors when code is invalid_request.

errors[].pointer string required · Example: /items/0/eppCode
errors[].detail string required · Example: `eppCode` is required for this transfer.
errors[].code string required · Example: missing_required
extensions object
POST https://cloud.hostup.se/api/v2/shared-hosting/{accountId}/actions/change-main-domain
For AI assistants
View as Markdown
cURL
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/change-main-domain" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.net"
  }'
Response
{
  "mainDomain": "example.net",
  "previousMainDomain": "example.com",
  "changed": true,
  "emailAccounts": [
    "[email protected]"
  ],
  "previousDomain": {
    "domain": "example.com",
    "status": "detached",
    "reason": null
  },
  "certificate": {
    "status": "requested"
  },
  "dns": {
    "usesHostupNameservers": true,
    "appliedPreference": "full"
  },
  "promotion": null
}
Request Body Change the main domain
{
  "domain": "example.net"
}