> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/feature/admin/development-and-integration/environment-variables.md).

# Environment variables

Environment variables allow centralized management of settings reused during system integration, and you can choose regular variables or secret variables depending on data sensitivity.

## Overview

"Environment variables" can be used to centrally manage settings that are repeatedly used during system integration.

For example, in Webhooks or external service integrations, API URLs, system identifiers, API keys, Access Tokens, and other data may be reused. By using environment variables, you can first create these items centrally and then reference them in the functions that need them, avoiding the same settings being scattered in different places and making future unified maintenance easier.

Environment variables are divided into two types:

| Type             | Description                                                                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Regular variable | Suitable for storing general configuration values; after creation, the current contents can still be viewed.                                  |
| Secret variable  | Suitable for storing sensitive information such as API keys, tokens, and passwords; the original value cannot be viewed again after creation. |

{% hint style="info" %}
If the data is an API key, Access Token, password, or other sensitive information, it is recommended to use a "secret variable" to prevent the original content from continuing to appear in the management interface.
{% endhint %}

## Go to Environment Variable Management

Users with "system administration" privileges can access "Environment Variables" from the administration menu.

If the current account does not have the corresponding system administration privileges, this management entry will not be displayed.

After entering, you can view the environment variables that have already been created and add, edit, or delete them.

## Add Environment Variable

On the Environment Variable management page, click "Add" to create a new environment variable.

When creating one, you mainly need to set:

| Field           | Description                                                                                                   |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| Name            | The identifying name of the environment variable; this name will be used when referencing the variable later. |
| Value           | The actual content stored in this environment variable.                                                       |
| Secret variable | Determines whether this variable is stored as a secret.                                                       |

Before creating, determine whether to use a regular variable or a secret variable based on the nature of the data.

### Regular variable

Regular variables are suitable for storing non-sensitive configuration items, such as:

* API URL
* Fixed code
* External system identifier
* General text settings

After a regular variable is created, when you enter the edit page again later, you can still view the currently saved value and modify it directly.

### Secret variable

Secret variables are suitable for storing sensitive information that should not be displayed again, such as:

* API key
* Access Token
* Password
* Third-party service key

{% hint style="warning" %}
**After a secret variable is created, the original value cannot be viewed again.**

After creation, even if you enter the edit page again, the system will not display the secret content that was originally entered. Therefore, please make sure the input value is correct before creating a secret variable.
{% endhint %}

If you need to replace the secret content later, you can enter a new value to update it, but you cannot retrieve the previously saved original content from the system.

## Edit Environment Variable

Created environment variables can be edited from the management list.

Regular variables can be viewed and modified again. Secret variables will not display the originally saved content; if changes are needed, a new value must be entered again.

### Secret variables cannot be changed back to regular variables

Once an environment variable is set as a "secret variable," it cannot later be changed back to a regular variable.

{% hint style="danger" %}
**Secret variables are an irreversible setting; once configured, they cannot be changed back to regular variables.**

Before changing a regular variable to a secret variable, please confirm your future requirements first.
{% endhint %}

If an original secret variable later really needs to be managed as a regular variable, you should create a new environment variable separately and then adjust the reference settings in the existing functions.

## Change Environment Variable Name

The "name" of an environment variable is not only for display purposes; it may already be referenced by existing Webhooks or other integration settings.

Therefore, changing the name of an environment variable that is already in use may affect existing workflows.

{% hint style="warning" %}
**Before changing an environment variable name, please first confirm whether any Webhooks or other settings are currently referencing this variable.**

If the reference locations are still using the original name, renaming it may prevent the corresponding environment variable from being retrieved, which can cause related workflows to fail.
{% endhint %}

For variables already used in a production environment, if you need to change the name, it is recommended to create a new environment variable first, and then gradually update the related reference settings. After confirming that all usage locations have been adjusted, handle the old variable to reduce the risk of disrupting existing workflows.

## Delete Environment Variable

Environment variables that are no longer used can be deleted from the management list.

Before deleting, you should first confirm whether the variable is still being used by Webhooks or other integration functions. If you directly delete an environment variable that is still referenced, related functions may later be unable to retrieve the required settings.

For variables in a production environment, the recommended order is:

1. Confirm which functions are currently using this variable.
2. Remove or adjust the relevant references.
3. Confirm that the related workflows can run normally.
4. Then delete the environment variable that is no longer in use.

## Usage recommendations

Environment variables are suitable for managing configuration data that is reused by multiple integration workflows or may need to be changed in the future.

For example, when multiple Webhooks use the same external API Token, you can create the Token as a secret environment variable instead of writing the Token into each Webhook separately. If the Token needs to be changed later, you only need to adjust the environment variable, which reduces the risk of repeated edits and omissions.

It is recommended to manage them according to the following principles:

* Use regular variables for general configuration values.
* Use secret variables for sensitive content such as API keys, tokens, and passwords.
* Environment variable names that are already in use should be kept as stable as possible.
* Before changing a name or deleting a variable, first confirm the existing references.
* After a secret variable is created, the original value cannot be viewed. Keep an official management source for the original key separately.
* Once a secret variable is created, it cannot be changed back to a regular variable.
