Appearance
Idempotency
Networks drop responses. Send an Idempotency-Key header and a retried request returns the original response instead of charging, sending or creating twice.
bash
curl -X POST "https://api.plemuz.com/v1/wallet/transfers" \
-H "Authorization: Bearer $TOKEN" \
-H "Idempotency-Key: 6f1c2b7e-8d4a-4c1e-9a55-3f0b2d7e9c11" \
-H "Content-Type: application/json" \
-d '{ "recipientUserId": "…", "amount": { "amountMinor": 250000, "currency": "NGN" } }'When it's required
- Required on every route that moves money: payments, top-ups, transfers, withdrawals, purchases, tickets, gifts, funding. Missing it is
400 IDEMPOTENCY_KEY_REQUIRED. Reference pages mark these routes (Idem or key). - Accepted on create requests generally. Send one whenever a duplicate would hurt.
Keys
- 1–128 printable ASCII characters. A UUID (v4 or v7) per user action is ideal.
- Generate the key once per action, before the first attempt, and reuse it for every retry of that action.
- Keys are scoped to the caller, so two clients can't replay each other's responses.
- Keys are kept for 24 hours.
Outcomes
| Situation | Result |
|---|---|
| First request | Runs normally. |
| Retry after success | The stored response, with header Idempotent-Replay: true. |
| Retry while the first is still running | 409 IDEMPOTENCY_IN_PROGRESS, Retry-After: 2. Wait and retry with the same key. |
| Same key, different method, path or body | 422 IDEMPOTENCY_KEY_REUSED. Use a new key for a new action. |
| Malformed key | 400 IDEMPOTENCY_KEY_INVALID. |
| First request failed | Failures aren't stored, so a retry with the same key runs again. |
Some money routes also have their own business-level duplicate check (for example PAYMENT_KEY_REUSED); treat it the same way as IDEMPOTENCY_KEY_REUSED.