# PATCH /calculators/:calculator_id

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

Change a calculator: name, description, its draft (definition replaces the whole draft; the live version does not change until publish_calculator) and how it shows on opportunities (opportunity merges). Showing it on opportunities needs a published version.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `calculator_id` | path | string | yes | The calculator (list_calculators). |
| `name` | body | string | no | New name (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. |
| `opportunity` | body | object | no | How it shows on opportunities (fields merge, send only what changes): { enabled (true: a Calculators card on each opportunity shows it, even before it is run), pipeline_ids (the workflows it shows on; [] for every workflow), headline (up to 3 result keys shown on the card), save_from: { portal, website, team, automation } (which runs may be saved onto an opportunity; automation also covers the API and your Claude), prefill: { <input key>: { field: "<opportunity custom field key, or value for the opportunity value>" } or { value } or null to remove } (where a team run's starting answer comes from when the client has not given one) }. |
| `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 PATCH   "https://api.trustpager.com/functions/v1/api/v1/calculators/:calculator_id"   -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`