Skip to content
Reference

Idempotency

Networks fail. Idempotency keys let you retry any POST safely, without creating a second payment or sending a payout twice.

Using Idempotency-Key

Send a unique value (a UUID, or your own order/run id) in the Idempotency-Key header on any POST:

Shell
curl https://lipacoin.io/api/v1/payments \
  -H "Authorization: Bearer $LIPACOIN_SECRET_KEY" \
  -H "Idempotency-Key: 3f0c1c52-6c55-4f0e-8d1a-2a8b1d3c7e19" \
  -H "Content-Type: application/json" \
  -d '{"price_amount":"49","price_currency":"USD","pay_asset":"BTC"}'

Behaviour

SituationResult
First request with the keyProcessed normally; a successful response is stored.
Retry with the same key and identical bodyThe stored response is returned with header Idempotent-Replayed: true. Nothing is created again.
Same key, different body409 idempotency_conflict
Same key while the first request is still running409 idempotency_in_progress — retry shortly.
First request failed with an errorNothing is stored; the same key can be retried.

Keys are scoped to your account and mode. The body comparison is byte-exact (SHA-256 of the raw body), so serialize retries identically.

Payouts have a second safety net
Each payout row can carry a unique_ref. A payout with a unique_ref you've used before returns the existing payout instead of paying again — even across different requests. See payouts.