# Approvals

> Approval requests with steps per subject type and action: approvers by permission, role, team, user or the requester's manager, a required count, delegation, expiry and reminders. Tenants tighten the configured policies with conditions and a confirm or authorize mode, and an approval is consumed once against a request fingerprint. The final approval runs a state-machine transition or a job.

- Category: Work management
- Module: `approvals`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/approvals
- Page: https://bettersupabase.com/blocks/approvals

## Install

```bash
npx better-supabase add approvals
```

The command also installs `updated-at`, `memberships`, `permissions`, `housekeeping`.

## Configure

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

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

export default defineConfig({
  blocks: {
    // Required by approvals; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    housekeeping: {},
    // Modes: "managed", "custom". The default is "managed".
    approvals: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/approvals`.

## Events

- `approval.approved`
- `approval.cancelled`
- `approval.consumed`
- `approval.delegated`
- `approval.escalated`
- `approval.expired`
- `approval.rejected`
- `approval.requested`

## Related blocks

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

Works with: [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md), [notifications](https://bettersupabase.com/blocks/notifications.md), [queue](https://bettersupabase.com/blocks/queue.md), [drive](https://bettersupabase.com/blocks/drive.md), [teams](https://bettersupabase.com/blocks/teams.md), [state-machine](https://bettersupabase.com/blocks/state-machine.md), [employees](https://bettersupabase.com/blocks/employees.md), [automations](https://bettersupabase.com/blocks/automations.md), [housekeeping](https://bettersupabase.com/blocks/housekeeping.md), [subjects](https://bettersupabase.com/blocks/subjects.md)

## Recipes

- [Approvals queue](https://bettersupabase.com/recipes/approvals-queue.md): Requests waiting for the caller's decision, with approve and reject buttons.
- [My work](https://bettersupabase.com/recipes/my-work.md): What waits on the caller across the installed blocks, from `getMyWork`: assigned work, approvals, due reminders, mentions and SLA warnings, each linked to its record.
