Skip to content

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 ​

SituationResult
First requestRuns normally.
Retry after successThe stored response, with header Idempotent-Replay: true.
Retry while the first is still running409 IDEMPOTENCY_IN_PROGRESS, Retry-After: 2. Wait and retry with the same key.
Same key, different method, path or body422 IDEMPOTENCY_KEY_REUSED. Use a new key for a new action.
Malformed key400 IDEMPOTENCY_KEY_INVALID.
First request failedFailures 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.

Plemuz API v2