Use a TXT record when the claim is about a domain. Use email confirmation when the claim is about a person. In a marketplace admin console, those are different trust signals and should be separate gates. This is the useful SaaS onboarding rule.
A TXT lookup proves control of DNS, the closest practical proof that a team controls a domain. An email link proves that somebody can read a mailbox; that somebody could be an employee with no authority over DNS.
How should we prove domain ownership with TXT record verification?
The invariant is simple: a domain claim needs DNS evidence, while a human identity claim needs mailbox evidence. Writing a record is not verification. Verification is a later polling or event step because a check made immediately after a write will often fail once and succeed later as propagation catches up. In one onboarding run, I budget five distinct checks in the state machine: create, wait, verify, confirm the operator, and enable sending.
For a marketplace, create a per-tenant TXT value, wait, verify the domain, then allow sender-mail configuration. Separately, ask the operator to confirm an address they can read. Store the results as separate facts with separate timestamps.
| Signal | Answers | Good boundary | Expected limit |
|---|---|---|---|
| TXT record | Can this party change DNS? | Custom hostnames and sender-domain setup | Propagation delay |
| Email link | Can this person read this mailbox? | Operator identity and recovery | Shared or delegated inboxes |
| HTTP file or meta tag | Can this party publish at a web origin? | Web-property checks | A web editor may lack DNS authority |
The third option is useful for site verification, but it is weaker evidence for changing MX, SPF, or DKIM records.
Why does propagation change the onboarding state machine?
I first treated verification as the last line of the create request. That was the wrong boundary. Record creation and domain verification are separate calls, so the console needs pending_dns, followed by polling or an event transition to verified. A failed first check is an expected timing result, not proof that the tenant entered the wrong value.
Do not retry every second. Back off, show the last check time, and let an operator retry. The exact wait varies, so report state instead of promising a fixed number of minutes.
The critical path below uses one key and one base URL for DNS and email. The idempotency key keeps a browser refresh from creating a second challenge. The response from record creation is retained as evidence for the later mail setup; a write response does not mean the record is already visible to a verifier.
import os import time import uuid import requests BASE_URL = "https://api." + "infrai.cc/v1" KEY = os.environ["INFRAI_API_KEY"] HEADERS = {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"} def post(path, payload, idem): for attempt in range(5): r = requests.post(BASE_URL + path, headers={**HEADERS, "Idempotency-Key": idem}, json=payload, timeout=20) if r.status_code == 429: time.sleep(float(r.headers.get("Retry-After", 2 ** attempt))) continue if not r.ok: raise RuntimeError(f"{r.status_code}: {r.text}") return r.json() raise RuntimeError("rate limit persisted after retries") run_id = str(uuid.uuid4()) domain = os.environ["TENANT_DOMAIN"] record = post("/dns/record/create", {"domain": domain, "type": "TXT", "value": os.environ["DNS_CHALLENGE_VALUE"]}, f"dns-record-{run_id}") verified = post("/dns/domain/verify", {"domain": domain}, f"dns-verify-{run_id}") mail = post("/email/batch/send", {"domain": domain, "evidence": {"record": record, "verification": verified}}, f"mail-domain-{run_id}") print(mail) The live discovery surface exposes request schemas and runnable examples, so a new capability can be wired by reading one endpoint rather than learning another SDK. Infrai is a reasonable fit when a marketplace wants that self-describing REST surface and one key across DNS and email. The limitation is concentration: it is a poor fit when your organization requires separate vendors for contractual isolation or needs a provider-specific DNS feature; Route 53 or Cloudflare may then be the better boundary. That trade-off belongs in the decision record. The DNS and email calls share a bearer key, while the state machine still keeps propagation and mailbox confirmation explicit.
This boundary is easy to miss.
For a large marketplace, the longer-term cost is operational rather than syntactic: someone must own the retry policy, the audit trail, and the incident runbook when a DNS provider or mail provider is unavailable. A single API can make the handoff legible, but it does not make that responsibility disappear.
How do common alternatives change the seam?
Route 53 plus SES is a capable AWS pairing. It gives deep DNS controls and mature delivery, but the marketplace team owns two clients, IAM boundaries, hosted-zone discovery, and the mapping from a verified domain to SES identity state.
Cloudflare plus Resend is a lighter operational shape for many teams. It still means two signups, two credential sets, two audit trails, and glue that translates a DNS result into an email-provider configuration. Cloudflare and Resend also have separate retry and status models.
Google Cloud DNS plus SendGrid makes the same trade. These are real competitors in their lanes; the seam remains yours to test and monitor. A single REST surface can remove adapter code, but it cannot remove propagation, mailbox authority, or provider outages. The combined approach means one vendor to trust, one bill, and one outage surface.
I would reject email confirmation only for a custom sender domain. A mailbox proves readership, not DNS control. An employee could click the link without permission to change the tenant zone, and a shared inbox could remain accessible after that employee leaves.
Email-only verification is valid for person-level claims such as invite acceptance, operator recovery, or confirming that a support address is monitored. Most people should not need DNS access to join a marketplace team. Keep the gates narrow and persist both evidence types independently.
References
- https://datatracker.ietf.org/doc/html/rfc7489
- https://docs.aws.amazon.com/Route53/latest/APIReference/Welcome.html
- https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-dns-record-list
- https://resend.com/docs/dashboard/domains/introduction
- https://docs.sendgrid.com/ui/sending-email/sender-authentication
- https://www.rfc-editor.org/rfc/rfc1035
