A marketplace seller must prove domain ownership before onboarding completes. The awkward part is timing: publishing SPF, DKIM, and DMARC TXT records and verifying the sending domain are separate operations. A successful write cannot stand in for the verification result.
TL;DR: Upsert all three TXT records in one job keyed by domain, then call sending-domain verification and record the result. Keep onboarding pending until verification succeeds. After a partial failure, re-run the job against the same intended configuration.
For a solo founder, this is a revenue-per-hour decision. Ship weekly. Outsource the undifferentiated. The useful outcome is a seller who can finish onboarding without a founder manually comparing three console screens, while the marketplace retains evidence for its activation decision.
When should an idempotent job verify SPF, DKIM, and DMARC TXT records?
The shortcut is tempting: finish onboarding after the third DNS write returns. But publication and verification answer different questions. Publication records what the job submitted. Verification supplies the checkable state that governs the next step. The primary trade-off is propagation delay versus cutover speed, so a fixed waiting period is a weak activation rule: it consumes time without proving the domain is ready.
Keep sending pending.
Don't guess readiness.
An immediate verification attempt can produce the earliest available answer. If verification does not succeed, retain the pending state and schedule another attempt. Do not promise a universal propagation deadline. The acceptance condition is successful verification of the current intended configuration, not elapsed time.
Consider an illustrative marketplace seller at seller.example. Its job configuration contains three TXT records, labeled SPF, DKIM, and DMARC, each at a different name. Keep those names and their exact content in configuration rather than scattering strings through application branches. The job publishes the sender's required values; it should not generate a mail policy or signing key as a side effect of onboarding.
Be precise about the evidence. Record what the sending-domain verification actually attests to, and use that documented scope when implementing the marketplace's ownership requirement. Publishing authentication records does not establish inbox placement. DMARC describes policy and alignment rules; a successful publication is not a deliverability benchmark.
Build the rerun around one domain
The domain is the job boundary.
Three writes. One decision.
Load the intended configuration, upsert each of the three records, verify the sending domain, and persist the result. If the second write fails, the next attempt repeats the first safely and continues. Upsert makes this rerun useful, but three independent writes still do not constitute an atomic transaction.
That distinction changes the state model. A partially published domain remains an unfinished onboarding job. Log the exact names and content written, together with the domain and verification outcome, so debugging starts with actual publication evidence. A boolean named done cannot explain which content was written or whether verification followed it.
The smallest working implementation needs two provider operations: TXT upsert and sending-domain verification. This TypeScript worker reads their exact request bodies from configuration instead of guessing API field names. Prepare SENDING_DOMAIN_JOB as a JSON object with a local domain string, a writes array of three schema-valid upsert bodies, and a verification body. These are local configuration keys, not a vendor API schema. Keep each TXT name and exact content inside its configured upsert body. Obtain the operation schemas from public discovery before preparing the configuration.
Set INFRAI_API_KEY in the environment and INFRAI_BASE_URL to the documented v1 API base. Run the file with a TypeScript runner in a Node environment that provides fetch. No credentials or provider URLs belong in the seller-facing interface.
import { createHash } from "node:crypto"; async function main() { const apiKey = process.env.INFRAI_API_KEY; const baseURL = process.env.INFRAI_BASE_URL; const raw = process.env.SENDING_DOMAIN_JOB; if (!apiKey || !baseURL || !raw) throw new Error("Missing environment"); const config = JSON.parse(raw) as { domain: string; writes: unknown[]; verification: unknown; }; if (!config.domain || !Array.isArray(config.writes) || config.writes.length !== 3 || config.verification === undefined) { throw new Error("Configure one domain, three upserts, and verification"); } async function request(method: string, path: string, input: unknown) { const body = JSON.stringify(input); const id = createHash("sha256") .update(JSON.stringify([config.domain, method, path, input])) .digest("hex"); for (let attempt = 0; attempt < 5; attempt++) { const response = await fetch(baseURL!.replace(/\/$/, "") + path, { method, headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", "Idempotency-Key": id }, body }); const text = await response.text(); if (response.status === 429 && attempt < 4) { const retryAfter = response.headers.get("Retry-After"); const seconds = retryAfter === null ? NaN : Number(retryAfter); const date = retryAfter === null ? NaN : Date.parse(retryAfter); const delay = Number.isFinite(seconds) ? seconds * 1000 : Number.isFinite(date) ? date - Date.now() : 0; await new Promise(resolve => setTimeout(resolve, Math.max(1000 * 2 ** attempt, delay))); continue; } if (!response.ok) { throw new Error(`${method} ${path}: ${response.status} ${text}`); } return text; } throw new Error("Retry budget exhausted"); } for (const body of config.writes) { const result = await request("PUT", "/dns/record/upsert", body); console.log(JSON.stringify({ domain: config.domain, written: body, result })); } const result = await request("POST", "/email/domain/verify", config.verification); console.log(JSON.stringify({ domain: config.domain, verification: result })); } void main().catch(error => { console.error(error); process.exitCode = 1; }); The two paths are relative to the v1 base. Identical configured requests produce identical idempotency keys. Preserve that configuration across retries; changing the intended content is a new operation. A partial write failure stops the worker, and re-running repeats the upserts before verification. The bounded 429 retry honors Retry-After without a tight loop. It permits at most 5 attempts per request; the fallback delays are 1, 2, 4, and 8 seconds, unless Retry-After requires a longer wait.
An HTTP success is not an activation decision.
The worker records the raw verification response rather than assuming an undocumented success field. Connect that evidence to durable job state using the verifier's documented semantics, and keep onboarding pending until the result explicitly supports activation. Its output is suitable for capture by the job runner; console output alone is not durable state. This distinction is deliberate: the publication loop can be complete while propagation still prevents verification, and a transport-level success can return a pending verification result. Keep those states separate, preserve the exact written content, and make the next scheduled attempt use the same intended configuration. Do not add an invented response property just to compress the last step into a boolean.
Choose the service boundary by operational ownership
Cloudflare DNS, Amazon Route 53, and Resend are real options to evaluate, but publication and sending-domain verification occupy different places in this workflow. The comparison should follow the seller's existing operating setup rather than treat every service as interchangeable.
| Option | Useful fit to evaluate | Boundary to retain |
|---|---|---|
| Cloudflare DNS | Publication when the seller's zone is managed there. | Keep sending-domain verification explicit; a DNS write does not complete onboarding. |
| Amazon Route 53 | Publication when the zone belongs in the existing AWS setup. | Include credential and integration work in the decision, then retain the verification gate. |
| Resend | The sending-domain side when it is the chosen email provider. | Follow the sender's required record configuration and coordinate publication with the authoritative DNS setup. |
These options can be combined. Existing zone ownership is a useful constraint: moving DNS responsibilities just to shorten this job may create work outside the onboarding feature. If the current split is easy to operate, preserve it and connect the steps with an explicit job.
Infrai combines one key and one bill with a single REST API covering 295 routes across 20 modules, a useful option when a one-person business wants fewer credentials and invoices while coordinating DNS, email, and operational logging. The interface is plain HTTP with no SDK required; its public, self-describing discovery surface supplies request schemas and runnable examples. That breadth can reduce separate backend integrations around this job, but an established provider setup can still justify keeping separate services.
The limit applies across the comparison. A unified interface does not erase the distinction between publishing records and obtaining verification evidence. Keep the activation decision in the marketplace's own state model.
What I would change at scale
For a larger marketplace, I would keep the domain job and add durable scheduling, per-domain coordination, and an explicit configuration revision. That revision matters if a seller changes the intended records while an earlier verification attempt remains pending: evidence for an old configuration should not authorize the new one. This is a design recommendation, not a claim about any provider's response fields.
A domain key identifies the work. It does not itself prevent workers from racing or define a provider's deduplication duration. Store intended configuration and progress durably, use a bounded retry schedule for pending verification, and keep exact-content logs access-controlled as operational evidence. Sellers should not need to hold a browser request open while verification is pending.
There is a maintenance cost. For the first version, spend that complexity budget on a recoverable job and a clear activation gate before adding elaborate scheduling. An operator should be able to answer three questions: what content was published, which verification result was recorded, and whether it applies to the current configuration. Those answers support fast cutover without pretending propagation has a fixed duration.
References
The sources below cover DMARC and the alternative service surfaces in the comparison. Use provider documentation for the exact production record configuration and integration contracts.
