Introducing idempotency key support in Zoho CPaaS
Network timeouts and transient connection drops are an unavoidable reality in distributed systems. When a transactional message request times out, your application faces a familiar dilemma: Retry the request and risk sending duplicate OTPs, order confirmations, and automated voice calls, or just hold back and risk not delivering critical information at all.
With idempotency key support now live in Zoho CPaaS, you no longer have to choose between reliability and duplicate prevention. You can safely retry failed or timed-out requests across email (API and SMTP), SMS, WhatsApp, and voice without worrying about double-sending.
What is an idempotency key?
An idempotency key is a unique string or identifier like a UUID (Universally Unique Identifier) that a client generates and attaches to an API request so the server can safely recognize and ignore accidental duplicate submissions.
Let’s understand this better with an example. Imagine you’re sending an OTP email, but your internet connection drops before you receive a response. You’re unsure whether the email was sent, so you retry the request. Now, the recipient may receive the same OTP email with the same code twice. But, with an idempotency key attached, Zoho CPaaS recognizes the retry as the same request and blocks the duplicate send.
How does it work?
When Zoho CPaaS receives a request with an idempotency key, it checks whether that key has already been processed within a 24-hour window.
First submission: Zoho CPaaS processes the request normally and records the key.
Subsequent retries with the same key: If a network glitch forces your app to retry within 24 hours, Zoho CPaaS recognizes the key, blocks the duplicate submission, and returns a TM_7001 (Request Denied–Duplicate idempotency key found) response so no duplicate message or call goes out.
Supported channels for idempotency keys in Zoho CPaaS
Idempotency keys work across all channels in Zoho CPaaS. This covers all of the send APIs, including single and batch email, template-based email, voice calls, SMS, and WhatsApp messages.
Idempotency keys are supported across all Zoho CPaaS sending endpoints (both /v1.1/ and earlier version /v1.0/).
Channel | Endpoint/protocol | How to pass the key |
Email (REST API) | /v1.1/email, /email/batch, /email/template, /email/template/batch | “idempotency_key” in JSON body |
Email (SMTP) | SMTP relay submissions | x-tm-idempotency-key email header |
SMS | POST /v1.1/sms | “idempotency_key” in JSON body |
POST /v1.1/whatsapp | “idempotency_key” in JSON body | |
Voice | POST /v1.1/voice | “idempotency_key” in JSON body |
How do you use the idempotency key?
1. When using it in a REST API request (email, SMS, WhatsApp, voice)
Include the idempotency_key string parameter (up to 100 characters) directly in your POST request payload:
{
"from": { "address": "notifications@example.com" },
"to": [{ "email_address": { "address": "user@example.com" } }],
"subject": "Your order has shipped",
"htmlbody": "<p>Your order is on its way.</p>",
"idempotency_key": "bc432346-67cf-4671-a572-ae2d0c27e4f2"
}
2. When using it with SMTP email relay
Add the x-tm-idempotency-key header (up to 100 characters) to your message headers:
From: notifications@example.com To: user@example.com Subject: Your order has shipped x-tm-idempotency-key:bc432346-67cf-4671-a572-ae2d0c27e4f2 <p>Your order is on its way.</p> |
Best practices for reliable retries
Generate a unique key per distinct event: Use UUIDs or deterministic event IDs (like invoice-1042-reminder) so separate messages never collide.
Keep the same key across retries: Ensure your retry worker reuses the exact same idempotency_key when re-attempting a timed-out request.
Stay within the the 100-character limit and 24-hour window: Keys exceeding 100 characters return a TM_8001 (Size Exceeded) error, and deduplication remains active for 24 hours after the initial request.
Wrapping up
One network timeout shouldn’t turn into three identical OTPs or duplicate order confirmations. Adding an idempotency key takes seconds, saves you from building custom safeguards, and keeps your customer experience spotless when things go sideways.
Ready to make your transactional messaging, email, and voice workflows retry-safe? Check out the Zoho CPaaS idempotency key documentation to get started.
We hope this feature helps keep your critical transactional communications retry-safe and reliable. We’re always working to make your Zoho CPaaS experience even better. In the meantime, follow us on X and LinkedIn for the latest updates and tips!




Comments