Check a main-domain change

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

Return whether the main (primary) domain of a shared-hosting account can be changed, and what the change would do.

Get accountId from GET /api/v2/shared-hosting data[].id.

Without domain the response covers the account only: available / reason, the current mainDomain, the other domains attached, and the mailboxes on the main domain.

With domain it also evaluates that target (target.available / target.reason), lists how each mailbox address changes, and includes the target's DNS preflight; supplying domain additionally requires the read:dns scope.

The main domain can be changed to a domain from outside the account while it is the only domain on the account.

An addon domain that is already on the account can take over as main domain when every other domain on the account is that addon domain or one of its subdomains: promotableDomains names it, and its evaluation carries target.promotion.

Any other mix of attached domains returns available: false.

A domain registered with HostUp, or with a DNS zone at HostUp, must be on the caller's own account (or covered by its owner's DNS delegation approval).

Nothing is changed by this request.

Web Hosting Hosting Accounts

Authentication

Required API scopes: read: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.

Query Parameters

domain string · Example: example.net

The domain to evaluate as the new main domain, without www.. Adds the read:dns scope requirement; does not change anything.

Headers

Authorization Bearer <token>
Accept application/json

Responses

200 The account's main-domain state and, when domain was supplied, the evaluation of that target.
available boolean required

Whether the main domain of this account can be changed through the API right now.

reason string · nullable required · Example: null

Why the change is unavailable. null when available is true.

mainDomain string · nullable required · Example: example.com

The account's current main domain.

otherDomains array<string> required

Every other domain attached to the account (addon domains, aliases and subdomains). When this list is not empty, only a domain in promotableDomains can become the main domain.

promotableDomains array<string> required · Example: []

Addon domains on the account that can take over as main domain: every other attached domain is that addon domain or one of its subdomains. Empty when the account has no such domain.

emailAccounts array<any> · nullable required

Mailboxes on the current main domain. These get addresses on the new main domain. null when the mailboxes could not be read.

actions object required
actions.canKeepPreviousDomain object required

Whether keepPreviousDomain: true can be used on POST. Keeping the previous domain attaches it to the same website folder and uses one addon domain slot on the plan.

actions.canKeepPreviousDomain.allowed boolean required · Example: true
actions.canKeepPreviousDomain.reason string · nullable required · Example: null

Nullable: may be null when not applicable.

actions.canKeepPreviousDomain.code string · nullable · Example: pending_order

Machine-readable reason code when an action is blocked.

target object · nullable required

Evaluation of the domain query parameter. null when no domain was supplied.

400 domain is not a full domain name, or starts with www..
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 Forbidden. The caller lacks a required scope or does not own the resource.
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 Conflict. code is account_not_eligible_cpanel.
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 hosting account's domains could not be read 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
GET https://cloud.hostup.se/api/v2/shared-hosting/{accountId}/actions/change-main-domain
For AI assistants
View as Markdown
cURL
curl -X GET "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/change-main-domain" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
Response
// The target can become the main domain
{
  "available": true,
  "reason": null,
  "mainDomain": "example.com",
  "otherDomains": [],
  "promotableDomains": [],
  "emailAccounts": [
    "[email protected]"
  ],
  "actions": {
    "canKeepPreviousDomain": {
      "allowed": true,
      "reason": null
    }
  },
  "target": {
    "domain": "example.net",
    "available": true,
    "reason": null,
    "emailAccountChanges": [
      {
        "current": "[email protected]",
        "afterChange": "[email protected]"
      }
    ],
    "dnsSetup": {
      "usesHostupNameservers": true,
      "managedRecordsRead": true,
      "nameservers": [
        "primary.ns.hostup.se",
        "secondary.ns.hostup.se"
      ],
      "hasThirdPartyWebsiteRecords": false,
      "hasThirdPartyMailRecords": false,
      "requiresChoice": false,
      "recommendedPreference": "full",
      "records": {
        "website": [],
        "mail": []
      },
      "options": []
    },
    "promotion": null
  }
}

// Other domains are attached that would not follow the change
{
  "available": false,
  "reason": "The hosting account has other domains attached, so the main domain cannot be changed here. Contact support and we will change it for you.",
  "mainDomain": "example.com",
  "otherDomains": [
    "blog.example.com",
    "shop.example.net"
  ],
  "promotableDomains": [],
  "emailAccounts": [
    "[email protected]"
  ],
  "actions": {
    "canKeepPreviousDomain": {
      "allowed": false,
      "reason": "The hosting account has other domains attached, so the main domain cannot be changed here. Contact support and we will change it for you."
    }
  },
  "target": null
}

// An addon domain on the account can take over as main domain
{
  "available": true,
  "reason": null,
  "mainDomain": "example.com",
  "otherDomains": [
    "example.net",
    "shop.example.net"
  ],
  "promotableDomains": [
    "example.net"
  ],
  "emailAccounts": [],
  "actions": {
    "canKeepPreviousDomain": {
      "allowed": true,
      "reason": null
    }
  },
  "target": {
    "domain": "example.net",
    "available": true,
    "reason": null,
    "emailAccountChanges": [],
    "dnsSetup": null,
    "promotion": {
      "siteFolder": "example.net",
      "previousSiteFolder": "example.com",
      "subdomains": [
        "shop.example.net"
      ],
      "ftpAccounts": []
    }
  }
}