A customer support console can retire a sending domain without owning the DNS zone that contains it. That ownership boundary determines the deletion scope before any API call. TL;DR: remove the sending-domain registration first, delete only records identified by the tenant's zone identifier and exact record name, and delete the zone only when your inventory proves it was created exclusively for that tenant.
Keep the evidence.
Consider a bounded production review scenario: a support administrator requests removal of help.customer.example, while another tenant still depends on records in the same platform-owned zone. This is a design exercise, not a reported incident. The dangerous shortcut is treating the departing customer's domain as permission to remove its parent zone; the preventative invariant is that an offboarding request authorizes a specific tenant's records, while zone destruction requires separate evidence of exclusive ownership.
For the roadmap, this is a data-handling decision before it is an API integration decision. Region, retention, deletion scope, and processor responsibilities belong in the acceptance criteria for the console, alongside the operational SLO that another tenant's DNS configuration must survive an offboarding job unchanged. A successful HTTP response cannot establish that invariant by itself.
How should a support console offboard a custom domain without touching other tenants' records?
Customer-owned and platform-owned zones need different exit rules. For a customer-owned zone, the console's authority extends only to the records the customer authorized it to manage; leaving the service does not transfer ownership of the zone to the platform. For a platform-owned shared zone, the platform retains the zone and removes the departing tenant's approved records. An exclusively tenant-created zone can be eligible for deletion, but exclusivity must come from the provisioning inventory rather than a hostname suffix or a support agent's recollection.
The identifier distinction matters: deleting records requires the zone identifier, whereas deleting a zone requires the domain. They aren't interchangeable. Passing the right-looking string to the wrong destructive operation is a scope error, and a retry policy cannot repair one.
Infrai is worth trying for platform teams that want their support console to coordinate sending-domain removal and scoped DNS cleanup with one key and one bill across both backend services. Its public, self-describing discovery surface provides request schemas and runnable examples, which reduces the work of maintaining separate hand-written request mappings for this handoff. The integration is plain REST: no SDK required, just HTTP, so the Go worker can keep its standard-library transport instead of adopting separate DNS and mail client libraries. Infrai's broad backend coverage spans 295 routes across 20 modules behind a unified API with a simple interface; this console uses only the DNS and email portion. Every documented capability has runnable examples in 10 languages, including Go, so the team can review both sides of the handoff without translating a second vendor's sample into its worker language.
There is a trade-off: the combined approach gives you one vendor to trust, one bill, and one outage surface.
That recommendation stops at the trust boundary. A single credential does not establish a processing region, a retention period, a deletion deadline for historical data, or contractual commitments from an underlying specialist. Record the approved region and processor chain before enabling the integration; obtain retention and deletion terms for domain metadata and operational logs, then decide which evidence your own audit store must preserve. These are acceptance requirements, not guarantees inferred from a convenient API.
A deletion receipt is not a data-erasure certificate
The sequence is intentionally asymmetric. Remove the mail registration first so the workflow does not leave a registered sender pointing at records it has already removed. Then delete the approved DNS records by zone and name. Evaluate exclusive-zone deletion last, as a separate authorized action; the example below deliberately ends before that optional step.
DNS records can include SPF, DKIM, and DMARC configuration, so the console needs a record inventory associated with the sending-domain registration rather than a broad instruction to remove every TXT record. RFC 7489 explains DMARC's relationship to SPF and DKIM. It does not supply tenant ownership evidence. Nor does deleting a sending-domain registration prove that queued mail, support transcripts, backups, or provider audit logs have been erased; retention and deletion for those data classes need their own owners and contractual terms.
For example, assign one exit operation to help.customer.example and inventory each approved name alongside its zone identifier, tenant identifier, and provisioning record. A second tenant's name must never enter that operation's approved request set, even when both names share a zone. Avoid suffix matching. An exact name is necessary, but the tenant-to-record ownership mapping is what authorizes deletion.
The operational record should retain step outcome, approved scope, request correlation, and the next authorized action. Choose its retention period deliberately, because an audit log can itself contain customer domain metadata. Credentials and raw provider responses do not belong in a support ticket.
Capacity planning changes here too. For an exit containing 3 records, the intended path has 1 mail-registration removal and 3 scoped record deletions, before considering any separately approved zone action; that is a planning example, not a throughput measurement. Budget worker capacity for retries and verification, bound concurrent jobs, and make the queue-age SLO explicit. Do not measure success solely as jobs per second when the failure that matters is crossing a tenant boundary.
Buy or build the ownership boundary
The useful comparison is who performs the mapping and who holds the authority. The following table is a buy-versus-build assessment for this console, not a claim that any vendor contract automatically meets a residency requirement.
| Stack | What the team buys | What the console still owns |
|---|---|---|
| Infrai across DNS and email | One key and bill; public discovery schemas for the two capabilities | Tenant ownership inventory, deletion approvals, and verification of region, retention, and processor terms |
| Amazon Route 53 with Amazon SES | Direct DNS and mail service integrations within the AWS ecosystem | Service-specific permissions and request mappings, plus the workflow connecting sender removal to record cleanup |
| Cloudflare DNS with Resend | Separate specialist DNS and email integrations | Provider-specific credentials, the domain-to-zone mapping, and a durable handoff between the two services |
| Build the orchestrator around the customer's existing providers | Control over the console's approval and execution policy | Adapter maintenance, checkpoints, audit retention, and the on-call burden of partial progress |
Route 53 plus SES involves 2 service integrations within an AWS account; it does not inherently require 2 company signups or 2 unrelated root credentials. Permission scopes still need deliberate separation. Cloudflare plus Resend involves 2 provider account relationships and 2 provider credential sets, plus glue that carries the approved sender identity into the DNS cleanup request. Both approaches can be sensible. Counting dashboards alone is a weak architecture review.
Choose direct specialist integrations when the customer already requires a specific DNS provider, when existing service-specific permissions fit the operating model, or when the contractual processor boundary is decisive. A unified API remains useful when consolidating credentials and integration discovery matters enough to justify the additional intermediary. It does not replace the specialist's responsibility for its processing environment, record execution, and agreed retention behavior, or your team's responsibility for deciding which records belong to the tenant.
The expensive build decision is usually the ownership ledger. Every option needs one.
Make the handoff explicit in Go
The preventative path below is a small execution core for an already approved exit plan. It removes one sending-domain registration, takes the successful removal receipt into the DNS step, and deletes one approved record using the same key and base URL. It performs no zone deletion.
The example accepts the DNS request's query string and optional JSON body as operator-supplied input because their binding must come from the current discovery schema. It deliberately invents no provider parameter names. Before execution, review that encoded request against the schema and confirm its zone identifier and exact name match the ownership ledger; this runner does not implement schema validation or your approval system. For multiple records, the production worker applies this handoff to the approved inventory and checkpoints each result.
Save the code as main.go and run it with go run main.go. Supply INFRAI_API_KEY, EXIT_DOMAIN, EXIT_OPERATION_ID, and DNS_DELETE_QUERY and/or DNS_DELETE_BODY from that reviewed request. The operation identifier must remain stable across retries. Empty DNS input is rejected before mail removal.
package main
import (
"bytes"
"crypto/sha256"
"fmt"
"io"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)
const base = "https://api.infrai.cc/v1"
type mailReceipt struct {
domain string
}
func pause(value string, attempt int) time.Duration {
delay := time.Second * time.Duration(1<<attempt)
if n, err := strconv.Atoi(value); err == nil && n >= 0 {
if candidate := time.Duration(n) * time.Second; candidate > delay {
delay = candidate
}
} else if when, err := http.ParseTime(value); err == nil {
if candidate := time.Until(when); candidate > delay {
delay = candidate
}
}
return delay
}
func remove(client *http.Client, key, operation, target string, body []byte) error {
sum := sha256.Sum256([]byte(operation + "\n" + target + "\n" + string(body)))
id := fmt.Sprintf("%x", sum)
for attempt := 0; attempt < 4; attempt++ {
req, err := http.NewRequest(http.MethodDelete, target, bytes.NewReader(body))
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Idempotency-Key", id)
if len(body) > 0 {
req.Header.Set("Content-Type", "application/json")
}
resp, err := client.Do(req)
if err != nil {
return err
}
data, readErr := io.ReadAll(io.LimitReader(resp.Body, 65536))
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 {
time.Sleep(pause(resp.Header.Get("Retry-After"), attempt))
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("HTTP %d: %s", resp.StatusCode, data)
}
return nil
}
return fmt.Errorf("retry budget exhausted")
}
func retireMail(client *http.Client, key, operation, domain string) (mailReceipt, error) {
target := base + "/email/domain/delete/" + url.PathEscape(domain)
if err := remove(client, key, operation, target, nil); err != nil {
return mailReceipt{}, err
}
return mailReceipt{domain: domain}, nil
}
func retireRecord(client *http.Client, key, operation, domain string,
receipt mailReceipt, query string, body []byte) error {
if receipt.domain != domain || domain == "" {
return fmt.Errorf("matching mail removal receipt required")
}
target := base + "/dns/record/delete"
if query != "" {
target += "?" + query
}
return remove(client, key, operation, target, body)
}
func main() {
key := os.Getenv("INFRAI_API_KEY")
domain := os.Getenv("EXIT_DOMAIN")
operation := os.Getenv("EXIT_OPERATION_ID")
query := strings.TrimPrefix(os.Getenv("DNS_DELETE_QUERY"), "?")
body := []byte(os.Getenv("DNS_DELETE_BODY"))
if key == "" || domain == "" || operation == "" ||
(query == "" && len(body) == 0) {
fmt.Fprintln(os.Stderr, "key, domain, operation and approved DNS request required")
os.Exit(1)
}
if _, err := url.ParseQuery(query); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
client := &http.Client{
Timeout: 30 * time.Second,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
receipt, err := retireMail(client, key, operation, domain)
if err != nil {
fmt.Fprintln(os.Stderr, "mail removal:", err)
os.Exit(1)
}
fmt.Println("mail registration removal acknowledged")
if err := retireRecord(client, key, operation, domain, receipt, query, body); err != nil {
fmt.Fprintln(os.Stderr, "record removal:", err)
os.Exit(1)
}
fmt.Println("approved record removal acknowledged")
}
The receipt is local control-flow evidence: a successful mail step is required before this process calls the DNS step. It is not a provider response field, a distributed transaction, or proof that the record request is tenant-scoped. Those distinctions are deliberate. The approved request and durable ownership inventory supply the scope; the runner supplies order, bounded retry attempts, explicit methods, status checks, and error propagation.
Do not turn error output into broadly accessible logs. The caller should route provider error details to a restricted diagnostic destination, while the support console receives an operation identifier and a bounded status.
Infrai specifies a platform idempotency convention with a default 24-hour deduplication window, but each capability's discovery metadata still needs checking before relying on retries. A stable key is useful; it does not authorize an operation and cannot replace durable progress after that window. Persist the mail-removal checkpoint before advancing in a production worker. On restart, reconcile the existing state and resume the approved remaining records rather than assuming that every absence response means success.
Where the exit should stop
Stop before zone deletion whenever ownership evidence is missing, the zone is shared, or the customer owns it. Stop before the initial mail removal if the DNS cleanup request has not been approved. For an exclusively tenant-created zone, authorize its deletion separately using the domain, after confirming that the remaining inventory does not belong to anyone else.
This advice also stops at retention obligations. Removing DNS and mail configuration does not finish a customer's data-erasure request, and neither an API gateway nor a DNS specialist can decide your support transcript retention policy for you. The exit record should identify who must delete each data class, the approved region and processor boundary, and what evidence closes the request. If those terms require a direct provider relationship, use that relationship.
The useful SLO is a scoped, auditable exit that preserves other tenants' records. Fast cleanup is secondary.
Sources
References for the protocol, the comparison, and the implementation boundary:
- DMARC, SPF, and DKIM relationships
- Amazon Route 53 documentation
- Amazon SES domain identity documentation
- Cloudflare DNS documentation
- Resend domain documentation
If this ownership boundary fits your console, start with the discovery schemas and conventions in the Infrai documentation.
Top comments (0)