Admin

API: Delete Domain

Remove a subdomain from a hosting account via the Opterius Panel API.

Last updated 1775606400

Removes a subdomain from a hosting account. The Nginx server block, PHP-FPM pool entry, and DNS record are removed. Files on disk are preserved.

Endpoint:

DELETE /api/v1/accounts/{account_id}/domains/{domain_id}

Authentication: Bearer token — see API Authentication Overview.

Request body: none.

[!NOTE] Files in the document root are intentionally left on disk. This matches the UI behavior — the account owner's files are never deleted without an explicit file manager action. If you need to remove the files, do so via the File Manager or SSH after deleting the domain.

Response

204 No Content on success. No response body.

Error Codes

Status Error Cause
404 not_found Account or domain ID does not exist
403 license_required License invalid — writes are blocked
409 conflict Cannot delete the account's primary domain via this endpoint — use Delete Account

curl Example

curl -sk -X DELETE \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  https://SERVER_IP:8443/api/v1/accounts/42/domains/7

A 204 response with no body indicates the domain has been removed.

What Is Removed

Resource Action
Nginx vhost (/etc/nginx/sites-available/{subdomain}.{domain}.conf) Deleted
Nginx symlink in sites-enabled Deleted
PHP-FPM pool config Deleted
DNS A record in PowerDNS Deleted
SSL certificate (/etc/letsencrypt/live/{fqdn}/) Deleted (Certbot revoke + delete)
Files on disk Preserved

Related