Skip to main content
Environments help you organize your apps by deployment stage (Dev, Staging, Production) and manage environment-specific configuration through environment variables.

What are Environments?

An Environment in Autosana serves two purposes:
  1. App Organization: Group apps by deployment stage or purpose
  2. Configuration Management: Store environment-specific variables (API keys, URLs, credentials)

Creating an Environment

Step 1: Navigate to Settings

Click your profile icon or navigate to Settings from the sidebar.

Step 2: Find the Environments Section

Scroll down to the Environments section.

Step 3: Create Environment

  1. Click Create Environment
  2. Enter a name (e.g., “Development”, “Staging”, “Production”)
  3. Click Create
Your new environment appears in the list.

Managing Environment Variables

Environment variables are key-value pairs that you can reference in hooks and flow instructions. They make your flows and hooks reusable across different environments.

Adding a Variable

  1. Find your environment in the Environments section
  2. Click Add Variable or the + icon
  3. Enter the Key (e.g., TEST_EMAIL)
  4. Enter the Value (e.g., test@staging.com)
  5. Click Save or press Enter
Use UPPERCASE_WITH_UNDERSCORES for variable names (e.g., API_KEY, TEST_PASSWORD) to make them easily identifiable.

Editing a Variable

  1. Find the variable in the environment
  2. Click the pencil icon (✏️)
  3. Update the key or value
  4. Save changes

Deleting a Variable

  1. Find the variable in the environment
  2. Click the trash icon (🗑️)
  3. Confirm deletion
Deleting a variable will cause any hooks or flows that reference it to fail if they try to use ${env:VARIABLE_NAME}.

Using Environment Variables

In Hooks

Reference variables using ${env:VARIABLE_NAME} syntax:
curl -X POST ${env:API_BASE_URL}/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"${env:TEST_EMAIL}","password":"${env:TEST_PASSWORD}"}'
For scripts (Python, JS, Bash), environment variables are injected automatically and accessed via your language’s standard method (e.g., os.environ.get('TEST_EMAIL') in Python). Learn more about using variables in hooks →

In Flow Instructions

You can also use variables directly in flow instructions:
Open the app
Navigate to Settings
Enter "${env:API_KEY}" in the API Key field
Tap Save

Variable Scope

Variables are scoped to their environment:
  • Apps assigned to “Staging” environment use Staging variables
  • Apps assigned to “Production” environment use Production variables
  • Apps without an environment don’t have access to variables
The ${env:KEY} syntax also resolves runtime variables — suite variables, flow variables, hook exports, and values set by the agent — in addition to environment variables. Runtime variables take precedence over environment variables when they share the same key. See Variables for details on runtime variables, precedence, and dynamic agent variables.

Assigning Apps to Environments

During App Creation

When creating a new app:
  1. Select an environment from the Environment dropdown
  2. Complete the app creation process

For Existing Apps

  1. Navigate to the Apps page
  2. Find your app
  3. Click the Environment dropdown on the app card
  4. Select an environment

Use Cases

Development vs Production Credentials

Development Environment:
TEST_EMAIL = dev-user@example.com
TEST_PASSWORD = DevPass123
API_URL = https://api.dev.example.com
Production Environment:
TEST_EMAIL = prod-user@example.com
TEST_PASSWORD = ProdPass123
API_URL = https://api.example.com
Flow (works in both):
Log in with ${env:TEST_EMAIL} and ${env:TEST_PASSWORD}
Verify API connection to ${env:API_URL}

Feature Flags

Staging Environment:
FEATURE_NEW_CHECKOUT = true
FEATURE_BETA_UI = true
EXPERIMENTAL_MODE = enabled
Production Environment:
FEATURE_NEW_CHECKOUT = false
FEATURE_BETA_UI = false
EXPERIMENTAL_MODE = disabled
Flow (works in both):
Open settings
Enable experimental mode if ${env:EXPERIMENTAL_MODE} is "enabled"
Verify new checkout is ${env:FEATURE_NEW_CHECKOUT}

Best Practices

Use Consistent NamingEstablish a naming convention and stick to it:
  • TEST_EMAIL, TEST_PASSWORD for credentials
  • API_URL, BASE_URL for endpoints
  • FEATURE_* for feature flags
  • ENV_* for environment-specific settings
Use Variables for Anything That ChangesNot just credentials! Use variables for:
  • URLs and endpoints
  • Test data (names, addresses, etc.)
  • Configuration values
  • Feature flags

Troubleshooting

Variable Not Replacing in Hook

Possible Causes:
  • Variable name doesn’t match exactly (case-sensitive)
  • Typo in variable name
  • Wrong syntax (must be ${env:VAR_NAME})
  • App not assigned to the environment
Solutions:
  • Check variable name spelling and case
  • Use ${env:VARIABLE} — not {{VARIABLE}} or $VARIABLE
  • Verify app is assigned to the correct environment

Flow Works in One Environment but Not Another

Cause: Missing or different variables Solution:
  • Check that all required variables exist in both environments

Next Steps