Deprecating, archiving, and deleting flags
Read time: 6 minutes
Last edited: Oct 31, 2023
Overview
This topic explains how to deprecate or archive flags you no longer need, or delete flags that are archived.
Understanding deprecating
When a flag is still being served to customers, but it is only being served in older or deprecated versions of your application, it may be time to deprecate it. Deprecating a flag hides it from the live flags list without archiving or deleting it. You can restore a deprecated flag if you need it, or find it to reference or update its configuration later.
Deprecating flags can simplify your flags list, especially in situations where you have a long tail of customers using older versions of your applications.
You can only deprecate flags that are used with client-side SDKs.
Understanding archiving
When a flag is no longer being served to customers, and it is not a prerequisite of other flags, it may be time to archive it. Archiving a flag retires it from LaunchDarkly without deleting it. You can restore an archived flag if you need it, or find it to reference its configuration later.
LaunchDarkly will not let you archive a flag that is a prerequisite of other flags. Flags are good candidates for archival when they are serving only one variation in the environment you choose and have not been requested in the last seven days.
When you archive a flag in LaunchDarkly, you should also remove the flag from your code. LaunchDarkly's code references feature can help you quickly identify all the places a flag is referenced in your code. To learn more, read Code references.
If you do not remove a flag from your code after you archive it, then all end users encountering the feature will receive the flag's fallback value.
Configure your SDK: Configuring variations
You can delete an archived flag after you determine your project no longer needs it.
Deprecating flags
To deprecate a flag:
- Navigate to the flags list.
- Find the flag you wish to deprecate and click the overflow menu.
- Choose "Deprecate flag." The "Deprecate flag" dialog appears.
- The dialog shows you how the flag has been evaluated recently. Choose the environments your team or customers depend on to confirm you can deprecate the flag without unintended consequences.
All flags exist in every environment for a project, but often only a few environments matter for your organization's production processes. Deprecating a flag will remove it from the live flags list for every environment in the project.
- Click Deprecate.
The flag is deprecated and removed from the live flags list. You can find it in the deprecated flags list. To learn more, read Viewing and restoring flags.
Archiving flags
To archive a flag:
-
Navigate to the flags list.
-
Find the flag you wish to archive and click the overflow menu.
-
Choose "Archive." The "Archive this flag?" panel appears.
- If the flag has dependencies, you cannot archive it:
A flag that cannot be archived due to dependencies. To learn how to resolve flag dependencies, read Resolving dependencies.
-
Choose the environments your team or customers depend on to confirm you can archive the flag from those environments without unintended consequences. Verify that the flag is not in use by reviewing its states in the flag archive fields:

All flags exist in every environment for a project, but often only a few environments matter for your organization's production processes. Archiving a flag will remove it from every environment in the project. Be absolutely certain you can archive a flag without any unintended impact.
- Type the flag's name in the Archive flag text box.
- Click Archive.
The flag is archived and removed from the flags list. You can find it in the archived flags list. To learn more, read Viewing and restoring flags.
If end users request a flag after you archive it, the flag value that returns is the value you defined in code.
You can also archive a flag from the flag's Settings tab.
Resolving dependencies
You cannot archive flags that are prerequisites of other flags. You must remove the flag as a prerequisite before you can archive it. If you attempt to archive a prerequisite flag, the "Archive this flag?" panel prevents you from doing so.
Other dependencies will not stop you from archiving a flag, but we recommend resolving all dependencies before you archive a flag.
These dependencies are:
- The flag is serving multiple variations
- The flag has been requested in the last seven days
Here is a screenshot of the "Archive this flag?" panel:

Viewing and restoring flags
By default, the flags list shows live flags only.
To view deprecated flags or archived flags, use the view switcher to change which flags appear in the list:

To restore a deprecated flag:
- Use the view switcher to navigate to the "Deprecated flags" list.
- Find the flag you wish to restore.
- In the overflow menu, choose "Restore deprecated flag." The "Restore flag" dialog appears.
- The dialog shows you how the flag has been evaluated recently. Choose the environments your team or customers depend on to confirm that restoring the flag will have no unexpected consequences.
- Click Restore. The flag appears in the live flags list.
To restore an archived flag:
- Use the view switcher to navigate to the "Archived flags" list.
- Find the flag you wish to restore.
- In the overflow menu, choose "Restore flag."
- Confirm that the flag state is such that restoring the flag will have no unexpected consequences.
When you restore an archived flag, it returns to evaluation just like any other flag. This is why it is important to confirm that the flag will have no unexpected impact after you restore it.
- Type the flag's name in the Restore flag text box.
- Click Restore. The flag appears in the live flags list.
Deleting archived flags
After you archive a flag, you can delete it if you no longer need it.
If you delete a flag, its rules will be deleted. Should it be requested again, the fallback flag value defined in code will be returned for all contexts. Remove any references to the feature flag from your application code before you delete it.
If you delete a flag, you cannot restore it. Be absolutely certain you do not need a flag anymore before you delete it.
To delete an archived flag:
- Navigate to the "Archived feature flags" screen and find the flag you wish to delete.
- In the overflow menu, choose "Delete flag." The "Restore this flag?" dialog appears.
- Type the flag's name in the confirmation text field to confirm.
- Click Delete.
The flag is deleted permanently.
You can also use the REST API: Delete feature flag