IDEMPOTENCY
Retry without fear of duplicates.
A flaky network should not create two quotes. Send an Idempotency-Key on any POST, PATCH or DELETE: if the request repeats with the same key and body, Cord returns the original response, marked Idempotent-Replayed, instead of running twice. If the body changed, you get an explicit error.
- Works on every mutation under /api/v1
- The replayed response is identical, byte for byte
- Same key with a different body: an error, never a silent duplicate
# 1st attempt: the quote is created
POST /api/v1/cotizaciones
Idempotency-Key: pedido-7781
← 200 { "data": { "folio": "COT-0150", … } }
# 2nd attempt (network dropped): same key, same body
POST /api/v1/cotizaciones
Idempotency-Key: pedido-7781
← 200 Idempotent-Replayed: true
{ "data": { "folio": "COT-0150", … } }
# the same response, byte for byte
# same key, different body
← 422 { "error": "Esta clave de idempotencia ya se usó con otra petición.",
"code": "idempotency_key_reused" }
# the first request is still running
← 409 { "code": "idempotency_in_progress" }