Idempotent Request
Credilinq API offers Idempotency functionality to allow multiple retries of a request without performing the same operation repeatedly. When a request is retried with the same idempotency key, the operation's side effects will occur only once, ensuring data integrity.
For instance, if a request to create a loan using the Create Drawdown/Loan API fails due to a network outage, retrying the request with the same idempotency key will not create a new drawdown. Instead, the API will return the loan created during the first attempt.
Supported Requests
All POST requests support idempotency, while GET and DELETE requests are already idempotent, making idempotency key addition unnecessary.
Implementing Idempotency with CrediLinq
To use idempotency in an API, developers must pass the Idempotency-Key header in the request, which our server uses to identify retries of the same request. Using an idempotency key with sufficient entropy is recommended to avoid collisions.
curl --request POST \
--url https://stage-api.credilinq.ai/v1/loan/calculateloanschedule \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Idempotency-Key: QzngrkTDWihAoHYL' \
--header 'Authorization: Bearer eyJraWQiOiJ3YitJMjNzOWRCNUh0cjBhQXVwTHVjeFwvUFhWREhlVEcyQWpTNnkyNFBjYz0iLCJhbGciOiJSUzI1NiJ9' \
--data '
{
"customerReferenceNo": "Test Reference Number",
"loanAmount": 2000,
"loanTermFrequency": 30
}
'
400 Bad Request
It is crucial to ensure that the request parameters are identical for any requests using the same idempotency key; otherwise, the request will be rejected with a
**400 Bad Request**
response.
Idempotency Key Validity
The idempotency key is valid for 24 hours. After that period, if a request is sent with the same idempotency key, it will be treated as a new request, and a new idempotency key should be used.
Updated almost 2 years ago