Idempotency keys
Increase's APIs include an optional creation parameter called the Idempotency-Key
. This string parameter should be a unique value you pre-allocate in your system before invoking the creation method. For example, you could use your application's Invoice ID for an ACH Transfer or your application's User ID for an Entity.
We recommend setting the value for all POST requests. The value should be transmitted as the HTTP header Idempotency-Key
.
You cannot re-use an Idempotency-Key
across two objects—passing Idempotency-Key
guarantees that at most one object is created per key. If Increase receives a second request with the same arguments and Idempotency-Key
, we will return the object created during the first request and set the an HTTP response header Idempotent-Replayed
to the value true
.
Attempting to create a second, different, object with an already used Idempotency-Key
will result in an HTTP 409 Conflict error with the type
field set to idempotency_key_already_used_error
and the resource_id
set to the ID of the Object that is associated with that key.
Idempotency keys are only used for POST
requests. PATCH
, GET
, and DELETE
endpoints are inherently idempotent.
You can retrieve objects by their Idempotency-Key
, too. Each list endpoint has an optional filter parameter idempotency_key
. Passing an idempotency_key
there will return an empty list, if that key is unused, or a list containing exactly one matching result.
Recovering from errors
You can use the Idempotency-Key
header to automatically and safely retry ephemeral errors. As long as the Idempotency-Key
is set to the same value and the request is valid, we will eventually return a successful object to you. We recommend building support for automatic retries, especially for important endpoints like transfer creation.
We do not recommend building automatic solutions using reads of the list endpoint: instead retry your requests with the same parameters and the same Idempotency-Key
and rely on idempotency to eventually deliver you a successful response.
Examples
On the first successful request, Increase creates the Account Transfer.
On the second request with the same idempotency_key
, Increase returns the same object and sets a header indicating this response was replayed.
If an idempotency key is re-used for different request arguments, the POST will fail.
You can also access the object with the list endpoint.
Deprecation notice
Prior to 2024, this functionality was only available on a subset of requests and was called unique_identifier
. Learn more about the older implementation.