# Variable management (/core/build/variable-management)



<CalloutContainer type="info">
  <CalloutDescription>
    **Target Audience**: Developers & Non technical users
  </CalloutDescription>
</CalloutContainer>

### TL;DR [#tldr]

Define reusable variables to replace static configuration values, enabling dynamic and multi-tenant setups.

***

### When to use this [#when-to-use-this]

Use this feature to manage multiple clients or environments where connection parameters (e.g., database hosts) change based on user context.

***

### Core Functionality [#core-functionality]

Variable Management enables the creation of dynamic configurations across the platform.

* **Centralization**: Define variables in one location for reuse in multiple configuration screens.
* **Dynamic Injection**: Replace static text or integers with variables that resolve at runtime.
* **Context-Awareness**: Supports multi-tenant architectures by injecting user-specific values into configurations.

***

### Prerequisites [#prerequisites]

* Access to the **Settings** menu within a Toucan.ai organization.
* For User Attribute variables: A backend system capable of generating tokens with custom attributes.

***

### Variable Types and Properties [#variable-types-and-properties]

Toucan AI supports one main type of variable:

* **User Attributes**: These variables map directly to values stored in the authentication token. They are typically used for client-specific database routing or security scoping.

Variables are managed via a table in the **Settings** > **Variables** section.

| Property          | Description                                                  |
| ----------------- | ------------------------------------------------------------ |
| **Name**          | The unique identifier used to reference the variable.        |
| **Type**          | The data format: Text, Integer, Boolean, Float, or Datetime. |
| **Default Value** | An optional value used during testing and development.       |

<CalloutContainer type="warning">
  <CalloutDescription>
    **Access rules Integration**\
    User Attributes defined here are the primary source for access rules comparison values. For date-based filtering (e.g., `created_at > last_login`), ensure the User Attribute is explicitly typed as `Datetime` to enable comparison operators
  </CalloutDescription>
</CalloutContainer>

***

### Implementation: Database Connections [#implementation-database-connections]

Variables can be applied to specific fields during the database connection process.

* **Selector Toggle**: Supported fields allow a choice between a static value and a variable.
* **Type Matching**: Toucan.ai filters the variable list to show only types compatible with the selected field.
* **Resolution**: During a **Test Connection**, the platform resolves the variable using the default value or token attribute to validate the link.

***

### Default value&#x20; [#default-value-]

The default value enables the definition of a preset value for testing purposes, applicable only within the platform.

#### Awaited formats for default values&#x20; [#awaited-formats-for-default-values-]

to setup a default value, use the json format&#x20;

* String: Wrapped in double quotes (e.g., `"example"`).
* Integer: A whole number without quotes (e.g., `42`).
* Float: A fractional number using a decimal point (e.g., `3.14`).
* Boolean: Lowercase `true` or `false` without quotes.
* Date: Passed as a String following the ISO 8601 standard (e.g., `"2025-02-13T12:53:45Z"`).
* List (Array): An ordered collection of any of the above types, enclosed in square brackets `[]`.

***

### Constraints [#constraints]

* **Type Strictness**: Lists must contain values of a single, uniform type.
* **Security**: Encryption for variable fields is not available in the current version.
* **Visibility**: Variables are only selectable in fields specifically designed to support dynamic injection.
