Safe retries
Retry a request without sending it twice.
A request can time out after Aloware already did the work. Retry it blindly and the contact gets the text twice, or two calls. Send an Idempotency-Key header and Aloware runs the request once, however many times you send it.
How it works
- Make up a key for each action you want done once, up to 255 characters. A UUID, or your own record ID plus the date, works well.
- Send the same key every time you retry that action, with the same body.
- A repeat within 24 hours gets the first answer back, with the header
Idempotent-Replayed: true, and nothing runs again. - Only successful answers are kept. If the first try failed, a retry with the same key runs again.
Header
Example
Answers to watch for
- 409: the first request with this key is still running. Wait, then try again.
- 409 for longer than 5 minutes: the first request never finished, and repeats keep getting 409 for up to 24 hours. Check whether it took effect, then retry with a new key.
- 422: you reused a key with a different body. Use a new key for a different action.
Endpoints that take the key
GET requests only read, so they don't need a key.
Need another endpoint?
For other API functions or any question about this one, email support@aloware.com with what you're trying to do.
Need a hand?
Our support team can help you set this up.