Environments & Variables
Maeris environments let you store named variables that are injected into API requests at runtime. This allows you to run the same collection against multiple targets — local, staging, production — by simply switching the active environment.
Managing Environments
Use these commands to create and manage environments:
# List all environments for the current application maeris env list # Create a new environment maeris env create staging maeris env create production maeris env create local # Rename an environment maeris env rename staging "Staging (US-East)" # Delete an environment maeris env delete old-envManaging Environment Variables
Add, view, update, and delete key-value pairs within an environment:
# List all variables in an environment maeris env data list staging # Add a variable maeris env data add staging --key base_url --value https://api-staging.example.com maeris env data add staging --key auth_token --value eyJhbGci... # Update an existing variable maeris env data update staging --key base_url --value https://api2-staging.example.com # Delete a variable maeris env data delete staging --key auth_tokenSelecting and Viewing Active Environment
Set the active environment that will be used when running APIs or flows:
# Select an environment to be active maeris env select staging # View the currently active environment maeris env currentThe active environment's variables are automatically injected when you run any API, collection, or flow. Example output of maeris env current:
Active environment: staging
base_url = https://api-staging.example.com
auth_token = eyJhbGci... (hidden)
timeout_ms = 5000Variable Syntax in API Requests
Use double curly-brace syntax to reference environment variables in API URLs, headers, and request bodies:
URL example
{"{{base_url}}/api/users/{{user_id}}"}Header example
Authorization: Bearer {{auth_token}}Request body example
{
"org_id": "{{org_id}}",
"region": "{{deployment_region}}"
}At runtime, {{base_url}} is replaced with the value stored in the active environment.
Switching Between Staging and Production
A common workflow is to maintain separate environments for local development, staging, and production:
# Test against staging maeris env select staging maeris collection run "My API Collection" # Promote to production maeris env select production maeris collection run "My API Collection"Secret variable values
Mark sensitive variables (API keys, tokens) as secret in the Maeris Portal. Secret values are stored encrypted and are not visible in plain text to other team members, though they are still injected into requests during runs.
Next Steps
With environments configured, you can build multi-step API flows that chain requests together and pass values between steps. See the API Flows (Multi-Step Chains) guide.