No results for ""
EXPAND ALL
  • Home
  • API docs

GIVE DOCS FEEDBACK

Deprecating, archiving, and deleting flags

Read time: 9 minutes
Last edited: Jun 05, 2024

Overview

This topic explains how to deprecate or archive flags you no longer need, or delete flags that are archived.

About 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.

About 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.

Deprecate flags

To deprecate a flag:

  1. Navigate to the flags list.
  2. Hover on the flag you wish to deprecate, and click the three-dot overflow menu that appears.
  3. Click Manage flag settings.
  4. In the "Deprecate flag" section, click Deprecate. The "Deprecate flag" dialog appears.
  5. 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.
Deprecating a flag affects 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. Deprecating a flag will remove it from the live flags list for every environment in the project.

  1. 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 View and restore flags.

Archive flags

  1. Navigate to the flags list.

  2. Hover on the flag you wish to deprecate, and click the three-dot overflow menu that appears.

  3. Click Manage flag settings.

  4. In the "Archive flag" section, click 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.
    A flag that cannot be archived due to dependencies.

    To learn how to resolve flag dependencies, read Resolve dependencies.

  5. 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:

A flag with no dependencies that you can archive.
A flag with no dependencies that you can archive.

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. Archiving a flag will remove it from every environment in the project. Be absolutely certain you can archive a flag without any unintended impact.

  1. Type the flag's name in the Archive flag text box.
  2. 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 View and restore flags.

Archived flags serve their fallback values if requested

If end users request a flag after you archive it, the flag value that returns is the fallback value you defined in code.

Resolve dependencies

There are three types of flag dependencies:

  • 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

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 if the flag's dependent flags themselves are archived, the dependency will still block you from archiving the prerequisite flag. If you attempt to archive a prerequisite flag, the "Archive this flag?" panel prevents you from doing so.

The other two dependencies will not stop you from archiving a flag, but we recommend resolving all dependencies before you archive a flag.

Here is a screenshot of the "Archive this flag?" panel:

A flag with dependencies that do not block it from being archived.
A flag with dependencies that do not block it from being archived.

View and restore flags

By default, the flags list shows live flags only.

To view deprecated flags or archived flags, click Filters from the flags list and select "Archived" or "Deprecated" under "Lifecycle":

The flags list Filters, with the lifecycle options shown.
The flags list Filters, with the lifecycle options shown.

To restore a deprecated flag:

  1. Navigate to the flags list.
  2. Click Filters. In the "Lifecycle" section, click "Deprecated." The deprecated flag list appears.
  3. Hover on the flag you wish to restore, and click the three-dot overflow menu that appears.
  4. Click Manage flag settings.
  5. In the "Restore flag" section, click Restore. The "Restore flag" dialog appears.
  6. 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.
  7. Click Restore. The flag appears in the live flags list.

To restore an archived flag:

  1. Navigate to the flags list.
  2. Click Filters. In the "Lifecycle" section, click "Archived." The archived flag list appears.
  3. Hover on the flag you wish to restore, and click the three-dot overflow menu that appears.
  4. Click Manage flag settings.
  5. In the "Restore flag" section, click Restore. The "Restore flag" panel appears.
  6. The panel 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.
  7. Type the flag's name in the Restore flag text box.
  8. Click Restore. The flag appears in the live flags list.
Restoring a flag means it will be evaluated again

When you restore a 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.

Delete 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 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.

Deleted flags are gone forever

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:

  1. Navigate to the flags list.
  2. Click Filters. In the "Lifecycle" section, click "Archived." The archived flag list appears.
  3. Hover on the flag you wish to delete, and click the three-dot overflow menu that appears.
  4. Click Manage flag settings.
  5. In "Delete flag" section, click "Delete this flag." The "Delete this flag?" dialog appears.
  6. Type the flag's name or key in the confirmation text field to confirm.
  7. Click Delete.

The flag is deleted permanently.

You can also use the REST API: Delete feature flag