Getting started

Idempotency

Networks fail. To create a charge or link exactly once, send an Idempotency-Key header with any unique string (a UUID works well) on POST, PATCH and DELETE requests. Repeating the same key on the same endpoint within 24 hours replays the original response instead of running the request again, and the replay carries an Idempotent-Replayed: true header.

curl -X POST https://api.velirapay.com/v1/charges \
  -H "Authorization: Bearer vp_live_…" \
  -H "Idempotency-Key: order-1042-attempt-1" \
  -H "Content-Type: application/json" \
  -d '{"amount":"150.00","currency":"USD","asset":"BTC"}'

What a key covers

A key belongs to one account, one mode and one endpoint. The same key on a test request and on a live one are two separate requests, so the same order number can safely drive both.

A key is also tied to the body it was first sent with. Sending it again with a different body answers 409 rather than replaying a response that describes something you did not ask for. While the first request carrying a key is still being worked on, a second one answers 409 as well: retrying a request whose answer never arrived is the case this header exists for, and waiting beats making the thing twice.

Only a successful response is stored, so a request that failed can simply be sent again under the same key.