A network error does not tell you whether the server acted. Retrying a 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:
Retry the exact same call and you get the same body and the same status code back, plus a header telling you it was a replay rather than a fresh action:

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.