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

# Idempotency

> Safely retry write requests without creating duplicates.

Network calls can fail after the server has already done the work. To retry safely, send an **idempotency key** on write requests (`POST`). If the same key arrives twice, Global Stack replays the original response instead of performing the action again.

## Sending a key

Pass a unique value in the `Idempotency-Key` header:

```bash theme={null}
curl https://api.globalstack.io/v1/transfers \
  -X POST \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Idempotency-Key: 8f2a1c4e-7b3d-4a90-bf12-9c5e6a1d2b34" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```

The key must match `^[A-Za-z0-9_\-]{8,255}$` — 8 to 255 characters of letters, digits, underscores, or hyphens. A UUID works well. A malformed key returns `400 invalid_input`.

## Which endpoints support it

These `POST` endpoints honour `Idempotency-Key`:

| Area | Endpoints |
| - | - |
| Money movement | `/v1/transfers`, `/v1/onramps`, `/v1/offramps`, `/v1/conversions` |
| Quotes | `/v1/onramps/quotes`, `/v1/offramps/quotes`, `/v1/conversions/quotes` |
| Customers | `/v1/customers`, `/v1/customers/{customerId}/verifications` |
| Wallets | `/v1/wallets`, `/v1/wallets/{id}/credentials`, `/v1/wallets/{id}/deposit-addresses` |
| Webhooks | `/v1/notifications/webhooks` |

`POST /v1/beneficiaries` doesn't use the header. To avoid creating the same beneficiary twice on a
retry, send your own `merchant_reference`: a second create with the same one returns
`409 duplicate_resource`.

## How replays are resolved

**1. Same key, same body**

The original, stored response is replayed — the action runs only once.

**2. Same key, still processing**

If the first request hasn't finished yet, the retry returns `idempotency_in_progress`. Wait and retry.

**3. Same key, different body**

Reusing a key with a different request body returns `idempotency_conflict`. Always generate a fresh key for a genuinely new request.

> [!NOTE]
>
> Keys expire **24 hours** after first use, so reuse a key only for retries of the *same* request. After 24 hours the same key is treated as new.
>
> An idempotency key is separate from a money movement's `reference`. References are unique forever: reusing one is rejected with [`409 duplicate_resource`](https://docs.globalstack.io/errors#duplicate_resource) rather than replayed. Retry with the same `Idempotency-Key`, not by resending a used `reference`.


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