> For the complete documentation index, see [llms.txt](https://docs.toucanai.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toucanai.cloud/build/variable-management.md).

# Variable management

{% hint style="info" %}
**Target Audience**: Developers & Non technical users
{% endhint %}

### TL;DR

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

***

### 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

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

* 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

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.       |

{% hint style="warning" %}
**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
{% endhint %}

***

### 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;

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

#### Awaited formats for default values&#x20;

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

* **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.
