This is the definition shape — what a domain is. It is related to, but not the same as, the read shapes the API returns from
GET /v1/domains/:id/activities: the definition relates activities to variables by key, while the read endpoints relate them by variable_id and add server-side fields such as identity, version, and activity state. Use this page for the portable definition; use Domains (API) for what a calculation or read endpoint returns.Top-level structure
A definition is an object with three members:
Variables and activities relate to one another by key, not by position or by id — see How variables and activities relate.
What an author assigns, and what TrueMath assigns. A variable’s
key is the only identifier you choose — the human-readable name you write in equations and input (loan_amount, interest_rate). Everything else is assigned by TrueMath, not author-chosen: every id (a UUID), each activity key (act_ followed by hex), and the domain’s key (dm_ followed by hex). All are stable for the life of the domain.The domain object
The definition carries no identifier in the
domain object — only its title and description. A domain’s identity is assigned and managed by TrueMath and does not travel inside the definition body. Importing a definition applies it to the domain you import it into, overriding that domain’s current contents; see Managing a domain.
Variables
Each entry invariables describes one variable: its key, its labels, its default, and how it is displayed.
Display types
display_type is one of:
display_metadata
display_metadata holds the variable’s display configuration under a single key naming its structural type. The three scalar display types — number, percent, and no_separator — all nest under number; the others nest under table, bar_chart, or pie_chart.
Scalar variables — number
For number, percent, and no_separator:
Table variables — table
Columns carry no unit field: each cell carries its own unit with its value — see Tables as a stored value.
Bar chart variables — bar_chart
A chart is a presentation of a table; the variable’s value stays a table and display_metadata.bar_chart configures how it is drawn.
Pie chart variables — pie_chart
Activities
Each entry inactivities describes one activity: its equation and which of the variables it references it may solve for.
How variables and activities relate
Within a definition, activities and variables are connected by key, with no separate wiring:- An activity’s
equationreferences variables by theirkey. Reusing the same key across activities refers to the same variable — this is how activities compose into a domain. See How activities compose. - An activity’s
calculablearray lists variable keys — among the variables itsequationreferences, the ones the activity may solve for, rather than only read as input.
equation and calculable must match the key of an entry in variables. The id fields identify existing elements; they are not how activities point at variables.
The read endpoint
GET /v1/domains/:id/activities returns the same configuration in a different shape — it relates each activity to its variables through a variable_refs array of variable_ids, and adds fields such as activity state and a version. When generating or reading a portable definition, use the key-based shape on this page.Complete example
A self-contained excerpt of a mortgage domain — scalar variables, a table, a bar chart, and a pie chart, with the activities that drive them. Every key referenced in anequation or calculable list is defined below as a variable:

