Idempotency
POSTs that move money require the Idempotency-Key header. Use a new UUID v4 per operation:
POST /v1/conversionsPOST /v1/withdrawalsPOST /v1/transfersPOST /v1/deposits
curl -X POST https://api-sandbox.rivusfinance.com/v1/conversions \
-H "Authorization: Bearer $RIVUS_API_KEY" \
-H "Idempotency-Key: 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d" \
-H "Content-Type: application/json" \
-d '{ "quote_id": "6a4f0d1e-8c1b-4f7a-9d42-0c5e3b2a1f90" }'
How it works
- Repeating the request with the same key and the same body returns the original response, with the
Idempotent-Replayed: trueheader, without executing again. Use it to retry safely after a timeout or network failure. - The same key with a different body is rejected with
422 idempotency_key_reused. - While the first request is still processing, a repeat gets
409 idempotency_in_progress. Wait a few seconds and try again. - Only successful responses are stored, for 24 hours. If the request failed (validation, balance, expired quote…), nothing was executed: fix it and repeat with the same key or a new one.
:::tip Generate the key before the first attempt
Generate the Idempotency-Key when the operation is created in your system and store it with it. Every retry of that operation uses the same key.
:::