Idempotency
Send the same key for every retry of one call, and a new key for a new call.
Every money-moving endpoint takes an idempotency-key header. It is how a retry stays a retry.
curl -X POST https://api.trytushe.com/v1/accounts/{accountId}/payouts \
-H "x-api-key: $TUSHE_KEY" \
-H "idempotency-key: 7c9e6679-7425-40de-944b-e07fc1f90ae7" \
-H "Content-Type: application/json" \
-d '{ "bankCode": "058", "accountNumber": "0123456789",
"amount": "5000000", "currency": "NGN" }'One key, one call. Send the same value for every retry of that call, and mint a new one for a genuinely new call.
Reusing a key with a different body is refused with IDEMPOTENCY_KEY_REUSED (422). The first
post stands — fetch it rather than retrying. This is deliberate: silently applying the second
body would make the key meaningless.
A money-moving call sent without the header is refused with IDEMPOTENCY_KEY_REQUIRED
(400), and a malformed one with IDEMPOTENCY_KEY_INVALID (400).
A retry that reaches us after the original succeeded returns the original result, not a new one — same transaction id, no second posting.