Idempotency▾
Idempotency
Send Idempotency-Key so a retried POST cannot deliver the same message twice.
Any POST accepts an Idempotency-Key header. Repeating a request with the same key returns the original response instead of performing the action again. Keys are scoped to your account and retained for 24 hours.
cURL
curl -X POST https://api.sendport.tech/v1/messages \
-H "Authorization: Bearer $SENDPORT_KEY" \
-H "Idempotency-Key: 7f8b1c02-4d5e-4a91-b3e0-0c1a2b3c4d5e" \
-H "Content-Type: application/json" \
-d '{"to":"+201005550123","type":"text","text":{"body":"Hi"}}'Use a UUID per logical action
Generate the key when the action is created — an order id plus event name works well — not per HTTP attempt, or the retry gets a fresh key and sends twice.
| Situation | Result |
|---|---|
| Same key, same body | The original response, with Idempotent-Replay: true |
| Same key, different body | 409 idempotency_key_reused |
| Key older than 24h | Treated as new |