Getting started
Retries
Networks retry, and a retry must never generate a second document or burn a second invoice number. You do not have to do anything for that: if a request identical to one you sent in the last 10 minutes arrives again (same template, same values, same title, same key), it answers the document the first request produced, with HTTP 200 and replayed: true instead of 201.
The match is deliberately exact: change the title and it is a new document. If you would rather decide yourself what counts as the same request, send an Idempotency-Key header with any string unique to it; the key is remembered for 24 hours and a retry carrying it answers the same document whatever the body says. Either way, a retry that arrives while the first request is still running waits a few seconds and then answers idempotency_in_flight.