> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onstacks.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency

> Retry write requests without creating duplicates.

Network retries can send the same write request more than once. An idempotency key lets you retry safely without risking a duplicate transfer.

Idempotency keys are supported on transfer creation, approval, cancellation and refresh.

```bash cURL theme={"system"}
curl -X POST "https://api.onstacks.io/v1/transfers?environment=sandbox" \
  -H "X-API-Key: ostk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: your-unique-operation-id" \
  -H "Content-Type: application/json" \
  -d '{ "..." : "..." }'
```

Send a unique value, such as a UUID, in `Idempotency-Key` or `X-Idempotency-Key`. If a request with the same key and the same activity is retried, Onstacks returns the original result instead of repeating the action.

* Generate one key per operation, not per HTTP attempt. Reuse it across retries of that operation.
* Keys are optional. Requests without one are always processed as new.
* A key doesn't replace validation. A retried request must target the same activity to count as a duplicate.

<Tip>
  Use the same idea on your webhook receiver: store each delivery's `id` so you don't process an event twice when it's resent.
</Tip>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.