> For the complete documentation index, see [llms.txt](https://docs.payengine.co/payengine-api-v2.5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payengine.co/payengine-api-v2.5/transactions/idempotent-transaction-requests.md).

# Idempotent Transaction Requests

Platform supports idempotency for safely retrying transaction requests without accidentally performing a duplicate execution of the same requests.\
\
Idempotency is supported with [Auth](/payengine-api-v2.5/transactions/authorization.md), [Sale](/payengine-api-v2.5/transactions/sale.md), [Capture](/payengine-api-v2.5/transactions/capture.md), [Refund](/payengine-api-v2.5/transactions/refund.md) and [Void](/payengine-api-v2.5/transactions/void.md) APIs

To mark an idempotent request, provide an additional HTTP header `request-key` in supported APIs. Platform saves the response of the first request regardless of its failure or success; subsequent requests with the same `request-key` will produce the same response. This is very useful if a request times out and client needs to retrieve the response of the previous request.

A `request-key` is a unique value generated by client and we recommend to use UUIDs or any unique key with enough entropy to avoid collision. Platform system will clean up the keys after 24 hours.

{% hint style="danger" %}
Results are stored including failed respoenses. This feature is to support safe retries and it is client's responsibility to maintain uniqueness of the `request-key`
{% endhint %}

### Sample Sale Request

Subsequent calls of this request will always yield the same results as the firtst call until the `request-key` expires (24 hours)

```shell
curl --location --request POST 'https://<Platform Host>/api/payment/sale' \
--header 'Authorization: Basic <Your Private Key>' \
--header 'Content-Type: application/json' \
--header 'request-key : <Unique Reqeust Key>' \
--data-raw '{
    "merchant_id": "<Your Merchant ID>",
    "data": {
        "transaction_amount": "10.00",
        "card_token": "<Your Card Token>",
    }
}'
```
