Run a what-if scenario on a plan
simulate_planApplies an ordered list of scenario patches to a DEEP COPY of the plan (never persisted) and returns the resulting snapshot plus applied_patches. Pass plan_id to load the plan server-side (preferred — never paste plan_json); plan_json is accepted for portability. Pass summary=true for the compact view; add milestones=true for long durations to get yearly points + totals instead of every month. Patches support add_income, add_expense, add_cashflow_change, add_loan, update_loan (loan_id plus any of title, principal_amount, interest_rate, start_month, end_month, deposit_to_bank, type, ref_id, prepayments), add_fdp (fdp: { start_month, end_month, s, e, i } with s + e + i = 100 — or the legacy { amount, interest_rate, tenure } fixed-deposit shape) and set_account_balance — nested ({"op":"add_cashflow_change","change":{...}}) and flat ({cashflow_id,value,start_month,...}) forms are both accepted; the op is inferred from the fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patches | No | Ordered scenario patches (add_income, add_expense, add_cashflow_change, add_loan, update_loan, add_fdp, set_account_balance). | |
| plan_id | No | Load a saved plan by id (authenticated tier only). | |
| summary | No | Return the compact summary (monthly totals + balances) instead of the full snapshot. | |
| duration | No | Projection length in months (public tier caps this). | |
| plan_json | No | Inline plan object for anonymous use; bounded to 256 KB. | |
| milestones | No | With summary, return yearly points and totals instead of every month. |