Lideflow-Logo

IdempotencyIdempotency

How to use idempotency with the Lideflow API

What is idempotency?

A request method is considered idempotent if the intended effect of multiple identical requests with that method is the effect of a single request.
The Lideflow API supports idempotency using an `Idempotency-Key`header to protect against duplicate operations. For most endpoints, the header is optional but we highly recommend that you set one.

For endpoints where erroneous duplicate processing would have especially bad consequences, such as the creation of a payout, we require an idempotency key.

Idempotency key

Your application must not provide identical idempotency keys for different requests. We suggest using random strings with sufficient entropy to avoid collisions like V4 UUIDs. Your application should store these keys so that semantically identical requests are sent with the same idempotency keys.

Illustrative scenario

  • Your app sends a request to initiate a payout transfer.
  • Lideflow receives and processes it. Before you get a response, a network timeout occurs.
  • Your app retries, thinking the first attempt failed.
  • With the same idempotency key, Lideflow recognizes the retry as a duplicate and ignores it.
  • Without a key or with a different key, Lideflow would process it again—triggering a second payout transfer.

Good to know

  • All POST and PUT requests accept idempotency keys.
  • Sending idempotency keys in GET and DELETE requests has no effect and should be avoided–these requests are idempotent by definition.