# Idempotency keys

> Stores responses by Idempotency-Key so retried requests replay the first result instead of running twice.

- Category: Automation
- Module: `idempotency`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/queue
- Page: https://bettersupabase.com/blocks/idempotency

## Install

```bash
npx better-supabase add idempotency
```

The command also installs `housekeeping`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by idempotency; add installs them too.
    housekeeping: {},
    // Modes: "managed". The default is "managed".
    idempotency: { mode: "managed" },
  },
});
```

## Client

The block is SQL only: call its functions from your policies, RPCs and the other modules.

## Related blocks

Requires: [housekeeping](https://bettersupabase.com/blocks/housekeeping.md)

Works with: [housekeeping](https://bettersupabase.com/blocks/housekeeping.md)
