Environment variable
A configuration value stored outside your workflow code API keys, passwords, URLs. Using environment variables instead of hardcoding credentials is essential for security and makes workflows portable across staging and production.
Expert insight
Storing API keys and secrets as environment variables instead of hardcoding them into a workflow isn't just security hygiene, it's what makes moving a workflow from staging to production possible without editing the workflow itself: the code stays identical, only the environment variables change between the two.
In a real workflow
The base URL of the API differs between staging and production and is read from an environment variable rather than hard-coded.
Common mistakes
- Committing secrets in environment files to a repository.
- Having different variable names in each environment.
Complexity level
Requires some familiarity with automation concepts.
Related terms
See it in action
Want Environment variable built into your automation?
Book a free audit and we'll show you exactly how this applies to your business.
Get my free automation plan →Who we build for
Run a firm, an agency or an online store? We automate the work behind it.
Done-for-you n8n workflows and Claude AI agents, fixed price, maintained for you.
- Professional firms Onboarding, documents, billing and reporting run on their own. See what we automate →
- Agencies and SaaS teams Custom n8n and Claude builds, client reporting and internal tools. See what we automate →
- E-commerce brands Orders, support, returns and stock handled without the busywork. See what we automate →
More in Security
Keep exploring
JWT (JSON Web Token)
A compact, self-contained authentication token used by many APIs. JWTs…
OAuth (Open Authorisation)
An authentication standard that lets users grant third-party apps acce…
Token (API)
A credential string used to authenticate API requests. Tokens are eith…
Webhook security
Verifying that incoming webhooks are genuinely from the expected sourc…
Access token
A short-lived credential issued after OAuth authentication that grants…
Audit trail
A chronological record of all actions taken by an automation who trigg…
Go deeper
Guides that cover Environment variable
n8n API: The Complete Guide to Automating n8n Itself (2026)
n8n has a full REST API for managing workflows, executions, and credentials programmatically. Here's how to actually use it, with real authentication setup and common patterns.
n8n Self-Hosted PostgreSQL: Setup and Schema Guide (2026)
n8n defaults to SQLite for self-hosted setups, which breaks down fast beyond hobby use. Here's how to properly configure PostgreSQL, and what the schema actually looks like once you're in production.
n8n Docker: The Production Deployment Guide (2026)
Running n8n via Docker for a quick test is one command. Running it reliably in production is a different exercise entirely. Here's the real Docker Compose setup we deploy for clients.