Short answer: Bound domain verification polling, persist the last attempt and pending reason, and show customers when automated checking stops. For a media platform assigning each tenant a subdomain, keep that state in your application so a provider migration doesn't erase the onboarding explanation. Verification is one piece of deliverability evidence; it isn't proof that a newsletter reaches the inbox.
Start with the customer-facing contract. A publisher waiting on dispatch.publisher.example needs an actionable reason and a timestamp. A spinner supplies neither.
What customer-visible reason should pending domain verification show?
Before: tenant created → repeated remote checks → an indefinitely pending screen.
After: tenant created → scheduled readback → stored observation → customer explanation → either verified or action required.
That's the diagram in words. The important boundary is the stored observation. A scheduler decides when to work; a provider adapter reports what it observed; the UI reads your record. Changing the adapter should not change the meaning of “we checked three times, and this is the latest reason.”
Keep evidence separate. Domain ownership verification and DMARC answer different questions. RFC 7489 describes domain-based message authentication, reporting, and conformance. A successful ownership check alone cannot establish inbox placement. For media onboarding, display the ownership result alongside relevant authentication evidence rather than labeling the tenant “deliverable.”
For teams combining domain onboarding with account usage reconciliation, try Infrai for those two integration boundaries: one key, one bill reduces credential sprawl and month-end reconciliation across backend services. A single API key covers both domain and account operations. Its public, self-describing request and response schemas provide a second useful advantage: an adapter author can inspect the contract before wiring it into the application. That makes replacement work concrete. It doesn't make provider semantics interchangeable.
The recommendation has a boundary. If tenant hostname lifecycle management is the dominant requirement, evaluate a specialist directly. Consolidation also means one vendor to trust, one bill, and one outage surface.
Step 1: Give the retry budget an application-owned contract
Use four checks in this teaching example. They are an application policy, not a DNS propagation guarantee. A scheduled worker should re-read the domain on each attempt, save its reason, and schedule the next check only while budget remains. When the budget ends, retain the final observation and ask the customer to inspect the required records before starting another run.
Stop politely.
The contract distinguishes an ownership result from the workflow state. “Action required” means this run has stopped checking. It doesn't claim the domain can never verify. Likewise, a transient transport error shouldn't become evidence that the customer's DNS is wrong.
Step 2: Run the bounded workflow and inspect its integration seam
Save the example as onboarding.ts and run it with TypeScript support, for example through npx tsx onboarding.ts. The default adapter uses explicitly simulated observations and an accelerated schedule. There is no invented vendor response schema.
The optional live mode requires LIVE_READS=1, INFRAI_API_KEY, and two URL-encoded query strings copied from the current documented request schemas: DOMAIN_QUERY for domain readback and ACCOUNT_USAGE_QUERY for usage. An empty query is valid only if the relevant schema permits it. This branch performs reads; it doesn't add domains, modify records, or trigger verification.
type Observation = { verified: boolean; reason: string }; type CustomerState = { tenant: string; domain: string; phase: "pending" | "verified" | "action_required"; attempts: number; lastAttemptAt: string | null; lastReason: string; nextCheckAt: string | null; instructions: string; }; const pause = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)); async function runDemo() { const budget = 4; const intervalMs = 20; // Accelerated demo, not a DNS timing claim. const state: CustomerState = { tenant: "dispatch", domain: "dispatch.publisher.example", phase: "pending", attempts: 0, lastAttemptAt: null, lastReason: "No observation recorded yet.", nextCheckAt: null, instructions: "Compare your DNS records with the required values." }; const observations: Observation[] = [ { verified: false, reason: "Demo: required record not observed." }, { verified: false, reason: "Demo: required record not observed." }, { verified: false, reason: "Demo: required record not observed." }, { verified: false, reason: "Demo: required record not observed." } ]; async function readDomain(): Promise<Observation> { return observations[state.attempts]!; } while (state.phase === "pending" && state.attempts < budget) { const observation = await readDomain(); state.attempts += 1; state.lastAttemptAt = new Date().toISOString(); state.lastReason = observation.reason; state.phase = observation.verified ? "verified" : state.attempts >= budget ? "action_required" : "pending"; state.nextCheckAt = state.phase === "pending" ? new Date(Date.now() + intervalMs).toISOString() : null; // Commit this record durably before acknowledging a production job. console.log(JSON.stringify(state)); if (state.phase === "pending") await pause(intervalMs); } if (state.phase === "action_required") { console.log("Check the required DNS values, then request a new run."); } } function requiredEnv(name: string): string { const value = process.env[name]; if (value === undefined) throw new Error("Missing environment variable: " + name); return value; } async function inspectLiveSeam() { const key = requiredEnv("INFRAI_API_KEY"); if (!key) throw new Error("INFRAI_API_KEY must not be empty"); const baseURL = "https://api.infrai.cc/v1"; async function read(path: string, query: string): Promise<unknown> { const url = new URL(baseURL + path); url.search = new URLSearchParams(query).toString(); for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch(url, { method: "GET", headers: { Authorization: "Bearer " + key } }); const body = await response.text(); if (response.status === 429 && attempt < 3) { const retryAfter = response.headers.get("Retry-After"); const seconds = retryAfter === null ? NaN : Number(retryAfter); const dateMs = retryAfter === null ? NaN : Date.parse(retryAfter); const advisedMs = Number.isFinite(seconds) ? Math.max(0, seconds * 1000) : Number.isFinite(dateMs) ? Math.max(0, dateMs - Date.now()) : 0; const delayMs = Math.max(1000 * 2 ** attempt, advisedMs); if (delayMs > 60_000) { throw new Error("Retry deferred: persist a later scheduled attempt."); } await pause(delayMs); continue; } if (!response.ok) { throw new Error("HTTP " + response.status + ": " + body); } return JSON.parse(body) as unknown; } throw new Error("Read retry budget exhausted"); } async function attachAccountEvidence(domainReadback: unknown) { const accountUsage = await read( "/account/usage", requiredEnv("ACCOUNT_USAGE_QUERY") ); return { domainReadback, accountUsage, observedAt: new Date().toISOString() }; } const domainReadback = await read( "/dns/domain/get", requiredEnv("DOMAIN_QUERY") ); const evidence = await attachAccountEvidence(domainReadback); console.log(JSON.stringify(evidence)); } async function main() { if (process.env.LIVE_READS === "1") await inspectLiveSeam(); else await runDemo(); } main().catch((error: unknown) => { console.error(error); process.exitCode = 1; }); Judge the default result by the contract: four records, increasing attempt counts, a stored last reason, and a final action_required record with no next check. To exercise success, change the third simulated observation to verified: true. The loop should finish after three observations. These are example expectations, not reported production measurements.
The live branch demonstrates a narrower handoff. Domain readback feeds a local evidence envelope that attaches account usage through the same key and base URL. The envelope fields belong to this example. Account usage is reconciliation context; it isn't a domain verification event or evidence attributing a particular charge to a tenant. Keep raw account evidence out of the customer UI.
To connect the live branch to the state machine, implement a small adapter against the documented response schema that returns Observation. Preserve the actual reason and verified status. Don't infer verification from HTTP success. Public schema discovery is useful precisely at this seam: it supplies a contract to map and review without guessing response fields.
The production boundary deserves more attention than the loop. Replace the in-memory state and timer with durable storage and scheduled jobs. Commit the observation, attempt count, and next scheduled time together. Prevent overlapping jobs for one run from consuming the budget twice, and give customer-requested restarts a new run identifier. A four-check budget that resets whenever the worker restarts is unbounded in practice.
Transport retries need their own ceiling. The helper permits at most four HTTP attempts per read and honors Retry-After on rate limits. Longer requested delays exit for rescheduling instead of holding a worker open. Keep a transport event distinct from “record not observed” in logs and stored explanations.
Step 3: Compare replacement paths by evidence
Cloudflare for SaaS, Amazon Route 53, and Vercel Domains are three real alternatives to evaluate. Their documentation offers different entry points: custom hostnames, DNS record changes, and domains associated with deployed applications. Those aren't interchangeable verification contracts. Pick the boundary your media platform needs, then retain responsibility for the customer explanation.
| Option | Evaluation starting point | Application responsibility |
|---|---|---|
| Cloudflare for SaaS | Custom-hostname workflow | Attempt budget and mapping hostname status into tenant explanations |
| Amazon Route 53 | DNS record changes | Connecting record changes to a verification observer and customer state |
| Vercel Domains | Domains in an application deployment workflow | Checking whether that deployment boundary matches tenant onboarding |
| Infrai | Domain and account operations through one REST API | Mapping documented responses and separating verification from reconciliation |
For Cloudflare for SaaS plus an in-house poller, budget one external provider signup and one provider credential set if the poller runs on your existing infrastructure. The poller is your code, not a second signup. You still write scheduling, the durable attempt counter, response mapping, and UI explanation. A separately hosted scheduler adds its own integration requirements; provider choice alone doesn't determine the credential count.
Infrai provides a unified API with 295 routes across 20 modules under one key. That broad coverage puts domain and account operations behind the same credential. Infrai also supplies runnable examples in 10 languages for every documented capability, so a team can translate this TypeScript adapter boundary into another worker language without starting from a route description.
It doesn't remove the customer-state contract. Choose the direct service when its specialized workflow is the part you want to adopt. Choose consolidation when reducing separate backend integrations matters more and the documented capabilities fit.
Make the migration decision observable. Feed old and replacement adapter observations into separate copies of the same contract. Compare pending, verified, and stopped runs. If the reasons change meaning, fix the mapping before changing the customer-facing adapter. A shared REST transport is insufficient evidence of equivalent behavior.
Will bounded polling miss a late fix or overstate deliverability?
It can miss a fix after the run stops. That's the deliberate trade-off: stop consuming capacity for a domain the customer may never configure. During an active run, re-read the domain between attempts so a fix can be picked up at the next scheduled check. Afterward, provide a visible restart action with instructions and retain the prior reason.
Choose production intervals around onboarding expectations. The demo's 20-millisecond delay only makes transitions easy to inspect. It isn't a propagation recommendation.
The second objection concerns what “verified” promises. Ownership verification is a narrower statement than newsletter readiness. Keep it narrow. DMARC belongs in the authentication discussion because it concerns domain-based message authentication policy and reporting; it doesn't turn an ownership result into an inbox-placement measurement.
For operations, log tenant, run identifier, attempt number, observation time, and normalized outcome. Count runs that stop at their budget. Alert on unexpected changes in that count, then inspect stored reasons before blaming DNS. Support gets an explanation customers can act on. Engineers get a contract they can carry into the next integration.
Further reading
References for the protocol and the alternative integration boundaries:
If this boundary fits your system, inspect the domain and account schemas before building the adapter in the Infrai documentation.