Learn|||Back Office

What is Idempotency?

An API call is idempotent if it has the same result, regardless of how many times it is applied. Inadvertent duplicate API calls can cause unintended consequences for a business, idempotency helps provide protection against that.

The word “idempotent” stems from the Latin words “idem” and “potent,” which when put together, means “the same power.” The term was originally introduced in mathematics to refer to mathematical operations that can occur multiple times while only altering the end result once. For example, the operation “Multiply by 1” is idempotent. Whether you do 2x1 or 2x1x1x1, the result will always be 2.

This behavior is desirable in internet applications, especially those that involve payments. When you are shopping online and press the submit button on a checkout page twice, you only want your order to be placed once.

When building a system to move money, it is paramount that operations that move money are idempotent. Failure to do this could result in errors such as double charging a customer or paying a vendor multiple times.

Idempotency and APIs

In the context of APIs, idempotency is significant in safeguarding the accuracy of a business’ data. An API call is idempotent if it has the same result, regardless of how many times it is applied. Inadvertent duplicate API calls can cause unintended consequences for a business, idempotency helps provide protection against that.

To learn more about Idempotency, check out these additional resources: