> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Archiving and restoring flags

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

This topic explains how to archive flags you no longer need and how to restore archived flags. Archiving a flag removes it from your **Flags** list in LaunchDarkly without deleting it. LaunchDarkly helps you identify flags that you can remove from your code, then prompts you to archive these flags.

Archiving flags you no longer need is part of the [flag lifecycle](/docs/home/flags/flag-status#flag-lifecycle-stages), and can help reduce the [technical debt](/docs/guides/flags/technical-debt) that you may accumulate as you use flags throughout your organization.

## About archiving

LaunchDarkly considers flags ready to archive when they meet all of the criteria specified in the [flag lifecycle settings](/docs/home/flags/flag-lifecycle-settings).

Before you archive a flag in LaunchDarkly, remove the flag from your code. If your application evaluates an archived flag, LaunchDarkly serves the flag's [fallback value](/docs/home/getting-started/vocabulary#fallback-value), which is the value you defined in code. The code references feature can help you quickly identify all the places your code references a flag. To learn more, read [Code references](/docs/home/flags/code-references).

<Tip>
  **Review "Ready for code removal" as well**

  To filter for flags that are ready for code removal, navigate to the **Flags** list, open the **Filters** menu, and use the "Lifecycle" filter "Ready for code removal."
</Tip>

<Danger>
  **Archiving a flag removes it from every environment in your project**

  All flags exist in every environment for a project, but often only a few environments matter for your organization's production processes. We recommend archiving all flags that are ready to archive in your [critical environments](/docs/home/account/environment#critical-environments). However, archiving a flag removes it from every environment in the project. Be certain you can archive a flag without any unintended impact.
</Danger>

## Archive flags

You can filter the **Flags** list to find flags that are ready to archive. You can archive a flag from the **Cleanup** shortcut or from the flag's right sidebar.

### Filter for flags that are ready to archive

To filter the **Flags** list for flags that are ready to archive:

1. In the left sidebar, click **Code**. The CodeControl menu appears.
2. Click **Flags**.
3. Open the **Filters** menu.
4. Under "Lifecycle," select **Ready to archive**:

   <Frame caption="The project-level Filters menu, with &#x22;Ready to archive&#x22; selected.">
     <img src="https://mintcdn.com/launchdarkly/hutarVphEq2dY_zb/images/auto/flags-list-filter-ready-to-archive.auto.png?fit=max&auto=format&n=hutarVphEq2dY_zb&q=85&s=a44a3bcaed6c1136d5f2292df1c7b89c" alt="The project-level Filters menu, with &#x22;Ready to archive&#x22; selected." width="568" height="676" data-path="images/auto/flags-list-filter-ready-to-archive.auto.png" />
   </Frame>

To archive a flag you find this way, open the flag and follow the steps in [Archive a flag from its right sidebar](#archive-a-flag-from-its-right-sidebar).

### Archive a flag from the Cleanup shortcut

The **Cleanup** shortcut is built in and available by default in every project. It lists the flags that are ready to archive.

To archive a flag from the **Cleanup** shortcut:

1. In the left sidebar, click the **Cleanup** shortcut. A list of flags that are ready to archive appears.

2. Find the flag to archive, then click its **three-dot** overflow menu.

3. Click **Archive**. The archive dialog appears:

   <Frame caption="The archive dialog.">
     <img src="https://mintcdn.com/launchdarkly/A4UXoRTW8ATNw4yq/images/auto/ready-to-archive-dialog.auto.png?fit=max&auto=format&n=A4UXoRTW8ATNw4yq&q=85&s=8bcae688f99b7049d639eecc1499ae36" alt="The archive dialog." width="1436" height="1102" data-path="images/auto/ready-to-archive-dialog.auto.png" />
   </Frame>

4. Review the archive checks to confirm that the flag is ready to archive. To learn more, read [Archive checks](#archive-checks).

5. Enter a **Comment** to let other members in your organization know why you are archiving the flag.

6. Click **Archive**.

LaunchDarkly archives the flag and removes it from the unfiltered **Flags** list. You can find it in the archived **Flags** list. To learn more, read [View archived flags](#view-archived-flags).

You can also create customized shortcuts with your preferred filters. For example, you could create a shortcut that includes only flags that are ready to archive and are also maintained by you or your team. To learn more about shortcuts, read [Save shortcuts to filtered flags lists](/docs/home/flags/list#save-shortcuts-to-filtered-flags-lists).

### Archive a flag from its right sidebar

To archive a flag from its right sidebar:

1. In the left sidebar, click **Code**. The CodeControl menu appears.

2. Click **Flags**.

3. Open the flag to archive.

4. Click the **three-dot** overflow menu in the right sidebar.

5. Select **Archive**. The "Archive flag" panel appears.
   * If the flag is a prerequisite for other flags, you cannot archive it. To learn more, read [Archive checks](#archive-checks).

6. Review any warnings. A warning displays for each critical environment in which the flag is not ready to archive. Click the warning message to show more information about why the flag is not ready to archive:

   <Frame caption="Warnings when archiving a flag.">
     <img src="https://mintcdn.com/launchdarkly/Y_qcqLWSC5ccm6eB/images/__LD_UI_no_test/flag-archive-warnings.png?fit=max&auto=format&n=Y_qcqLWSC5ccm6eB&q=85&s=38888fab2e6ee0f9eb342365a687602c" alt="Warnings when archiving a flag." width="1274" height="973" data-path="images/__LD_UI_no_test/flag-archive-warnings.png" />
   </Frame>

7. Enter a reason for archiving the flag.

8. Click **Archive**.

LaunchDarkly archives the flag and removes it from the **Flags** list. You can find it in the archived **Flags** list. To learn more, read [View archived flags](#view-archived-flags).

### Archive checks

LaunchDarkly runs three archive checks to confirm whether a flag is ready to archive:

* The flag is a prerequisite for other dependent flags
* The flag is serving multiple variations
* The flag has been requested in the last seven days

Only the first check blocks archiving. You cannot archive a flag that is a prerequisite for other flags. You must remove the flag as a prerequisite before you can archive it. Even after you archive the flag's dependent flags, the prerequisite relationship still blocks you from archiving the prerequisite flag.

The other two checks do not stop you from archiving a flag, but we recommend resolving them before you archive it.

Here is the "Archive flag" panel for a flag that fails checks that do not block archiving:

<Frame caption="A flag with dependencies that do not prevent you from archiving it.">
  <img src="https://mintcdn.com/launchdarkly/hutarVphEq2dY_zb/images/auto/flag-archive-mixed-dependencies.auto.png?fit=max&auto=format&n=hutarVphEq2dY_zb&q=85&s=3c47c26d9aca7d8f11d06c34421989d7" alt="A flag with dependencies that do not prevent you from archiving it." width="1200" height="976" data-path="images/auto/flag-archive-mixed-dependencies.auto.png" />
</Frame>

To learn more about archive checks, read [Description of checks](/docs/home/releases/flag-health#description-of-checks).

## View and restore archived flags

You can view archived flags from the **Flags** list, and restore an archived flag to return it to evaluation.

### View archived flags

By default, the **Flags** list shows live flags only.

To view archived flags, click **Filters** from the **Flags** list and select **Archived** under "Lifecycle":

<Frame caption="The Flags list Filters, with the lifecycle options shown.">
  <img src="https://mintcdn.com/launchdarkly/hutarVphEq2dY_zb/images/auto/flags-list-filter-lifecycle-highlighted.auto.png?fit=max&auto=format&n=hutarVphEq2dY_zb&q=85&s=f8722be50b3a0003a0d7fbcead6f5cfd" alt="The Flags list Filters, with the lifecycle options shown." width="568" height="698" data-path="images/auto/flags-list-filter-lifecycle-highlighted.auto.png" />
</Frame>

### Restore an archived flag

When you restore a flag, LaunchDarkly evaluates it again like any other flag, instead of serving its fallback value to your application.

To restore an archived flag:

1. In the left sidebar, click **Code**. The CodeControl menu appears.
2. Click **Flags**.
3. Click **Filters**. Under "Lifecycle," select **Archived**. The archived flag list appears.
4. Click the name of the flag to restore. The "Restore this flag" panel appears.
5. Review recent evaluations of the flag shown in the panel. Choose the environments your team or customers depend on to confirm that restoring the flag will have no unexpected consequences.
6. Enter a comment to explain why you are restoring the flag.
7. Enter the name of the flag.
8. Click **Restore**. The flag's **Targeting** tab appears.

## Delete an archived flag

If an archived flag is no longer in use, you can permanently delete it from the **Flags** list. Deleting a flag is permanent. Make sure your application no longer references it before you delete it. To learn more, read [Deleting flags](/docs/home/flags/delete).

<Card icon="https://mintcdn.com/launchdarkly/YIC2H8XW-fomhquw/assets/icons/openapi-logo.svg?fit=max&auto=format&n=YIC2H8XW-fomhquw&q=85&s=dd9578a9668a86e1a8b8c314921f204c" horizontal width="2500" height="2452" data-path="assets/icons/openapi-logo.svg">
  You can also use the REST API: [Delete feature flag API](/docs/api/feature-flags/delete-feature-flag)
</Card>
