# POST /calculators

**Resource:** [CALCULATORS](./calculators.md)  
**MCP tool:** `create_calculator`  
**Scopes:** `calculators:write`  
**Write operation:** yes

Create a calculator as a draft. Give it inputs, rate tables and results (definition), try it with try_calculator, then publish_calculator to make it live. Gifts, quizzes, website calculators, client portals and opportunities use the live version.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `name` | body | string | yes | What it is called, e.g. "Home loan snapshot" (up to 120 characters). |
| `description` | body | string | no | What it works out, for your team. |
| `definition` | body | object | no | The calculator: { inputs: [{ key, label, kind: money \| percent \| number \| choice \| choices \| yes_no \| text, options (choice and choices: the option words), min, max (money, percent, number), default (the starting value), required (default true) }], tables: { <name>: { kind: "brackets", rows: [{ from, to (null on the last row), base, rate }] } or { kind: "lookup", rows: [{ key, value }] } }, outputs: [{ key, label, formula, format: plain \| money \| percent }] }. A formula reads inputs and other results by key, like price - deposit. It can use + - * / ^ and brackets, comparisons (= != < <= > >=), and, or, not, if(condition, a, b), min, max, round(x, decimal places), floor, ceil, abs, has(choices input, "option"), brackets(table, amount) for tiered amounts such as stamp duty (base + rate x (amount - from) for the row the amount falls in; rate is a decimal, 0.0175 means 1.75 percent; rows start at 0 and each starts where the one before ends; the last row's to is null) and lookup(table, key, value if missing); a lookup value can name a brackets table, so brackets(lookup(duty_by_state, state), price) picks each state's table. A choice compares as text (state = "NSW"), yes_no is true or false, a percent input holds 6 for 6 percent. Replaces the whole draft; it is saved even with problems (they come back in draft_problems) and checked again on publish. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/calculators"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"name":"...","description":"...","definition":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`