Firsty

Search...

Search...

API errors

Idempotency key reused

This X-Idempotency-Key was already used with a different request body within the last 48 hours.

422application/problem+json

What it means

An idempotency key pins one exact request for 48 hours: a replay with the same key must carry an equivalent body to receive the original cached response. This key arrived with a body that fingerprints differently from the one it was first used with, so the API refused rather than guess which request you meant.

422 · application/problem+json
{
  "type": "https://developers.firsty.app/errors/idempotency-key-reused",
  "title": "Idempotency key reused",
  "status": 422,
  "detail": "This idempotency key was already used with a different request body."
}

How to handle it

  1. Generate a fresh key (a UUID works well, up to 255 characters) for every logical operation. Reuse a key only to replay the identical request.

  2. Never derive keys from something that repeats, like a user id or an order number alone. Two different requests will collide on the same key.

  3. If you intended a replay, diff the body against the original. Bodies are compared by canonicalized JSON, so key order does not matter but values do.

Related