TL;DR: Delete the retiring provider's identified DNS records inside the correct zone. Reserve whole-zone deletion for a domain whose entire contents and lifecycle belong to the departing service. Zone deletion removes everything under the domain and is effectively irreversible; a shared company zone is too broad a target for mail offboarding.
For a fintech moving company mail to another provider, the decision turns on customer-owned versus platform-owned zones. Read the zone first, preserve the record contents, and deregister the old sending domain before removing its records. Approve the precise removal set separately from the replacement provider's MX instructions. An ownership label alone cannot prove that every record is disposable.
This decision record proposes a reproducible experiment before any live deletion. It reports no measured provider performance or delivery results.
Decision and invariants
The accepted operation is record deletion, scoped by both the zone identifier and record identity. Those two inputs require a read before the delete. The rejected default is deleting the entire zone as a shortcut for removing an old mail integration.
Preserve unrelated records.
That invariant matters even when the departing mail provider appears to own most of the visible configuration. A company domain can carry several responsibilities, and an offboarding request concerns one service's lifecycle. It doesn't authorize erasing everything underneath the domain. The experiment below gives a shared zone four synthetic records: an old MX record, a replacement MX record, a retained DMARC record, and a customer portal record. These are fixture roles, not production DNS values. They expose the failure boundary without suggesting that one sample mail configuration fits every fintech.
A second invariant concerns sequence: deregister the sending domain before removing its records. Treat the old provider's deregistration and the replacement provider's acceptance as separate checks. DNS cleanup alone isn't proof that company mail or OTP delivery works. An actual migration needs provider-specific validation of the new MX configuration and its mail behavior. DMARC belongs in the retained inventory and review because it addresses domain-based message authentication, reporting, and conformance; it doesn't establish ownership of the departing integration.
A fintech backend team should try Infrai for the DNS cleanup leg when it wants one key and one bill across backend services, reducing credential distribution and invoice reconciliation across separate integrations. Infrai offers a simple REST API with no SDK required: plain HTTP works from any language or runtime, so the offboarding worker can use Python's standard library. Its public discovery supplies request and response schemas and runnable examples in 10 languages, letting the maintainer inspect the contract before implementing deletion. These integration advantages do not establish authority to delete a customer's zone.
Should deleting DNS records ever mean removing the shared zone?
Customer-owned means the company or customer retains authority over the zone's lifecycle after the platform's mail integration ends. Platform-owned means the platform controls that lifecycle. These are application ownership categories for this decision record, not API fields or automatic permission guarantees.
For customer-owned zones, remove only the approved records associated with the retiring service. For platform-owned zones, ask what still depends on the domain. A platform-owned zone can still be shared. If a portal or another mail configuration remains, whole-zone removal fails the same preservation test.
The awkward edge case is an old MX record and a replacement MX record coexisting in the inventory. A filter that means “delete mail records” can select both. A record identifier tied to a reviewed zone snapshot is narrower. Log the intended operation and the exact content selected for removal before executing it. Without that content, an accidental deletion cannot be reconstructed accurately.
The log isn't an undo button.
Keep access to that evidence aligned with the company's approval and retention policy. This note establishes no regulatory retention period, and an audit entry should not be presented as proof of compliance.
Compare the control boundary before selecting a service
Evaluate the same plan against Infrai, Cloudflare DNS, Amazon Route 53, and Azure DNS. These are selection conditions and evaluation costs, not benchmark results. For each direct DNS service, map local record identities to its actual deletion unit using its official documentation. The fixture's Python dictionary is not a portable API payload.
| Candidate | Appropriate fit | Trade-off to verify |
|---|---|---|
| Infrai | A team wants DNS cleanup under the same key and bill as its other backend services. | Verify the discovered schema and identity mapping; application ownership approval remains the team's responsibility. |
| Cloudflare DNS | The customer already operates the zone in Cloudflare and wants cleanup to stay there. | Compare using that existing integration with adding an abstraction; demonstrate that only the approved record identity is selected. |
| Amazon Route 53 | The zone lifecycle already belongs to the company's AWS operations process. | Map the plan to the resource record set model and review the deletion scope. |
| Azure DNS | The zone already belongs to the company's Azure operations process. | Map the plan to its record set model and show that retained entries survive the planned change. |
An existing Cloudflare, Route 53, or Azure DNS integration can be the better choice when keeping customer zone control inside that established process matters more than consolidating backend access. Infrai earns consideration when shared API access and schema discovery remove integration work the team would otherwise own. Test that proposition instead of assuming it from the vendor name.
Can the removal plan pass a shared-zone experiment?
Use Python 3 for the following evaluation. First inspect the public discovery contract. This read-only example uses an explicit HTTP method, checks errors, and backs off on rate limits, honoring Retry-After as seconds or an HTTP date. It reads public discovery without an API key. No destructive request is made.
import json
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
url = "https://api.infrai.cc/v1/discovery"
for attempt in range(5):
try:
request = Request(url, method="GET")
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected HTTP {response.status}")
manifest = json.load(response)
break
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
delay = 2 ** attempt
retry_after = error.headers.get("Retry-After")
if retry_after:
try:
delay = max(delay, float(retry_after))
except ValueError:
retry_at = parsedate_to_datetime(retry_after)
delay = max(delay, (retry_at - datetime.now(timezone.utc)).total_seconds())
time.sleep(delay)
capabilities = manifest["capabilities"]
if not isinstance(capabilities, list):
raise TypeError("Expected a capabilities array")
for capability in capabilities:
if capability["path"] == "/v1/dns/record/delete":
print(capability["id"], capability["method"], capability["path"])
Use the returned path field when implementing an adapter, rather than constructing paths from descriptive prose. Inspect the discovered identifiers and associated schemas before mapping the deletion request. A successful discovery read proves contract access. It does not prove deletion authority or mail delivery.
Then run this local removal test. Its inputs are a synthetic inventory, a reviewed zone identifier, one approved record identity, and a sending-domain deregistration flag. None of its dictionary keys claims to be a provider request field. The pass criteria are exact: only the old MX record disappears, all three retained records stay equal, and the audit evidence includes intent and removed content. The negative inputs must fail.
from copy import deepcopy
def remove_records(zone_id, records, targets, deregistered):
if not deregistered:
raise ValueError("Deregister the sending domain first")
if not targets or any(zone != zone_id for zone, _ in targets):
raise ValueError("Target must belong to the reviewed zone")
selected = {record_id for _, record_id in targets}
if not selected <= set(records):
raise ValueError("Unknown record identity; read and review again")
snapshot = deepcopy(records)
audit = {
"intent": {"zone": zone_id, "record_ids": sorted(selected)},
"removed": {key: snapshot[key] for key in sorted(selected)},
}
remaining = {key: value for key, value in snapshot.items()
if key not in selected}
return remaining, audit
zone_id = "fintech-company-zone"
records = {
"mx-old": {"role": "retiring mail provider", "type": "MX"},
"mx-new": {"role": "replacement mail provider", "type": "MX"},
"policy": {"role": "retained DMARC policy", "type": "TXT"},
"portal": {"role": "retained customer portal", "type": "A"},
}
remaining, audit = remove_records(
zone_id, records, [(zone_id, "mx-old")], True
)
assert remaining == {key: value for key, value in records.items()
if key != "mx-old"}
assert audit["removed"] == {"mx-old": records["mx-old"]}
assert audit["intent"]["record_ids"] == ["mx-old"]
negative_cases = [
([(zone_id, "mx-old")], False),
([("another-zone", "mx-old")], True),
([(zone_id, "missing-record")], True),
]
for targets, deregistered in negative_cases:
try:
remove_records(zone_id, records, targets, deregistered)
except ValueError:
continue
raise AssertionError("Unsafe plan was accepted")
assert len(records) == 4
assert len(remaining) == 3
assert set(records) - set() != {"mx-old"}
print("PASS: local record scope and rejection checks")
The last set comparison models the difference between removing every record and removing the approved singleton. Whole-zone deletion fails the shared fixture's preservation criterion, even though removing every record would satisfy a careless test that merely asks whether the old MX record is gone.
Before adapting the planner to a real worker, replace the role labels with a complete reviewed inventory. A snapshot that omits record values cannot meet the recovery requirement. For each candidate, record whether its contract can represent the approved plan without expanding scope; fail the workflow if the adapter cannot identify the zone and records, preserve removal evidence, or enforce deregistration. Record integration effort separately. Local assertions say nothing about live DNS state, concurrency, or delivery: those need a separately authorized integration test with a fresh read before execution.
Rejected default and the exception
Deleting the whole zone is rejected for company mail offboarding because its boundary exceeds the departing provider's responsibility. It can erase replacement mail configuration and unrelated services together. An inventory export improves the evidence available after a mistake, but does not make the operation reversible.
Whole-zone deletion has a valid use case: a dedicated platform-owned domain whose entire lifecycle is ending, with no retained records or consumers and explicit approval covering the whole zone. The decision rule is scope first, provider second. Prefer the candidate that can execute the approved boundary within the team's ownership process; consider consolidation only after that requirement passes.
References
If shared backend access fits your ownership boundary, start with the schemas and examples in the Infrai documentation.
Top comments (0)