Skip to main content
All POST, PATCH, and DELETE requests accept an Idempotency-Key header. Retry with the same key and Deck returns the original response instead of performing the operation again. GET requests are naturally idempotent and do not require a key.

How it works

Include an Idempotency-Key header on any POST, PATCH, or DELETE request.
When Deck receives a request with an idempotency key and the request succeeds, it caches the response and associates it with that key. Only successful responses are cached. If the original request returned an error, retrying with the same key will execute the request again. Keys are scoped to your organization, so different organizations can use the same key independently. If the same key is sent again:
  • Same parameters: Deck returns the cached response. The operation is not repeated.
  • Different parameters: Deck returns a 409 Conflict with an idempotency_error to prevent accidental misuse.
  • After 24 hours: the key expires and can be reused.

When to use them

Use idempotency keys on any create operation where a duplicate would cause problems: You don’t need idempotency keys for GET requests. Reads are naturally idempotent.

Key format

Keys can be any string up to 256 characters. Keys longer than 256 characters are rejected with a 400 error.
Common patterns:

Generating keys

Retry pattern

A typical retry flow with idempotency:
The key stays the same across retries. If the first request succeeded but the response was lost, the second request returns the cached result. If the first request failed or never reached the server, the second one executes normally since only successful responses are cached.

Error handling

Key reuse with different parameters returns HTTP 409:
If you see this error, use a new key for the new request. Key exceeds 256 characters returns HTTP 400: