Overview
Flowise supports three types of dynamic values:- Global Variables: Reusable values defined once, used everywhere
- Node References: Output from one node used as input to another
- Runtime Variables: User input and system-provided values
Global Variables
Global variables let you define values once and reference them across chatflows.Creating Variables
Add New Variable
Click Add Variable to create a new variable:
- Name: Unique identifier (e.g.,
apiKey,personality,companyName) - Type: Static or Runtime
- Value: The variable’s value
Using Variables in Nodes
Reference variables in any text field using the$vars syntax:
- In Prompts
- In Custom Functions
- In JSON Parameters
Use double curly braces in text fields:At runtime, Flowise replaces these with actual values:
Variable Syntax Reference
| Syntax | Description | Example |
|---|---|---|
{{$vars.name}} | In text fields (prompts, messages) | Hello {{$vars.userName}} |
$vars.name | In code (custom tools, functions) | const key = $vars.apiKey |
$vars.<name> | Dot notation for variable access | $vars.config.timeout |
Node References
Connect nodes by referencing outputs in other node inputs.Understanding Node Data Flow
When you connect nodes visually, Flowise generates reference expressions: The connection creates this reference:Reference Syntax
Node Instance Reference
Node Instance Reference
Access the node’s output instance:Example:
Visual connections automatically create these references. You rarely need to write them manually.
Node Input/Output Data
Node Input/Output Data
Access specific data from node configuration:Example:
List References (Multiple Connections)
List References (Multiple Connections)
When a node accepts multiple inputs (e.g., tools for agents):Flowise automatically manages list inputs when you connect multiple nodes to a single anchor.
Runtime Variables
Variables provided automatically during execution.User Input Variables
- Question Variable
- Chat History Variable
- Session Variables
The user’s current message:Example in Prompt:Example in Custom Function:
Override Variables via API
Dynamically set variable values when calling the prediction API:Override Config Options
Override Config Options
Beyond variables, you can override other settings:
Advanced Patterns
Conditional Logic with Variables
Use variables in conditional expressions (requires custom code nodes):Multi-Environment Configuration
Use variables for environment-specific settings:- Development
- Production
.env.development:Templated System Messages
Create reusable personality templates:Dynamic Prompt Templates
Build prompts from variable components:Expression Syntax Summary
Text Field Expressions
Text Field Expressions
Use in any text input field (prompts, messages, JSON strings):Examples:
Code Expressions
Code Expressions
Use in custom code (tools, functions, loaders):Examples:
JSON Expressions
JSON Expressions
Use in JSON parameter fields:Note: Always use strings in JSON, even for numbers:
Best Practices
Variable Naming
Variable Naming
- Use camelCase:
apiKey,userName,defaultModel - Be descriptive:
openaiApiKeynotkey1 - Prefix by category:
llm_model,llm_temperature,db_connectionString - Avoid special characters (stick to letters, numbers, underscore)
Security
Security
- Never store secrets as Static variables
- Use Runtime variables for all sensitive data
- Validate user input in custom functions
- Sanitize variables used in SQL or external APIs
- Review variable visibility (can users see them?)
Organization
Organization
- Document variables with clear names
- Group related variables (e.g.,
email_*,api_*) - Delete unused variables regularly
- Export/import variables with chatflows for portability
- Maintain a variable registry for team reference
Performance
Performance
- Cache runtime variable lookups when possible
- Avoid complex expressions in hot paths
- Use static variables for constants (faster lookup)
- Minimize API override vars (smaller payloads)
Common Use Cases
Multi-Tenant SaaS
Multi-Tenant SaaS
Localization
Localization
A/B Testing
A/B Testing
Troubleshooting
Variable Not Resolving
Variable Not Resolving
Symptoms: Seeing
{{$vars.name}} literally in outputCauses:- Variable doesn’t exist
- Typo in variable name
- Wrong syntax (missing
$or{{}})
- Check variable exists in Variables page
- Verify exact name (case-sensitive)
- Use correct syntax:
{{$vars.name}}in text,$vars.namein code - For runtime variables, ensure
.envfile is loaded
Node Reference Not Working
Node Reference Not Working
Symptoms: Empty or null values when referencing nodesCauses:
- Node not connected visually
- Wrong node ID
- Node hasn’t executed yet
- Use visual connections instead of manual references
- Check node ID in browser console (inspect node data)
- Ensure execution order (parent nodes execute first)
Next Steps
API Reference
Learn about overrideConfig and API usage
Custom Tools
Build custom tools using variables
Deployment
Environment variables in production
Security
Secure variable management