Skip to content

Search API reference

Find an endpoint or a guide of the Sovgate API reference and jump straight to it.

Idempotency

Send an Idempotency-Key with every write, so a retry after a lost answer never charges or refunds twice.

Every request that creates, changes or deletes something carries an Idempotency-Key header. If the answer is lost, send the same request again with the same key: the API returns the first answer and does nothing twice. A write without a key is refused with idempotency_key_missing. Reads need none.

A write with its key
bash
curl -X POST https://api.sovgate.com/v1/refunds \  -H "Authorization: Bearer sov_sk_test_your_key" \  -H "Idempotency-Key: 2b9f6c1e-8d3a-4e7f-b0c5-9a1d2e3f4b5c" \  -H "Content-Type: application/json" \  -d '{ "payment": "pay_...", "reason": "requested_by_customer" }'

The rules

  • Use a new key for each request. A random UUID is a good key. A key you used for a charge can't be used again for its capture or its refund.
  • Send the same key only to repeat the same request, after a lost answer or a 5xx.
  • Same key, same request: you get the saved answer, marked as a replay in your request logs. No second effect.
  • Same key, different request: refused with idempotency_key_reused, with no effect.
  • The first request is still running: the repeat is refused with 409 and a Retry-After. Wait, then repeat it.

How long a key lasts

A key is kept for 7 days from the moment its outcome is known. A payment, a capture or a refund keeps its key for as long as it exists: a late repeat returns the record as it stands now, and can never take money twice.

What isn't saved

A request refused before anything happened, for a bad field, a missing permission, a rate limit or a key refusal, isn't saved. Fix it and send it again: the key is still free.

Telemetry events

A telemetry event uses its own identifier instead: the same identifier is never counted twice in a day, and is kept until its month closes.