Idempotency
Repeat a request safely: it is done once.
A network can fail after a print was made and before its response arrived. Send Idempotency-Key, a value of yours such as a UUID, on any POST: within 24 hours, the same key with the same body answers with the first result (Idempotent-Replayed: true). Nothing is printed or counted twice.
curl https://api.reflowpdf.com/v1/templates/invoice/pdf \
-H "Authorization: Bearer $REFLOWPDF_API_KEY" \
-H "Idempotency-Key: 6f1c2a9e-7b0d-4b8e-9a31-2f5d8c0e4a17" \
-H "Content-Type: application/json" \
-d '{"filename": "invoice"}' -o invoice.pdf- The same key with another body is
422 idempotency_key_reused. - While the first request with a key is being done (two sent at once, too), the other is
409 idempotency_in_progress; the print is made once. - A failure after the print was made (a file that could not be kept, our own error) is the key's answer too: the repeat reads it, nothing is printed again.
- The bytes of an answer (a PDF or images, not a link) are kept for their key an hour: a retry comes within it; after it, a repeat is
410 file_expired. A link (Accept: application/json) works 24 hours. A refusal before printing (the account's turn, the engine busy) is not remembered — repeat the key once it clears. - A key belongs to its account: the same key sent by another account is a key of its own.
- The SDKs send one on every
POSTthey retry.