Archiving and deleting flags
Read time: 3 minutes
Last edited: Feb 12, 2020
This topic explains how to archive flags you no longer need, or delete flags that are archived.
When a flag is no longer being served to users, 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 7 days.
You can delete an archived flag after you determine that it will no longer be needed in your project.
To archive a flag:
- Navigate to the flag dashboard.
- Find the flag you wish to archive and click Archive. The "Archive this flag?" screen appears. If the flag has dependencies, you cannot archive it. 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.
- Type the flag's name in the "Archive flag" text box.
- Click Archive.
The flag is archived and removed from the flag dashboard. You can find it in the archived flag list. To learn more, read Viewing and restoring archived flags.
Archived flags are indicated with a grey and white striped background.
You can also archive a flag from the flag's Settings page.
You cannot archive flags that are prerequisites of other flags. If you attempt to archive a prerequisite flag, the "Archive this flag?" screen prevents you from doing so.
If the flag is a prerequisite of other flags, you cannot archive it. You must remove the flag as a prerequisite before you can archive it.
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 7 days
Archived flags are visible from the flag dashboard. Click the three-dot button to see an option to view them.
Archived flags appear on their own dashboard, which is indicated with grey and white stripes.
To restore an archived flag:
- Navigate to the "Archived feature flags" screen and find the flag you wish to restore.
- Click Restore. The "Restore this flag?" screen appears.
- Confirm that the flag state is such that restoring the flag will have no unexpected consequences.
- Type the flag's name in the "Restore flag" text box.
- Click Restore. The flag appears in the flag dashboard.
You can also restore an archived flag from the flag's Settings page.
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 flag value defined in code will be returned for all users. Remove any references to the feature flag from your application code before you delete it.
To delete an archived flag:
- Click on the edit menu button (three vertical dots) next to the Flag + button.
- Click on the View archived flags dropdown. The "Archived feature flags" screen appears.
- Find the flag you wish to delete.
- Click Delete. The "Delete this flag?" screen appears.
- Type the flag's name in the checkbox to confirm.
- Click Delete.
The flag is deleted permanently.