---
title: Manage environments in Feature Experimentation
slug: feature-experimentation/docs/manage-environments-in-feature-experimentation
docTags: 
createdAt: 2026-08-05T20:39:59.000Z
---

- Optimizely Feature Experimentation

Optimizely Feature Experimentation lets you confirm behavior and run flags in isolated environments, like development or staging. This makes it easier to deploy targeted deliveries and experiments in production safely. For example, you could run a single experiment in some contexts and pause it in others, or you could turn an experiment to test it for your team and leave it off for visitors.

Every Optimizely Feature Experimentation project starts with two environments (and two datafiles).

- **Production** – Primary environment.
- **Development** – Secondary environment.

Environments have the following attributes:

| Attribute                                                    | Generation              | Description                                                                                                                                                                                                                                     |
| ------------------------------------------------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Environment-specific [datafile](docId:3LmHm4b3kTxKBuoR93KN8) | Automatically generated | Shows the state of the experiments within that environment. If you created flags and experiments in other environments in your project, they display "not running" until you start them in this environment.                                    |
| Unique SDK key                                               | Automatically generated | Determines the URL of the environment's datafile, which ensures that the URL is not easily guessed. You can use the SDK key to initialize the SDK with the corresponding environment's datafile.                                                |
| Datafile access token                                        | Automatically generated | If you create a secure environment, then you can fetch the datafile for that secure environment from an authenticated endpoint using this access token. For information, see the initialization topic for your SDK language (server-side only). |
| Environment key                                              | User-provided           | This key is used for programmatic access to the environment: for example, if you were to modify your environments using [Optimizely's REST API](docId\:CwbqaxvWjxN8pwcorN55w).                                                                  |

You should also add a Staging environment to your project to use for QA testing before running experiments in your Production environment.

## Environment permissions

:::hint{type="info"}
**Note**

If your organization uses Opti ID, you must manage users in Opti ID. See the [Opti ID user documentation](docId\:gfcl33i3WnqFAwFi9CT6y).
:::

You can control which collaborators have permission to start and stop experiments in an environment. This limits the number of people who can change your experiments' statuses or move them from one environment to another.

You should keep access open to everyone in local or development environments and limit access in production environments. By default, the production environment is limited to Publishers and above.

## Secure environments

You can secure your environments. When this setting is enabled, you must pass a datafile authentication token when you send requests to the datafile URL through the SDK. This can provide an additional layer of security and privacy to your flag rules (such as A/B tests) on top of the uniqueness and obscurity of the SDK key.

:::hint{type="warning"}
**Important**

**Server-side only**

Optimizely Feature Experimentation recommends using this feature only in projects that exclusively use server-side SDKs and implementation. If you fetch the datafiles in a client-side environment, they may become accessible to end users.
:::

## Create environments

To create an environment:

1. Go to **Settings > Environments**.
2. Click **Create New Environment** and choose **Environment** or **Secure Environment**. 

   ![Click Create new environment](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/-RUMLClzgPURJ1mZOWBzO-20260720-145745.png)
3. Enter the environment name and key. The key must contain only numbers, letters, and underscores. Specify the permission level you want to set for experiments in the environment. 

   ![Create environment page](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/2AuUbJrVfMmnjUDUGetQs-20260720-145745.png)
4. Click **Create Environment**.

The **SDK Key** and **Datafile URL** for the new environment are displayed on the **Settings** page.

### Generate an access token

If you created a secure environment, you need to generate an access token. This token must be passed into the SDK to access the datafile. Secure environments are recommended for server-side SDKs only. See [Secure environments](docId\:YpSOMYlWkUccLCL-uB-ZE).

:::hint{type="warning"}
**Important**

Once you secure an environment, you cannot revert to an unsecured environment.
:::

1. Click **Add access token** for the newly created environment.

   ![Click Add access token](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/UG8xjnYUvNmfDKYOwkcAD-20260720-145745.png)
2. Add a **Token Name** for your access token and click **Generate Token**.

   ![1d4d8c2-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/xmgHkxO-OWrBfinOg2OSY-20260720-145745.png)
3. Copy the token value from the **Settings** page. It is visible when you leave the page.

:::hint{type="warning"}
**Important**

If you do not copy the token value, you must create a new token.
:::

4. Use the generated token as the `access_token` parameter when initializing the SDK. Select your SDK for information.
   - [C#](docId\:xoqfGXRS2U3DUf8EUgtsC)
   - [Go](docId\:lA6eDbcuVC3C-SQUsCcXV)
   - [Java](docId\:WlItbLTrjYBNvKSjoGIFY)
   - [JavaScript v6+](docId:2bQ4KAFcVOAesqDOcmtCZ)
   - [JavaScript (Node)](docId\:bBBQu0Y_QWNguXJJ6sRw4) – SDK versions 5.3.5 and below
   - [PHP](docId\:xsDnjIZ8rfV8bdKdSCm3_)
   - [Python](docId:3RNo0adSzdB2ndnj5I_WC)
   - [Ruby](docId\:GZzK3CQxBF2g4uWupfu70)

:::hint{type="info"}
**Note**

Experiments are paused by default in any new environments you create, even if they were already running in the default environment.
:::

## Convert to a secure environment

You can convert an existing unsecured environment to a secure one from the actions menu. You can tell if an environment is secure by referencing the lock icon on the **Settings** page.

An unlocked icon indicates a un-secured environment.
 

![89e7d3d-unsecured.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/BL-ObOzPb5E0pKD2-V3Lh-20260720-145745.png)

A locked icon indicates a secure environment. 

![536579a-secure.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Ks2_nXwXHenrE7ndxp2r0-20260720-145745.png)

:::hint{type="warning"}
**Important**

Once you secure an environment, you cannot revert to an unsecured environment.
:::

1. Click **More options (...)** for the environment you want to secure.
2. Select **Secure** from the drop-down list.

   ![26d75f6-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/EkaZKLsxXYrDW49pdkAYl-20260720-145745.png)
3. Click **Secure** on the confirmation screen.
4. Follow the instructions for [Secure environments - generate access token](docId\:YpSOMYlWkUccLCL-uB-ZE) to complete your secure environment.

:::hint{type="warning"}
**Important**

**Update your SDK implementation**

After you convert to a secure environment you need to update your SDK implementation to initialize with the access token before you can continue to get updates from Optimizely.
:::

### (Optional) Remove unsecured datafile

After securing your datafile and updating your application to initialize the SDK with the datafile access token created in the previous step, you can manually remove the cached copy of the datafile for your environment from Optimizely's public CDN.

:::hint{type="danger"}
**Warning**

You **MUST** complete steps 1 through 4 in [Generate an access token](docId\:XEmj8NpfZYHZ_On3RATkY) before removing the unsecured datafile. Failure to do so will break your SDK implementation as the SDK will no longer be able to fetch the datafile.
:::

1. Click **Actions** for the environment you want to remove the public datafile.
2. Select **Remove Public Datafile** from the drop-down list.

   ![373d395-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8S6BwnWN1MznJqeKY2Oee-20260720-145745.png)
3. Click **Remove** on the confirmation screen.

## Rename an environment

To rename an environment:

1. Go to **Settings > Datafile**.
2. Click **Actions** for the environment you want to rename.
3. Select **Settings** from the drop-down list.

   ![cc21cb4-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/KG-0QEwhlMqr1hVfiexPK-20260720-145745.png)
4. Enter the new name for the environment and click **Save Environment**.

:::hint{type="warning"}
**Important**

**Be careful changing the datafile's environment key as it will impact the datafile URL your code loads**.

The environment key displays on the **Settings > Datafile** page; see the image in [View the datafile via the app](docId:8_kRh18IHN_0bW1xf7jYv).
:::

## Archive an environment

You can archive environments if they are not being used anymore (except the primary environment, which cannot be archived). Archiving deactivates all the datafiles in an environment, replacing them with an empty file, and removes the environment as an option for experiments.

If experiments are running in the environment when you archive it, they will stop because archiving empties the datafile.

To archive an environment:

1. Go to **Settings > Datafile**.
2. Click **Actions** for the environment you want to archive.
3. Select **Archive** from the drop-down list.

   ![d652873-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/MgQgU1-teu-iyBEtZMOlQ-20260720-145745.png)

## Results by environment

Each environment will have its own reports page. You can switch between your environments to view results for each. See [reports](docId:_dTaXmx1hedasMiRQnhAS) for information.

![6310d69-image.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/adHnbf4O-xfmAq-XsWQJJ-20260720-145745.png)
