create_goal
Create a savings goal: a target amount (optionally by a date) funded by percent shares or fixed amounts of one or more accounts. Fails when the goal currency has no exchange rate, an account would pass 100% shared across non-archived goals (the error names the account and its free %), or fixed amounts alone fall short of the target. Needs the Goals feature on the plan or an active trial. Returns the goal in the get_goals shape.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Goal name | |
| accounts | Yes | Accounts backing the goal, at least one. Each is either { accountId, sharePercent } or { accountId, fixedAmount, fixedPosition? }. A fixedAmount (decimal in the account's currency) is taken from the balance first; when the balance can't cover every goal's fixed amount on the account, they are filled in fixedPosition order (0 first; omit it to keep the current place or append). sharePercent (0 < x <= 100) is the part of what is left after fixed amounts. Owned general, cash, current, saving, investment or crypto accounts only. An account's sharePercent values across non-archived goals cannot exceed 100%. When every account is a fixedAmount, their sum must reach targetAmount | |
| targetDate | No | Optional deadline (yyyy-MM-dd) | |
| currencyCode | Yes | ISO 4217 code of the target currency, e.g. USD. Usually the user's base currency | |
| targetAmount | Yes | Target as a decimal amount in currencyCode (e.g. 5000.00) | |
| plannedMonthly | No | Optional planned saving per month, decimal in currencyCode. When set it is used as the pace instead of the history | |
| reachedHoldDays | No | Days (0-365, default 30) after first reaching the target during which a dip below it still counts as reached. 0 follows the balance live |