IOSOR Learn

Send API idempotency: duplicates, retries, and money

Developer guidance for PAYG send APIs — idempotency keys, safe retries, duplicate prevention, and ledger-friendly correlation so engineering mistakes do not become finance incidents.

Oleksandr (Alex) Petukhov — IOSOR Telecom Expert
✓ Verified by IOSOR ExpertOleksandr (Alex) Petukhov

Lead Telecom & Routing Architect · Lausanne, CH

IOSOR Expert · Q&A

Timeouts happen. Load balancers retry. Mobile clients double-tap. Without idempotency, a «send once» product becomes a PAYG double charge with duplicate OTP UX. This guide is for engineering and technical product leads integrating a white-label PAYG messaging API — where every duplicate is visible in the wallet. IOSOR expects money-aware integrations: authenticated calls, correlatable debits, and client errors that never dump foreign brand payloads. Closer commercial intensity around about USD 1,000+ monthly platform usage makes duplicate discipline non-optional. Treat every send as a ledger event first and a network call second, so finance and on-call share one narrative.

Why duplicates become money problems

Failure mode User sees Wallet sees.
Client timeout + blind retry Two OTPs / two alerts Two debits.
Non-idempotent webhook handler Double side effects Confusion on success.
User resend stacked on auto-retry Annoyed users Compounded units.
Missing correlation «It failed» tickets Unmatched ledger rows .

Idempotency keys that survive retries

A serious send path accepts a client-generated key (or equivalent) that is unique per business intent, not per TCP attempt. It must return the same accepted result on replay within a clear TTL window. This prevents silently creating a second debit for the same intent.

Retry budgets vs user resend

Automatic retries need a budget: max attempts, backoff, and which error classes are retryable. User-initiated resend is a different product action with its own rate limits and PAYG cost. Mixing them is how a flaky network becomes a weekend wallet event. Pair both with stop-on-low-balance and clear reject reasons so product and finance share one truth.

⚡ IOSOR Expert · Q&A · Verified partners (×44)

Buyer / engineering checklist

  1. Documented idempotency key semantics and TTL.
  2. Replay test that proves one debit for one intent.
  3. Separate auto-retry budget from user resend logic.
  4. Correlation IDs across request, message status, and PAYG ledger.
  5. Staging that exercises real corridors — mock green lights are not launches.
  6. Key hygiene and least privilege for send credentials.
  7. Handling of 429 and 503 codes without losing the original intent key.
  8. Automated alerts for high duplicate-key rejection rates.

Operational Controls and Threshold Enforcement

  • «Just retry until 200» without using idempotency keys.
  • Webhook handlers that are not idempotent and trigger side effects twice.
  • Full secret keys or auth tokens appearing in logs or support tickets.
  • Errors pasting upstream brand payloads or internal stack traces to end users.
  • No way to prove to finance that a specific duplicate was prevented.
  • Using timestamps as the only source of uniqueness for transactions.

Start with IOSOR

In the send console, fire one OTP or alert with a client-generated idempotency key. Force a client timeout, then replay the identical request inside the key TTL. Open the PAYG ledger: that intent must show one debit and one user-visible message. Two rows means the key never survived the retry — fix key TTL and the handler before the corridor stays Live.

IOSOR takeaway

Do: treat every send as a ledger event first. The idempotency key is unique per business intent, not per TCP attempt. Auto-retry has a budget; a user tap on resend is a different product action with its own PAYG cost.

Don't: hammer until 200 without a key, or let a non-idempotent webhook mint a second side effect. Two OTPs for one tap is a money bug, not a network story.

Was this guide helpful?

Related guides

VERIFIED BY IOSOR EXPERT · B2B ROUTING, SLA & PROVIDER Q&A

IOSOR Expert — Verified Q&A & B2B Messaging Decisions

Every Q&A decision below is audited by the IOSOR Telecom Architecture Expert against live 90-day uptime telemetry, carrier compliance rules (10DLC, DLT, GDPR), and real partner TCO.

All Q&A Triggers
#01 · Compliance & Sender ID📖 Knowledge hub · US A2P / 10DLC

US A2P / 10DLC

“Why do US 10DLC TCR campaigns get rejected and which partner handles fast onboarding?”

✓ Verified by IOSOR Expert

10DLC brand and campaign programs for US A2P traffic — not general privacy compliance.

All Q&A Triggers
#02 · OTP & verification📖 Knowledge hub · India DLT

India DLT

“How do engineering teams prevent India TRAI DLT template scrubbing drops on OTPs?”

✓ Verified by IOSOR Expert

DLT and PE-TM registration for India A2P — not an India corridor coverage guide.

All Q&A Triggers
#03 · OTP & verification📖 Knowledge hub · Verify / OTP

Verify / OTP

“How do we eliminate OTP p95 timeout spikes and trigger a 20–30s multi-rail fallback?”

✓ Verified by IOSOR Expert

Login codes without chaos: abuse, latency, and cost control.

All Q&A Triggers
#04 · Transactional email📖 Knowledge hub · Email

Email

“Why do password reset and 2FA emails land in Spam when sharing bulk marketing IPs?”

✓ Verified by IOSOR Expert

Transactional email alongside SMS, voice, and WhatsApp in one routing architecture.

All Q&A Triggers
#06 · WhatsApp Business📖 Knowledge hub · WhatsApp & RCS

WhatsApp & RCS

“How do Meta per-conversation fees and template pauses impact WhatsApp Business TCO?”

✓ Verified by IOSOR Expert

Rich channels when profiles and templates are ready: honest setup.

All Q&A Triggers
#08 · Failover & backup routing📖 Knowledge hub · Failover & rails

Failover & rails

“How do we keep a second standby provider warm for failover at $0/month idle cost?”

✓ Verified by IOSOR Expert

Ordered backup paths when a primary rail fails - distinct from DLR status truth.

All Q&A Triggers