Variables
A Variable is a named parameter that powers a piece of advice. Variables can be passed in as input or produced by the Rules Engine as the result of a formula, rule, or calculation.
Every API response includes a variables[] array. A single Variable looks like this:
{
"dataType": "Freetext",
"format": null,
"id": "qT7UxR1ii",
"isConstant": false,
"isToggleable": false,
"isSystem": false,
"name": "Account_Type",
"nameAlt": "Account Type",
"type": "VARIABLE",
"value": "Roth IRA",
"valueDefault": null
}Filtering Variables in the response
The variables[] array is trimmed by default: Variables with a null value, System Variables, and Constant Variables are all dropped. Send the filter parameter only when you want something other than that.
| Value | Effect |
|---|---|
| omitted | Default. Drops null-valued, System, and Constant Variables |
filter=all | Returns every Variable, untrimmed |
filter=variables | Drops Variables with a null value, keeping System and Constant Variables |
filter=variables:!system | Drops Variables with a null value and System Variables |
filter=variables:!constant | Drops Variables with a null value and Constant Variables |
Combine values with commas to stack them. The default written out in full is:
?filter=variables,variables:!system,variables:!constant
Omittingfilterused to return everythingAn Advice API request that sent no
filterpreviously received every Variable untrimmed. It now applies the default above. Sendfilter=allto keep the old response.
Each value also works on its own, and a modifier implies the base filter it modifies — filter=variables:!system drops null-valued Variables as well as System Variables.
A filter that is not a string or an array of strings — ?filter[foo]=bar, for instance — returns HTTP 400.
Not the same as Sparse FieldsetsVariable filters trim entries from the
variables[]array. Sparse Fieldsets trim properties off each entry. The two are independent and can be combined.
Variable properties
id
idA unique identifier for the Variable.
dataType
dataTypeThe data type stored in the Variable. Possible values:
ArrayBooleanDateFreetextNumberPercent(alias forNumberwith a percentformat)Radio
name
nameThe canonical name of the Variable. Names always match /(^[a-zA-Z0-9][a-zA-Z0-9_?]*$)/ — alphanumerics, underscores, and question marks only.
nameAlt
nameAltA friendlier label for the Variable. Often unused.
value
valueThe current value. A null here means the underlying question has not been answered yet.
valueDefault
valueDefaultA Taffrail-defined default for common scenarios — for example, 67 for Retirement_Age.
format
formatA format string the renderer uses to display the value. Most commonly used for Number, Percent, and Date. The API also returns valueFormatted with the format already applied.
{
"format": "0[.]0",
"value": 1.23,
"valueFormatted": "1.2"
}For all Variable types except Array, format is a string. For Array types, format is itself an array, with each entry matching the index of the corresponding value entry:
{
"type": "Array",
"value": [1, 2, 3],
"format": [null, null, "0.0%"],
"valueFormatted": [1, 2, "3.0%"]
}See Formats for the full format string reference.
isToggleable
isToggleableOnly Boolean Variables can be toggleable. When true, the Backlink should render as a switch- or toggle-style control rather than a chip.
isConstant
isConstanttrue for Variables whose values are fixed reference data — IRS limits, regulatory thresholds, and similar — rather than user inputs. Use this to filter constants out of the UI.
isSystem
isSystemtrue for Variables used internally by the Rules Engine. System Variables are not meant for display, and are dropped from the response by default. Pass filter=all to include them.
Updated 15 days ago
