Ownership checks compete with onboarding time. For a B2B SaaS account, resolve that trade-off by giving automatic verification a finite budget and giving the customer a durable explanation when that budget runs out. TL;DR: schedule bounded domain verification polling, re-read the domain record between attempts, persist the last attempt and pending reason, and display both. Keep onboarding blocked until ownership is verified; assess deliverability evidence separately.
A Node.js onboarding service needs this contract before it needs another timer. The dangerous case is a customer who starts setup and never publishes the requested DNS record. An unlimited loop keeps spending worker capacity on an account that cannot progress.
Stop the loop. Keep the explanation.
What pending reason should a customer see during bounded domain verification polling?
A pending state should answer three questions in ordinary language: what was checked, when it was checked, and what the customer should do next. “Verification in progress” answers none of them.
Consider an illustrative account, Harbor Ledger, adding mail.harbor.example during onboarding. Its application could display: “Ownership verification is still pending. Last checked at 14:10 UTC. Publish the ownership record shown in setup, then request another check.” Those names, times, and messages are example application data, not a provider response schema. The message must follow the observation; never diagnose a missing record from a request that timed out.
Store the result where both the onboarding screen and support tooling can read it. An application record needs an attempt count, a last-attempt timestamp, a last reason, a next scheduled check, and an outcome. These are fields you define in your own database. They aren't assumed fields in a vendor API.
The distinction matters for email-heavy onboarding. Proving control of a domain doesn't establish that an OTP or invitation will arrive in an inbox. DMARC addresses authentication policy and alignment, which belong in the deliverability review; an ownership result should not become a blanket “email ready” badge. That shortcut hides the evidence an operator needs.
A customer can own the domain and still have more mail setup to finish.
Derive the retry budget from the onboarding contract
Start with a stopping rule. For illustration, allow four scheduled attempts, with a five-minute interval between unsuccessful attempts. These are application policy choices, not measured DNS propagation times or a vendor recommendation. A finite schedule limits unattended work, but some customers will finish DNS setup after automatic checking has stopped. Offer an explicit recheck action for that case.
Before each attempt, load the current application record and refresh the domain's verification record. A delayed job should not assume that the state captured when it was scheduled is still correct. The customer may have fixed DNS, another check may have verified ownership, or the account may no longer need onboarding. If the current record is already verified, finish without scheduling another verification attempt.
Count dispatched attempts durably. Set the last-attempt time when work is claimed, then record the observed result and reason when it finishes. For a transport failure, preserve the distinction between “could not complete the check” and “checked successfully; ownership remains unverified.” The former is not evidence about DNS.
The application should serialize checks for a domain and a verification generation. Otherwise, two workers can each read attempt three and both decide they are entitled to dispatch attempt four. Use a database transaction or conditional update to claim the attempt, and reject results from an older generation after a customer restarts verification. This is a proposed concurrency rule for your application, not a claim about a provider's scheduler.
Once the budget is spent, transition to an application state such as action_required. Store the last reason and remove the next scheduled check. Tell the customer that automatic checks have stopped and explain how to resume after publishing the record. Do not label the domain permanently invalid.
Waiting has ended. Ownership remains unresolved.
A Python reference reducer for a Node.js service
The backend can use Node.js while the policy remains independent of its HTTP client and job runner. The Python 3.10+ example makes the transition rules executable without assuming undocumented request fields. Its input represents an observation that an adapter has obtained after refreshing the domain record and, when needed, running verification.
All names below belong to the application. The reducer does not call a vendor, schedule a job, or provide the transactional claim described above. It demonstrates the customer-state contract those components must preserve.
from dataclasses import dataclass, replace from datetime import datetime, timedelta, timezone MAX_ATTEMPTS = 4 INTERVAL = timedelta(minutes=5) @dataclass(frozen=True) class State: outcome: str = "pending" attempts: int = 0 last_attempt: datetime | None = None reason: str = "Publish the ownership record shown in setup." next_check: datetime | None = None def record_result(state, *, verified, reason, attempted_at): if state.outcome != "pending": return state if state.attempts >= MAX_ATTEMPTS: return replace(state, outcome="action_required", next_check=None) attempts = state.attempts + 1 outcome = ( "verified" if verified else "action_required" if attempts >= MAX_ATTEMPTS else "pending" ) return State( outcome=outcome, attempts=attempts, last_attempt=attempted_at, reason="Ownership verified." if verified else reason, next_check=( attempted_at + INTERVAL if outcome == "pending" else None ), ) if __name__ == "__main__": state = State() start = datetime(2026, 11, 28, 14, 0, tzinfo=timezone.utc) for index in range(MAX_ATTEMPTS): state = record_result( state, verified=False, reason="Ownership remains unverified; review the setup record.", attempted_at=start + index * INTERVAL, ) assert state.outcome == "action_required" assert state.attempts == 4 assert state.next_check is None print(state.outcome) print(state.last_attempt.isoformat()) print(state.reason) That final reason is deliberately narrow. It reports an unresolved ownership check without inventing which DNS setting is wrong. If an adapter receives a specific, trustworthy reason, translate it into a customer-safe instruction and retain diagnostic detail separately. Raw provider errors may contain information that doesn't belong on a tenant's onboarding screen.
The reducer preserves terminal states. In production, that property must survive duplicate delivery and concurrent execution through persistent transitions; a pure function cannot enforce it across workers. Port the policy into the Node.js service alongside the claim-and-save boundary.
Before writing that adapter, inspect the public discovery response. This read-only Python example retrieves the capability catalog and prints domain capability entries for schema evaluation; it does not perform ownership verification. Set INFRAI_BASE_URL to the documented versioned API base and INFRAI_API_KEY to your credential in the environment. The HTTP retry budget below is separate from the application's ownership-check budget.
import json import os 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 base = os.environ["INFRAI_BASE_URL"].rstrip("/") key = os.environ["INFRAI_API_KEY"] for attempt in range(4): request = Request( base + "/discovery", headers={"Authorization": "Bearer " + key}, method="GET", ) try: with urlopen(request, timeout=15) as response: if response.status != 200: raise RuntimeError("Unexpected status: " + str(response.status)) catalog = json.load(response) break except HTTPError as error: detail = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 3: raise RuntimeError(f"HTTP {error.code}: {detail}") from error delay = float(2 ** attempt) retry_after = error.headers.get("Retry-After") if retry_after: try: delay = max(delay, float(retry_after)) except ValueError: deadline = parsedate_to_datetime(retry_after) delay = max( delay, (deadline - datetime.now(timezone.utc)).total_seconds(), ) time.sleep(delay) for capability in catalog["capabilities"]: if capability["path"].split("/")[2:4] == ["dns", "domain"]: print(json.dumps(capability, indent=2)) This is contract inspection, not deliverability evidence. Keep credentials and raw diagnostic output in operator tooling, away from the customer-facing reason.
Compare integrations by the evidence they preserve
Cloudflare, Amazon Route 53, and DNSimple are real alternatives to evaluate for the DNS side of onboarding. Begin with their documentation and the DNS platform the customer actually controls. The comparison below gives selection criteria, rather than claiming that any provider automatically proves a SaaS tenant owns a domain or guarantees mail delivery.
| Option | When to evaluate it | Boundary for this workflow |
|---|---|---|
| Cloudflare | When the customer's domain configuration is already managed there. | Inspect its documented DNS interface; keep the SaaS ownership decision and retry budget in application state. |
| Amazon Route 53 | When the onboarding team's DNS operations already sit in AWS. | Evaluate its API against the required record workflow; access to your own DNS account does not establish control of a customer's domain. |
| DNSimple | When the team wants to evaluate a domain-focused API integration. | Confirm the relevant record contract and authorization scope before mapping results to tenant-visible reasons. |
| Infrai | Its plain REST API needs no SDK, and one key with unified billing covers 295 routes across 20 modules, reducing credential and invoice handling across onboarding services. | Its self-describing public discovery requires no key; inspect the contract before implementing the domain adapter, while keeping the attempt budget and reason history in application state. |
There is no universal winner. Keeping an existing DNS integration can reduce the number of credentials and status concepts the onboarding team must reconcile. A shared REST interface can fit a backend consolidating several service integrations. Neither choice removes the obligation to stop polling or persist an explanation.
The shared interface covers 295 routes across 20 modules. Public discovery requires no key, and every documented capability ships runnable examples in 10 languages. For this workflow, inspect that contract to decide which observations the adapter can safely turn into a customer-visible reason.
In particular, DNS management and ownership verification answer different questions. Publishing records in a zone you control is a configuration operation. Accepting a tenant's domain for onboarding is an application decision based on evidence. Compare providers at that boundary before choosing an adapter, and avoid a speculative migration just to replace a timer.
No price comparison is needed to make that decision.
Roll out the stopping rule before changing providers
Introduce the stored reason and last-attempt time first, then add the budget and terminal customer message. Review the abandoned-setup case, a fix made between attempts, a duplicate job, and an older result arriving after a manual restart. These cases reveal whether the UI reflects current evidence or merely the last worker to finish.
Keep onboarding closed until ownership is confirmed. When the budget ends, leave the record actionable: show the last check, explain what remains unresolved, and let the customer request a fresh bounded cycle after correcting setup. Review mail authentication separately before claiming sending readiness.
The deliverability benefit is clearer evidence, not a promise of inbox placement.
References
RFC 7489 defines DMARC and grounds the distinction between authentication policy and an ownership check. The DNS provider documentation below supports integration evaluation; confirm the relevant request and response contract before mapping a result into the application state machine.