# Retry writes safely

> Use idempotency keys to replay successful Management API writes safely.

Canonical page: https://rpc.aurpay.net/docs/management-api/idempotency

PAT write requests may include an `Idempotency-Key` containing 1–128 letters, digits, dots, underscores, colons, or hyphens.

```bash
curl "$RPC_GATEWAY_API_URL/v2/apps" \
  -X POST \
  -H "Authorization: Bearer $RPC_GATEWAY_PAT" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: create-app-018f6f9a' \
  --data '{"name":"Agent managed app"}'
```

A successful response is retained for 24 hours for the same PAT, key, method, path, query, and body. A replay returns `Idempotency-Replayed: true`.

Use a new key for every distinct method, path, query, or body. Idempotency keys are isolated between PATs, even when the PATs belong to the same account.

> Automatically replay only a retained successful response. Route ambiguous server or `5xx` outcomes through application-specific reconciliation before another write.
