Skip to main content
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, and can help reduce the 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. 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, 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.
Review “Ready for code removal” as wellTo 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.”
Archiving a flag removes it from every environment in your projectAll 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. However, archiving a flag removes it from every environment in the project. Be certain you can archive a flag without any unintended impact.

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:
    The project-level Filters menu, with "Ready to archive" selected.

    The project-level Filters menu, with "Ready to archive" selected.

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 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:
    The archive dialog.

    The archive dialog.

  4. Review the archive checks to confirm that the flag is ready to archive. To learn more, read 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. 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.

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.
  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:
    Warnings when archiving a flag.

    Warnings when archiving a flag.

  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.

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:
A flag with dependencies that do not prevent you from archiving it.

A flag with dependencies that do not prevent you from archiving it.

To learn more about archive checks, read 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”:
The Flags list Filters, with the lifecycle options shown.

The Flags list Filters, with the lifecycle options shown.

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.
You can also use the REST API: Delete feature flag API