> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truemath.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Variables

> Variables are the named values a domain calculates with. Each is defined by a key, type, display format, and optional default, and carries a value with its unit and provenance when a calculation runs.

A **variable** is a named value within a [domain](/concepts/domains) — a home price, an
interest rate, a monthly payment. Variables are what [activities](/concepts/activities)
relate, and what you provide and receive when you run a calculation.

## What a variable has

A variable is **defined** in a domain and takes on a **value** when a calculation runs.

As defined, a variable has:

* **A key** — an identifier, unique within the domain. You reference a variable by its
  key when you provide or solve for it (see [Input formats](/concepts/input-formats)),
  and the API returns it on each variable.
* **A title and description** — human- and agent-readable labels.
* **A type and display format** — how the value is interpreted and shown (see below).
* **A default value** — an optional value and unit used when none is provided.

When a calculation runs, each variable also has:

* **A value** — the number or table it currently holds, with its **unit** where
  applicable; the unit travels with the value (see
  [Units and precision](/concepts/units-and-precision)).
* **Provenance** — where that value came from: user-stated, calculated, carried forward,
  or a default. See [Provenance](/concepts/provenance).

## Types and display formats

A variable holds one of TrueMath's value types — a [scalar number](/math/types/scalar-numbers),
a [unit number](/math/types/unit-numbers), or a [table](/math/types/tables) — and
specifies how it should be displayed:

* **`number`** — a plain number, shown with thousands separators and a chosen decimal format. A monetary amount is a number whose unit is a currency (for example `USD`).
* **`percent`** — a rate shown as a percentage.
* **`no_separator`** — a number shown without thousands separators (for example, a year).
* **`table`** — a collection of values with named rows and columns.
* **`bar_chart` / `pie_chart`** — a table presented as a chart.

For how values combine across types, see [Combining types](/authoring/writing-equations#combining-types). For
authoring variables, see [Defining variables](/authoring/defining-variables).

<Note>
  To list the variables in a published domain, use
  [`GET /v1/domains/:id/variables`](/api/domains).
</Note>
