Idempotency
Retry requests without sending twice.
If a request times out, you can't tell whether the message was sent. Retrying could send it twice and charge you twice. Idempotency keys prevent that.
Add an Idempotency-Key header to POST /messages and POST /messages/batch. Use a unique value, such as a UUID, for each new message, and reuse it only when retrying the same request.
curl https://api.appstractone.com/v1/messages \
-H "Authorization: Bearer $APPSTRACT_API_KEY" \
-H "Idempotency-Key: 3f1c9a52-6a5f-4b8e-9c55-0e7f1a2b3c4d" \
-H "Content-Type: application/json" \
-d '{ "to": "0241234567", "from": "MYSHOP", "text": "Your order #1042 is on its way." }'- Same key, same body: you get the original response again. Nothing new is sent or charged.
- Same key, different body: the request fails with
409and the codeidempotency_conflict.
Keys are remembered for 24 hours.