> ## Documentation Index
> Fetch the complete documentation index at: https://crm-social.exuratech.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency and retries

> Prevent duplicate deposits or withdrawals after timeouts and network failures.

Each deposit and withdrawal requires a unique, stable `idempotency_key` permanently associated with a single CRM transaction. For webhooks, `event_id` serves the same purpose and must have a unique constraint in the receiver.

## Build the key

Use the immutable identifier of the internal movement:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
crm-deposit-985421
crm-withdrawal-985422
```

The key must not depend on the attempt number, retry time, or a random value generated for each request.

## What to do after a timeout

**1. Keep the original payload**

Preserve the same user, amount, currency, wallet, reference, and `idempotency_key`.

**2. Retry the same operation**

Send exactly the same request. Do not create another logical transaction.

**3. Accept the idempotent confirmation**

`ALREADY_PROCESSED` means that the original movement has already been applied and must be treated as successful.

## Required rules

* Never reuse a key for another user, amount, currency, or movement type.
* Do not generate a new key after a timeout.
* Persist the key before calling ExuraCopy.
* Record the result and returned `transaction_id`.
* Use backoff and a retry limit for transient errors.
* If a webhook repeats the same `event_id`, respond successfully without duplicating the account in the CRM.

> [!WARNING]
>
> An idempotency `409` conflict may indicate that the same key arrived with a different payload. Stop automatic retries and investigate the original transaction.

> [card] [Previous: Account webhooks](https://crm-social.exuratech.com/guides/account-webhooks.md)
>
> Review event delivery and deduplication.

> [card] [Next: Errors](https://crm-social.exuratech.com/reliability/errors.md)
>
> Handle failed responses consistently.


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