Documentation
Workspace Environment Variables
Learn how to configure and utilize global environment variables across your nLink workspace to manage shared configurations, API keys, and constants.
Overview
Workspace Environment Variables provide a centralized way to store values that are frequently used across multiple workflows. Instead of hardcoding API keys, base URLs, or authentication tokens into every single HTTP node, you can define them once at the workspace level and reference them dynamically.
Performance Note: The nLink Workflow Engine parses these variables with O(1) complexity upon execution start, caching them deep into the execution context. Referencing them thousands of times across extensive workflow loops incurs zero performance overhead.
Configuring Variables
To define workspace variables:
- Navigate to your Workspace Dashboard.
- Click the Settings icon (or select Workspace Settings).
- Under the Environment Variables section, open the Variables Modal.
- Add your key-value pairs (e.g., Key:
OPENAI_API_KEY, Value:sk-12345...). - Save your changes. Note that keys must contain only alphanumeric characters and underscores.
Using Variables in Workflows
Once defined, accessing these variables within any workflow node is straightforward. Use the double curly brace syntax with the $env prefix.
{{ $env.VAR_NAME }}Example Use Cases:
- HTTP Request Node: Use
{{ $env.BASE_API_URL }}in the URL field instead of hardcoding the full endpoint. - Header Configuration: Bind an Authorization header by setting its value to
Bearer {{ $env.PRIVATE_ACCESS_TOKEN }}. - Set Node: Assign a workspace variable to your local workflow payload by referencing it directly.
Security & Best Practices
Workspace Variables are securely stored in your database and resolved at the engine level.
- Role-Based Access Control (RBAC): Only users with the
OWNERorADMINroles can view or modify workspace variables. Standard members and viewers cannot access the raw values. - Global Scope: Use workspace variables for global settings such as third-party API tokens, global notification webhooks, or environment flags (e.g.,
productionvs.staging). For workflow-specific states, consider using Execution Variables instead.
