POST
blindly risks doing the work twice — a second collection created, a second photo
added. Send an Idempotency-Key and the retry is free: Pexafy replays the
first response instead of running the request again.
This applies to POST requests only. GET and DELETE are already safe to
repeat, so they ignore the header.
Using it
Generate a unique key per logical operation — a UUID is the usual choice — and send it with the request:Rules
Keys are stored per key value, not per endpoint. Generate a fresh one for each
operation you want to be able to retry.
When to bother
Use it whenever a failed call would be expensive to repeat — creating a collection, adding photos in bulk from a job that may be retried by your queue. For plain searches it adds nothing:GET /search/photos is already safe to
repeat as often as you like.