Idempotency
Retry create requests safely with the Idempotency-Key header.
Five operations accept an Idempotency-Key header, so a retry after a
timeout does not create a second copy:
- create_project
- create_app
- trigger_deploy
- rollback_deploy
trigger_backup
The key is any string of 1 to 255 visible ASCII characters, such as a UUID you generate per attempt. Keys are kept per API key.
POST /v1/clusters/{cluster_id}/apps/{app_id}/deploys
Authorization: Bearer $ALC_API_KEY
Idempotency-Key: 9f3c6c2e-2d4b-4b7e-a1f0-6e5d8c7b9a10
Content-Type: application/json
{ "strategy": "rolling" }How a retry is answered
| The retry | The answer |
|---|---|
| Same key and body, within 24 hours | The first response again, with Idempotent-Replayed: true. |
| Same key, different body | 422. |
| Same key while the first request still runs | 409. Wait and retry. |
| Same key after the first request failed | Runs again: a failed request does not keep its key. |
Requests without the header run normally.