Skip to main content
Money-moving requests should be safe to retry. If a request times out or your connection drops mid-flight, you often can’t tell whether it went through. Send an idempotency key and Spritz guarantees the operation runs at most once. A retry with the same key returns the original result instead of doing the work again.

Send an idempotency key

Add an Idempotency-Key header, a unique value such as a UUID, to any mutating request (POST, PUT, PATCH, DELETE). Reuse the same key when you retry that request.
Idempotency applies to authenticated mutating requests that include the header. GET requests are already safe to repeat, so they don’t need a key.

What happens on a retry

Scope and lifetime

A key is bound to your auth context and the exact request (method, path, and body). If you send the same key with a different body, Spritz rejects it with a 422 rather than risk returning the wrong result. Keys are remembered for 24 hours; after that, the same key is treated as new.

Error responses

Both are standard problem responses.

Best practices

  • Generate a unique key per operation, for example a UUID.
  • Reuse the same key when you retry the same operation, so the retry is deduplicated.
  • Never reuse a key for a different operation.
  • Persist the key until you’ve confirmed the outcome, so a crash and retry uses the same key.