# idempotencyKey

One key per logical evaluation. Reuse it to retry safely.

`evaluate` and `evaluateDetails` require `idempotencyKey`: a caller-owned id for one logical evaluation. Generate it once per evaluation with `crypto.randomUUID()`.

If a request's outcome is uncertain (a timeout, a dropped connection), resend it with the same key. The platform deduplicates the Exposure, so the subject is counted once. This is why the SDK refuses `retries`: an automatic retry with a fresh key is a second Exposure for one logical evaluation, and it double-counts the subject in every experiment reading that Flag.

The key is yours, not ours. Deriving it from something stable in your own request context (a request id, a job id) makes retries idempotent by construction.

- [IDEMPOTENCY_KEY_CONFLICT](/docs/error/IDEMPOTENCY_KEY_CONFLICT) on the control plane means one key was reused with a different payload. Use a fresh key for a different change, or resend the original payload unchanged.
- [SDK_RETRIES_INVALID](/docs/error/SDK_RETRIES_INVALID) is thrown at construction when `retries` is set above `0`.

Source: https://splitch.dev/docs/sdk/idempotency