Send your own unique key in the X-F2S-Duplicate-Key header (for GET requests you can send it as the f2s_duplicate_key parameter instead). If the same request with the same key reaches us again within 48 hours, nothing is sent or charged again. You get the first reply back with HTTP 200 and "duplicate_request": true.
Works on SMS, OTP (send and resend), WhatsApp, RCS, Voice and Campaign start/event APIs. Use a new key for every new message.
POST https://www.fast2sms.com/dev/bulkV2
Authorization: YOUR_API_KEY
X-F2S-Duplicate-Key: invoice-1045-sms| Case | Reply |
|---|---|
| Same key, first request still running | HTTP 200, "status": "processing" |
| Same key, different request | HTTP 422, nothing sent |
| First request was refused (wrong data, low balance) | Key is not used, you can retry with it |
| First request failed with a server error | Same error code, "return": false, not sent again (check reports or use a new key) |
Add X-F2S-Always-200: true to get error replies with HTTP 200 and the real code in http_status.
