Send a key
Add anIdempotency-Key header to any POST request.
What happens on a repeat
Saasybill compares the method, the path and the body of the repeat with the first request.
Only a success is stored. A
4xx that was refused before anything happened doesn’t lock you out of your own key, so you can fix the body and resend under the same key.
A
201 from POST /v1/subscriptions counts as a success even when invoice.xero.sync_status is failed. The subscription and invoice exist, so a repeat returns that same response. It doesn’t raise a second invoice.Extra protection for subscriptions
A new subscription’s id is derived from the API key and the idempotency key. If a server crashes after the subscription is saved but before the response is stored, your retry finds the subscription it already made and returns it. A crash can’t turn into a second subscription.Retry pattern
Retry on timeouts,429, 500 and 502, with the same key and the same body. Back off between attempts.