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 massive workflow loops causes zero performance overhead.

Configuring Variables

To define variables for your workspace:

  • Navigate to your Workspace Dashboard.
  • Click on the Settings icon (or select "Workspace Settings").
  • Under the "Environment Variables" section, click to open the Variables Modal.
  • Add key-value pairs (e.g., Key: OPENAI_API_KEY, Value: sk-12345...).
  • Save your changes. Keys must contain only alphanumeric characters and underscores.

Using Variables in Workflows

Once defined, accessing these variables inside any workflow node is extremely straightforward. You use the double curly brace syntax with the $env prefix.

{{ $env.VAR_NAME }}

Example Scenarios:

  • HTTP Request Node: Use {{ $env.BASE_API_URL }} in the URL field instead of typing out the full endpoint manually.
  • Header Configuration: Bind an Authorization header by setting its value to: Bearer {{ $env.PRIVATE_ACCESS_TOKEN }}.
  • Set Node: You can assign a workspace variable to your local workflow payload using the Set Node, referencing it directly.

Security & Best Practices

Workspace Variables are stored directly on your database and resolved at the engine level.

  • Role-Based Access: Only users with the OWNER or ADMIN roles can view or modify workspace variables. Normal members and viewers cannot access the raw values.
  • Keep it Global: Use this feature for global settings (like third-party API tokens, global notification webhooks, or environment flags like production vs staging). For workflow-specific states, consider using Execution Variables instead.