Reference
Idempotent requests
Networks fail. If a request to send times out, you cannot know whether it was accepted. Send POST /v1/messages and POST /v1/batches with an Idempotency-Key header, and retry with the same key.
curl https://bulksmsapi.cc/v1/messages \
-H "Authorization: Bearer $BULKSMSAPI_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-55102-shipped" \
-d '{"to": "+14155550123", "text": "Order 55102 has shipped."}'Rules
- A key is any string up to 255 characters. Use something that names the event: an order id and step, or a UUID made before the first try.
- An accepted request (202) is remembered for 24 hours per account. The same key with the same body returns the first answer again, with the header
Idempotent-Replayed: true, and sends nothing. - The same key with a different body answers
409 idempotency_conflict. - Requests that fail with an error are not remembered, so you can fix them and retry with the same key.