Skip to main content

Remove a domain

Takes one domain away from an account, with everything on it, and leaves the account and its other domains as they are. Afterwards nothing on the server is keyed by the domain's name, so the name can be added to any account again as a new domain.

A removal is a job that runs in the background through fixed steps, like an account deletion: it checks first and refuses before it touches anything, records each step, and when a step fails it stops there until you retry it.

The account holder can start the same removal from their own panel or API while the server lets holders add and remove their own domains, which it does by default, and their account's domain limit is not 0. At 0 only you remove the account's domains. They confirm their identity, read the same dry run and type the domain's name; an API key needs the dns:readwrite scope. Their removal page follows the steps but has no Retry: when a step fails, it tells them to contact you. The AI assistant and MCP tools can't remove a domain; they give the holder the link to its Remove page, or, when the holder can't remove it, say that you do. What the holder reads is in the account docs: Remove a domain.

What goes and what stays​

What goes is what lives on the domain's hostnames, i.e. the hosts whose DNS zone is the domain:

  • The domain accounts: mailboxes with their mail, send-only users, forwarders, groups, rejectors, relayers and mailing lists. Each goes as it does when the account holder deletes it.
  • The outgoing mail of those mailboxes that is still in the queue.
  • The web mounts of its websites, and the panel's records of the web applications installed on them.
  • The identity applications defined on its identity provider.
  • Its services: website aliases, websites, mail, webmail, identity provider, and any other.
  • The DNS zone, at the server's name servers, and then the hostnames.

What stays belongs to the account rather than to the domain:

StaysWhy
Every file in the account's home directory, document roots includedThe files are the account's, even the ones a website of the domain served.
Databases, application servers, containers and stacks, API keysAccount-wide.
CertificatesThey are the account's. Those for the domain's names expire.
BackupsThe snapshots of the removed mailboxes stay restorable, as for a mailbox the holder deletes.
The account's other domainsIncluding a hosted zone below this one, e.g. shop.example.com.
A zone at the holder's Cloudflare or deSEC accountThe panel removes its own copy and never touches the provider's.
The removal record and the auth syslog linesThe record is never pruned.
Mail and web stop at once

From the moment the removal starts, the domain's mailboxes are being deleted with their mail, its queued mail is discarded and its websites stop. Nothing undoes a removal. The files of the websites stay in the account's home directory; mail does not, except in backups.

What refuses a removal​

A removal refuses to start, and touches nothing, when something outside the domain would go with it or be left pointing at nothing. The refusal lists each one:

  • A website alias in another domain of a website in this one.
  • A mail domain elsewhere whose webmail is this domain's.
  • A website or webmail elsewhere that signs in through this domain's identity provider.
  • A hostname, a domain account or a service in the domain that belongs to somebody else.

"Elsewhere" includes the same account's other domains: move or remove the alias, the mail domain or the identity setting first, then remove the domain. A removal is also refused for a zone of the server's own, for an account that is terminated or being deleted (its deletion removes its domains), while another removal of the same domain is open, and while a deletion of the account is open. Conversely, an account deletion refuses to start while a removal of one of its domains is open, failed ones included: retry the removal until it succeeds first.

Warnings for the registrar​

The panel cannot change what the parent zone says about the domain. Before you confirm, the dry run warns about it, from what the parent zone said when the panel last checked the domain's delegation:

  • The parent still delegates the domain to this server. Once the zone is removed, the domain does not resolve until the holder points it at other name servers at the registrar. Until then, any account on the server can claim it by the name server proof; see The risk of the name server proof.
  • The parent still carries a DS record. Served elsewhere with other keys, the domain fails DNSSEC validation, and so does not resolve for validating resolvers, until the DS is removed at the registrar.
  • A zone at a provider of the holder's own stays there, and goes on answering with the records it had.
  • A hosted zone below this one stays, without the delegation to it, which was in this zone.

The warnings never refuse a removal: the holder may be moving away right now. They are written to the removal's log too, so that you can pass them on.

Remove a domain​

The Domains tab of an account's page has Remove beside each domain, and so does the domain's own page under Accounts › Domains. Remove shows the dry run: how many hostnames, domain accounts, mailboxes, services, web applications, web mounts and identity applications go, and any refusals and warnings. To go ahead, type the domain's name and choose Remove domain; a refused removal has no form.

On the command line, --dry-run shows the same and removes nothing:

elpanctl service domain remove example.com --dry-run
elpanctl service domain remove example.com

The command asks before it removes anything; --force skips the question, and --sync runs the removal in the command instead of in a worker.

While a domain is being removed​

The domain is frozen from the moment its removal starts: nothing can be added to it or changed in it, from the account holder's panel, API and assistant or from the admin app. The holder sees it marked Being removed, and can still look at it.

The removal's page shows its state (Pending, Running, Waiting, Succeeded, Failed), its steps, why it stopped, when it last made progress, and its log. The Domains tab lists the account's removals, removed domains included. A removal waits, for at most 10 minutes, until the zone is gone from the server's name servers before it counts as succeeded.

A step that fails stops the removal there; nothing retries it on its own. When the cause is fixed, Retry or service domain removal retry resumes it from that step, and a refusal found at the first step is retried the same way once it is cleared. A removal whose worker died is retried the same way once nothing has been heard from it for 15 minutes.

elpanctl service domain removal list [--state=<state>] [--username=<username>] [--domain=<domain>] [--limit=<n>]
elpanctl service domain removal status <removal-id-or-domain>
elpanctl service domain removal retry <removal-id> [--sync]

Every removal is logged on the server's auth syslog channel: when it starts (Domain removal started, with requestedBy: account:<username> or api:<username> for the holder's own), and when it ends (Domain removed, with the warnings, or Domain removal failed).

In the server API​

Method and pathWhat
DELETE /api/v1/accounts/{username}/domains/{domain}Remove the domain: 202 with the removal to poll, or 409 with the refusals and nothing touched. With dryRun=true, what the removal would do, its refusals and its warnings. A removal already open is returned as it is.
GET /api/v1/domain-removals, GET /api/v1/domain-removals/{id}, POST /api/v1/domain-removals/{id}/retriesThe removals, where each has got to, and a retry of a failed one.

See Server API.