Connect a domain's email to Hostup web hosting
3 steps · Checked against the API code 3 November 2026
A guide does one task from start to finish. Every endpoint, with all its fields and cases, is in the API reference.
When the mailboxes are on a Hostup web hosting account, the hosting can write the domain’s email records itself. One call adds the MX, SPF and DKIM records and makes the hosting accept the domain’s mail. For any other mail provider, follow Set up MX, SPF, DKIM and DMARC for a domain.
Before you start
Section titled “Before you start”- The requests use your key from
$HOSTUP_API_KEY(Quickstart). The key needs the scopeswrite:hosting,write:dnsandconsole:services. Keys and scopes - The ID of the hosting account,
acct_…. List web hosting accounts if you don’t have it. - The domain on that account, as its main, addon or parked domain. List hosting domains shows them. Add a domain to web hosting adds one.
export ACCOUNT_ID="acct_…" # your hosting account: List web hosting accounts1. Read the setup state
Section titled “1. Read the setup state”Get the DNS setup of a hosting domain shows what the domain’s website and mail point at now.
curl "https://cloud.hostup.se/api/v2/shared-hosting/$ACCOUNT_ID/domains/dns-setup?domain=example.com" \ -H "Authorization: Bearer $HOSTUP_API_KEY"{ "domain": "example.com", "enabled": true, "delegation": "hostup", "hostingIp": "192.0.2.10", "classification": { "website": "elsewhere", "mail": "missing", "mx": [], "requiresChoice": true, "recommendedPreference": "email-only", "…": "…" }, "revision": "5f8c1d2e9a7b4c3d6e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c9d", "publication": null, "canApply": true, "…": "…"}Go on only when enabled and canApply are true. Keep revision. Step 2 sends it back.
export REVISION="…" # revision aboveclassification.mailsays where mail goes now:hosting,elsewhere,missingordisabled.delegationishostupwhen the domain uses Hostup’s nameservers.
2. Apply the setup
Section titled “2. Apply the setup”Choose email-only to move email to the hosting and leave the website records alone. Choose full to move both the website and email.
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/$ACCOUNT_ID/domains/dns-setup" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com", "preference": "email-only", "revision": "'$REVISION'" }'{ "success": true, "domain": "example.com", "preference": "email-only", "status": "done"}For email, the setup writes these records in the domain’s zone:
- An MX record on the domain pointing at
mail.example.comwith priority 10. - An A record for
mailwith the hosting’s address. - The SPF record with the hosting’s servers added. Senders already in it stay.
- A DKIM TXT record at
default._domainkeywith the hosting’s key.
The setup also switches the hosting’s email routing for the domain to local. The hosting account then accepts mail for the domain. An existing DMARC record stays as it is. The setup does not add one. Add it as in Set the DMARC record.
If the setup answers 409 dns_plan_conflict
Section titled “If the setup answers 409 dns_plan_conflict”The records cannot be changed automatically. Add them yourself with Create a DNS record, in this order:
- An A record for
mailwithhostingIpfrom step 1. - An MX record at
@formail.example.comwith priority 10. include:spf.hostup.sein the domain’s SPF record.- The DKIM record. Check DKIM, SPF and DMARC for a domain gives its name in
dkim.nameand its value indkim.requiredValue. - Email routing
localwith Set email routing for a domain.
Set up MX, SPF, DKIM and DMARC for a domain shows each of these requests.
3. Check that mail goes to the hosting
Section titled “3. Check that mail goes to the hosting”"status": "done" in step 2 means the zone matches the setup. "pending" means it does not yet. Read the setup state again until publication is no longer pending and classification.mail is hosting.
curl "https://cloud.hostup.se/api/v2/shared-hosting/$ACCOUNT_ID/domains/dns-setup?domain=example.com" \ -H "Authorization: Bearer $HOSTUP_API_KEY"{ "domain": "example.com", "classification": { "mail": "hosting", "…": "…" }, "publication": "done", "…": "…"}publication is pending while the setup is not in the zone yet. The first read that finds it in place says done. Later reads say null.
If delegation is external
Section titled “If delegation is external”The setup can be applied while the domain uses other nameservers. Nothing is live until the nameservers point at Hostup. Change a domain’s nameservers shows how.
What happens next
Section titled “What happens next”The records are in the domain’s zone when step 3 shows hosting. Mail servers that looked up the old MX records can keep using them until the old TTL has passed. Keep the old mailboxes until then.
Next: Set the DMARC record, which the setup leaves to you.
Errors you may hit
Section titled “Errors you may hit”The setup answers 409 with one of these codes when it refuses:
- 409
dns_changed: the records changed after your read. Read the state again (step 1) and send the newrevision. - 409
dns_forwarding_active: email forwarding is on for the domain. Turn it off with Turn domain email forwarding on or off, as in Set up email DNS. - 409
dns_mirror_pending: the hosting’s view of the zone is still updating. Read the state again a little later and send the newrevision. - 409
dns_busy: another DNS change for the domain is running. Try again shortly. - 409
dns_mail_key_unavailable: the hosting’s DKIM key for the domain is not ready yet. Try again shortly. - 409
dns_redirect_active, only withfull: the domain has a redirect. Remove the redirect or chooseemail-only. - 409
dns_plan_conflict: the records cannot be changed automatically. Add them yourself as in step 2. - 409
dns_not_enabled: this hosting account does not offer the setup. Step 1 showsenabledasfalse.
Other answers:
- 503
dns_read_unavailable: the setup state could not be read. The apply answers the same when step 1 showedcanApplyasfalseor norevision. Read the state again a little later. - 503 or 502
domain_not_attached: the domain is not on this hosting account. The read answers 503 and the apply answers 502. Retrying does not change that answer. Add the domain to the account first with Add a domain to web hosting. - 403
forbidden: the key lacks a scope the call needs. When a key is refused