The Persona API supports idempotency for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. For example, if a request to create an Inquiry does not respond due to a network connection error, you can retry the request with the same idempotency key to guarantee that no more than one Inquiry is created.
To perform an idempotent request, provide an additional Idempotency-Key
header to the request.
Idempotency-Key: <key>
Persona's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500
errors.
Keys are eligible and automatically pruned from the system after they're at least 24 hours old. If a key is reused after pruning, a new request is generated. The idempotency layer compares incoming parameters to those of the original request and errors unless they're the same to prevent accidental misuse
Where are my API logs?
When you retry an API call with an idempotency key and Persona returns a saved response, we do not create a new API log. This helps to prevent clutter and, in the case of errors, makes it easier to diagnose the initial issue.
All POST requests accept idempotency keys. Sending idempotency keys in GET and DELETE requests has no effect and should be avoided, as these requests are idempotent by definition.
Recommendations for choosing Idempotency Key values
The idempotency key should generally be unique per endpoint and operation. For example, an idempotency key for creating a resource should not conflict with one for updating a resource. It's best practice, to use UUIDs or other cryptographically random strings to ensure uniqueness. Avoid using reference IDs as idempotency keys.