# Write rate limits

> Fixed-window limits on Data API writes (POST, PATCH, PUT, DELETE) per user or claim, checked by pgrst.db_pre_request. Over the limit: 429 with Retry-After.

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

## Install

```bash
npx better-supabase add rate-limit
```

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 rate-limit; add installs them too.
    housekeeping: {},
    // Modes: "managed". The default is "managed".
    "rate-limit": { 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)
