> ## Documentation Index
> Fetch the complete documentation index at: https://developers.reintersect.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Approval

> Ask named approvers to approve or reject a request. Reject asks for confirmation, and either decision locks the block with a summary.

> Reintersect apps are in developer preview. Names and limits can still change before general
> release.

When a request needs a yes or no from specific people, such as an expense that finance signs off,
insert an approval block. Approvers approve or reject it in place, and either decision locks the block.

```tsx src/app.ts theme={null}
import { createReintersectApp, defineMessageAction } from "@reintersect/sdk/app";
import { approval } from "@reintersect/sdk/recipes";

export const ExpenseApproval = approval({ type: "expense-approval", title: "Expense approval" });

export const RequestApproval = defineMessageAction(
  "request-approval",
  { label: "Request approval" },
  ({ message }) => ({
    visibility: "public",
    block: ExpenseApproval.insert({
      title: message.text,
      requestedBy: message.author.displayName,
      approvers: ["member_finance_lead"],
      facts: [{ label: "Cost center", value: "Engineering" }],
    }),
  }),
);

export const app = createReintersectApp({ name: "Expenses" })
  .addBlock(ExpenseApproval)
  .addMessageAction(RequestApproval);
```

## Props

| Prop | Type | Description |
| - | - | - |
| `title` | `string` | What is being approved. |
| `description` | `string` | Optional detail. |
| `requestedBy` | `string` | Optional name of the requester. |
| `approvers` | `string[]` | Member ids allowed to decide. Empty or missing means anyone who can act on the block. |
| `facts` | `{ label, value }[]` | Optional facts shown as a list. |

## State and actions

State is `{ status: "pending" | "approved" | "rejected", decidedBy? }`, starting at `pending`.

| Action | Behaviour |
| - | - |
| `approve` | Records the decision and the deciding member, and marks the block final. |
| `reject` | Destructive, so it asks for confirmation. Same result with `rejected`. |

Approve is the block's primary button. Reject can't take that slot because it's destructive. When
you list `approvers`, the recipe sets `audience` on its `Actions`, so only they see the two buttons.

A member who isn't a listed approver gets a notice instead of a decision. The block is
`insertable` by default, so members can add it from the slash menu.

## Labels

`pending`, `approved`, `rejected`, `approve`, `reject`, `requestedBy`, `confirmTitle`, `confirmBody`,
`notAllowed`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.