Skip to main content

Idempotency

Mutations through the SDK support idempotency keys to ensure safe retries of operations. This prevents duplicate operations when network issues or other failures occur during API calls.

Using Idempotency Keys

Mutations accept an optional second parameter object containing an idempotencyKey field:

// Example mutation with idempotency key
let transaction = await solidtx.wallets.adjustBalance({
walletId: 'wallet_yxeh6q5mmpik8w6cyvc9zcnn',
balanceId: 'cash',
amount: '50',
}, {
idempotencyKey: "some-stable-order-id"
})

Idempotency Key Requirements

  • Unique: Each idempotency key should be unique for different operations
  • Stable: Use the same key for retries of the same operation

Idempotency Window

Mutations are idempotent for 24 hours from the initial request. After 24 hours, the same idempotency key can be reused for a new operation.