Idempotency

Safe retries for mutating requests using client-supplied keys.

Any POST, PUT, or DELETE that mutates money (payments, refunds, transfers, webhook endpoint create/update) accepts an Idempotency-Key header.

How it works

  1. Generate a unique key per logical operation — a UUIDv4 is ideal.
  2. Send it as Idempotency-Key: <value>.
  3. QashX stores the SHA-256 of the request body against the key for 24 hours.
  4. Retries with the same key + same body return the original response — no side effects.
  5. Same key + different body returns 409 idempotency_conflict.

Example

curl -X POST https://ecmxmvrimionqhpbjguc.supabase.co/functions/v1/api-v1-payments \
  -H "Authorization: Bearer $QASHX_API_KEY" \
  -H "Idempotency-Key: 7c3a1d2f-9b8e-4d5a-a1c2-4e6f8091b234" \
  -H "Content-Type: application/json" \
  -d '{
    "amount_minor": 4999,
    "currency": "EUR",
    "method_kind": "card",
    "payer": { "email": "buyer@example.com" }
  }'

Retrying this exact request within 24 hours returns the same payment.id, same status, no duplicate charge.

Best practices

Scope & TTL

AspectValue
ScopePer API key (test and live are separate).
Retention24 hours from first request.
Max key length255 characters.
Body matchSHA-256 of canonicalized JSON body.
Applies toAll mutating public API endpoints.

Idempotency composes with rate limit retries — the safest client always sends both Idempotency-Key and honors Retry-After.