Class FeatureFlagsApi


  • public class FeatureFlagsApi
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FeatureFlag copyFeatureFlag​(java.lang.String projectKey, java.lang.String featureFlagKey, FlagCopyConfigPost flagCopyConfigPost)
      Copy feature flag > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan.
      okhttp3.Call copyFeatureFlagAsync​(java.lang.String projectKey, java.lang.String featureFlagKey, FlagCopyConfigPost flagCopyConfigPost, ApiCallback<FeatureFlag> _callback)
      Copy feature flag (asynchronously) > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan.
      okhttp3.Call copyFeatureFlagCall​(java.lang.String projectKey, java.lang.String featureFlagKey, FlagCopyConfigPost flagCopyConfigPost, ApiCallback _callback)
      Build call for copyFeatureFlag
      ApiResponse<FeatureFlag> copyFeatureFlagWithHttpInfo​(java.lang.String projectKey, java.lang.String featureFlagKey, FlagCopyConfigPost flagCopyConfigPost)
      Copy feature flag > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan.
      void deleteFeatureFlag​(java.lang.String projectKey, java.lang.String featureFlagKey)
      Delete feature flag Delete a feature flag in all environments.
      okhttp3.Call deleteFeatureFlagAsync​(java.lang.String projectKey, java.lang.String featureFlagKey, ApiCallback<java.lang.Void> _callback)
      Delete feature flag (asynchronously) Delete a feature flag in all environments.
      okhttp3.Call deleteFeatureFlagCall​(java.lang.String projectKey, java.lang.String featureFlagKey, ApiCallback _callback)
      Build call for deleteFeatureFlag
      ApiResponse<java.lang.Void> deleteFeatureFlagWithHttpInfo​(java.lang.String projectKey, java.lang.String featureFlagKey)
      Delete feature flag Delete a feature flag in all environments.
      ApiClient getApiClient()  
      java.lang.String getCustomBaseUrl()  
      ExpiringTargetGetResponse getExpiringContextTargets​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.
      okhttp3.Call getExpiringContextTargetsAsync​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback<ExpiringTargetGetResponse> _callback)
      Get expiring context targets for feature flag (asynchronously) Get a list of context targets on a feature flag that are scheduled for removal.
      okhttp3.Call getExpiringContextTargetsCall​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback _callback)
      Build call for getExpiringContextTargets
      ApiResponse<ExpiringTargetGetResponse> getExpiringContextTargetsWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.
      ExpiringUserTargetGetResponse getExpiringUserTargets​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get expiring user targets for feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint.
      okhttp3.Call getExpiringUserTargetsAsync​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback<ExpiringUserTargetGetResponse> _callback)
      Get expiring user targets for feature flag (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint.
      okhttp3.Call getExpiringUserTargetsCall​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback _callback)
      Build call for getExpiringUserTargets
      ApiResponse<ExpiringUserTargetGetResponse> getExpiringUserTargetsWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get expiring user targets for feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint.
      FeatureFlag getFeatureFlag​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, java.lang.String expand)
      Get feature flag Get a single feature flag by key.
      okhttp3.Call getFeatureFlagAsync​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, java.lang.String expand, ApiCallback<FeatureFlag> _callback)
      Get feature flag (asynchronously) Get a single feature flag by key.
      okhttp3.Call getFeatureFlagCall​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, java.lang.String expand, ApiCallback _callback)
      Build call for getFeatureFlag
      FeatureFlags getFeatureFlags​(java.lang.String projectKey, java.lang.String env, java.lang.String tag, java.lang.Long limit, java.lang.Long offset, java.lang.Boolean archived, java.lang.Boolean summary, java.lang.String filter, java.lang.String sort, java.lang.Boolean compare, java.lang.String expand)
      List feature flags Get a list of all feature flags in the given project.
      okhttp3.Call getFeatureFlagsAsync​(java.lang.String projectKey, java.lang.String env, java.lang.String tag, java.lang.Long limit, java.lang.Long offset, java.lang.Boolean archived, java.lang.Boolean summary, java.lang.String filter, java.lang.String sort, java.lang.Boolean compare, java.lang.String expand, ApiCallback<FeatureFlags> _callback)
      List feature flags (asynchronously) Get a list of all feature flags in the given project.
      okhttp3.Call getFeatureFlagsCall​(java.lang.String projectKey, java.lang.String env, java.lang.String tag, java.lang.Long limit, java.lang.Long offset, java.lang.Boolean archived, java.lang.Boolean summary, java.lang.String filter, java.lang.String sort, java.lang.Boolean compare, java.lang.String expand, ApiCallback _callback)
      Build call for getFeatureFlags
      FlagStatusRep getFeatureFlagStatus​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get feature flag status Get the status for a particular feature flag.
      FeatureFlagStatusAcrossEnvironments getFeatureFlagStatusAcrossEnvironments​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env)
      Get flag status across environments Get the status for a particular feature flag across environments.
      okhttp3.Call getFeatureFlagStatusAcrossEnvironmentsAsync​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, ApiCallback<FeatureFlagStatusAcrossEnvironments> _callback)
      Get flag status across environments (asynchronously) Get the status for a particular feature flag across environments.
      okhttp3.Call getFeatureFlagStatusAcrossEnvironmentsCall​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, ApiCallback _callback)
      Build call for getFeatureFlagStatusAcrossEnvironments
      ApiResponse<FeatureFlagStatusAcrossEnvironments> getFeatureFlagStatusAcrossEnvironmentsWithHttpInfo​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env)
      Get flag status across environments Get the status for a particular feature flag across environments.
      okhttp3.Call getFeatureFlagStatusAsync​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback<FlagStatusRep> _callback)
      Get feature flag status (asynchronously) Get the status for a particular feature flag.
      okhttp3.Call getFeatureFlagStatusCall​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, ApiCallback _callback)
      Build call for getFeatureFlagStatus
      FeatureFlagStatuses getFeatureFlagStatuses​(java.lang.String projectKey, java.lang.String environmentKey)
      List feature flag statuses Get a list of statuses for all feature flags.
      okhttp3.Call getFeatureFlagStatusesAsync​(java.lang.String projectKey, java.lang.String environmentKey, ApiCallback<FeatureFlagStatuses> _callback)
      List feature flag statuses (asynchronously) Get a list of statuses for all feature flags.
      okhttp3.Call getFeatureFlagStatusesCall​(java.lang.String projectKey, java.lang.String environmentKey, ApiCallback _callback)
      Build call for getFeatureFlagStatuses
      ApiResponse<FeatureFlagStatuses> getFeatureFlagStatusesWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey)
      List feature flag statuses Get a list of statuses for all feature flags.
      ApiResponse<FlagStatusRep> getFeatureFlagStatusWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey)
      Get feature flag status Get the status for a particular feature flag.
      ApiResponse<FeatureFlags> getFeatureFlagsWithHttpInfo​(java.lang.String projectKey, java.lang.String env, java.lang.String tag, java.lang.Long limit, java.lang.Long offset, java.lang.Boolean archived, java.lang.Boolean summary, java.lang.String filter, java.lang.String sort, java.lang.Boolean compare, java.lang.String expand)
      List feature flags Get a list of all feature flags in the given project.
      ApiResponse<FeatureFlag> getFeatureFlagWithHttpInfo​(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String env, java.lang.String expand)
      Get feature flag Get a single feature flag by key.
      int getHostIndex()  
      ExpiringTargetPatchResponse patchExpiringTargets​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest)
      Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag.
      okhttp3.Call patchExpiringTargetsAsync​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest, ApiCallback<ExpiringTargetPatchResponse> _callback)
      Update expiring context targets on feature flag (asynchronously) Schedule a context for removal from individual targeting on a feature flag.
      okhttp3.Call patchExpiringTargetsCall​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest, ApiCallback _callback)
      Build call for patchExpiringTargets
      ApiResponse<ExpiringTargetPatchResponse> patchExpiringTargetsWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest)
      Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag.
      ExpiringUserTargetPatchResponse patchExpiringUserTargets​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest)
      Update expiring user targets on feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint.
      okhttp3.Call patchExpiringUserTargetsAsync​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest, ApiCallback<ExpiringUserTargetPatchResponse> _callback)
      Update expiring user targets on feature flag (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint.
      okhttp3.Call patchExpiringUserTargetsCall​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest, ApiCallback _callback)
      Build call for patchExpiringUserTargets
      ApiResponse<ExpiringUserTargetPatchResponse> patchExpiringUserTargetsWithHttpInfo​(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String featureFlagKey, PatchFlagsRequest patchFlagsRequest)
      Update expiring user targets on feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint.
      FeatureFlag patchFeatureFlag​(java.lang.String projectKey, java.lang.String featureFlagKey, PatchWithComment patchWithComment)
      Update feature flag Perform a partial update to a feature flag.
      okhttp3.Call patchFeatureFlagAsync​(java.lang.String projectKey, java.lang.String featureFlagKey, PatchWithComment patchWithComment, ApiCallback<FeatureFlag> _callback)
      Update feature flag (asynchronously) Perform a partial update to a feature flag.
      okhttp3.Call patchFeatureFlagCall​(java.lang.String projectKey, java.lang.String featureFlagKey, PatchWithComment patchWithComment, ApiCallback _callback)
      Build call for patchFeatureFlag
      ApiResponse<FeatureFlag> patchFeatureFlagWithHttpInfo​(java.lang.String projectKey, java.lang.String featureFlagKey, PatchWithComment patchWithComment)
      Update feature flag Perform a partial update to a feature flag.
      FeatureFlag postFeatureFlag​(java.lang.String projectKey, FeatureFlagBody featureFlagBody, java.lang.String clone)
      Create a feature flag Create a feature flag with the given name, key, and variations.
      okhttp3.Call postFeatureFlagAsync​(java.lang.String projectKey, FeatureFlagBody featureFlagBody, java.lang.String clone, ApiCallback<FeatureFlag> _callback)
      Create a feature flag (asynchronously) Create a feature flag with the given name, key, and variations.
      okhttp3.Call postFeatureFlagCall​(java.lang.String projectKey, FeatureFlagBody featureFlagBody, java.lang.String clone, ApiCallback _callback)
      Build call for postFeatureFlag
      ApiResponse<FeatureFlag> postFeatureFlagWithHttpInfo​(java.lang.String projectKey, FeatureFlagBody featureFlagBody, java.lang.String clone)
      Create a feature flag Create a feature flag with the given name, key, and variations.
      void setApiClient​(ApiClient apiClient)  
      void setCustomBaseUrl​(java.lang.String customBaseUrl)  
      void setHostIndex​(int hostIndex)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FeatureFlagsApi

        public FeatureFlagsApi()
      • FeatureFlagsApi

        public FeatureFlagsApi​(ApiClient apiClient)
    • Method Detail

      • getApiClient

        public ApiClient getApiClient()
      • setApiClient

        public void setApiClient​(ApiClient apiClient)
      • getHostIndex

        public int getHostIndex()
      • setHostIndex

        public void setHostIndex​(int hostIndex)
      • getCustomBaseUrl

        public java.lang.String getCustomBaseUrl()
      • setCustomBaseUrl

        public void setCustomBaseUrl​(java.lang.String customBaseUrl)
      • copyFeatureFlagCall

        public okhttp3.Call copyFeatureFlagCall​(java.lang.String projectKey,
                                                java.lang.String featureFlagKey,
                                                FlagCopyConfigPost flagCopyConfigPost,
                                                ApiCallback _callback)
                                         throws ApiException
        Build call for copyFeatureFlag
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        flagCopyConfigPost - (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • copyFeatureFlag

        public FeatureFlag copyFeatureFlag​(java.lang.String projectKey,
                                           java.lang.String featureFlagKey,
                                           FlagCopyConfigPost flagCopyConfigPost)
                                    throws ApiException
        Copy feature flag > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/). Copy flag settings from a source environment to a target environment. By default, this operation copies the entire flag configuration. You can use the `includedActions` or `excludedActions` to specify that only part of the flag configuration is copied. If you provide the optional `currentVersion` of a flag, this operation tests to ensure that the current flag version in the environment matches the version you've specified. The operation rejects attempts to copy flag settings if the environment's current version of the flag does not match the version you've specified. You can use this to enforce optimistic locking on copy attempts.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        flagCopyConfigPost - (required)
        Returns:
        FeatureFlag
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • copyFeatureFlagWithHttpInfo

        public ApiResponse<FeatureFlag> copyFeatureFlagWithHttpInfo​(java.lang.String projectKey,
                                                                    java.lang.String featureFlagKey,
                                                                    FlagCopyConfigPost flagCopyConfigPost)
                                                             throws ApiException
        Copy feature flag > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/). Copy flag settings from a source environment to a target environment. By default, this operation copies the entire flag configuration. You can use the `includedActions` or `excludedActions` to specify that only part of the flag configuration is copied. If you provide the optional `currentVersion` of a flag, this operation tests to ensure that the current flag version in the environment matches the version you've specified. The operation rejects attempts to copy flag settings if the environment's current version of the flag does not match the version you've specified. You can use this to enforce optimistic locking on copy attempts.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        flagCopyConfigPost - (required)
        Returns:
        ApiResponse<FeatureFlag>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • copyFeatureFlagAsync

        public okhttp3.Call copyFeatureFlagAsync​(java.lang.String projectKey,
                                                 java.lang.String featureFlagKey,
                                                 FlagCopyConfigPost flagCopyConfigPost,
                                                 ApiCallback<FeatureFlag> _callback)
                                          throws ApiException
        Copy feature flag (asynchronously) > ### Copying flag settings is an Enterprise feature > > Copying flag settings is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/). Copy flag settings from a source environment to a target environment. By default, this operation copies the entire flag configuration. You can use the `includedActions` or `excludedActions` to specify that only part of the flag configuration is copied. If you provide the optional `currentVersion` of a flag, this operation tests to ensure that the current flag version in the environment matches the version you've specified. The operation rejects attempts to copy flag settings if the environment's current version of the flag does not match the version you've specified. You can use this to enforce optimistic locking on copy attempts.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        flagCopyConfigPost - (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • deleteFeatureFlagCall

        public okhttp3.Call deleteFeatureFlagCall​(java.lang.String projectKey,
                                                  java.lang.String featureFlagKey,
                                                  ApiCallback _callback)
                                           throws ApiException
        Build call for deleteFeatureFlag
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • deleteFeatureFlag

        public void deleteFeatureFlag​(java.lang.String projectKey,
                                      java.lang.String featureFlagKey)
                               throws ApiException
        Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • deleteFeatureFlagWithHttpInfo

        public ApiResponse<java.lang.Void> deleteFeatureFlagWithHttpInfo​(java.lang.String projectKey,
                                                                         java.lang.String featureFlagKey)
                                                                  throws ApiException
        Delete feature flag Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        Returns:
        ApiResponse<Void>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • deleteFeatureFlagAsync

        public okhttp3.Call deleteFeatureFlagAsync​(java.lang.String projectKey,
                                                   java.lang.String featureFlagKey,
                                                   ApiCallback<java.lang.Void> _callback)
                                            throws ApiException
        Delete feature flag (asynchronously) Delete a feature flag in all environments. Use with caution: only delete feature flags your application no longer uses.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getExpiringContextTargetsCall

        public okhttp3.Call getExpiringContextTargetsCall​(java.lang.String projectKey,
                                                          java.lang.String environmentKey,
                                                          java.lang.String featureFlagKey,
                                                          ApiCallback _callback)
                                                   throws ApiException
        Build call for getExpiringContextTargets
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getExpiringContextTargets

        public ExpiringTargetGetResponse getExpiringContextTargets​(java.lang.String projectKey,
                                                                   java.lang.String environmentKey,
                                                                   java.lang.String featureFlagKey)
                                                            throws ApiException
        Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        ExpiringTargetGetResponse
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getExpiringContextTargetsWithHttpInfo

        public ApiResponse<ExpiringTargetGetResponse> getExpiringContextTargetsWithHttpInfo​(java.lang.String projectKey,
                                                                                            java.lang.String environmentKey,
                                                                                            java.lang.String featureFlagKey)
                                                                                     throws ApiException
        Get expiring context targets for feature flag Get a list of context targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        ApiResponse<ExpiringTargetGetResponse>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getExpiringContextTargetsAsync

        public okhttp3.Call getExpiringContextTargetsAsync​(java.lang.String projectKey,
                                                           java.lang.String environmentKey,
                                                           java.lang.String featureFlagKey,
                                                           ApiCallback<ExpiringTargetGetResponse> _callback)
                                                    throws ApiException
        Get expiring context targets for feature flag (asynchronously) Get a list of context targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getExpiringUserTargetsCall

        public okhttp3.Call getExpiringUserTargetsCall​(java.lang.String projectKey,
                                                       java.lang.String environmentKey,
                                                       java.lang.String featureFlagKey,
                                                       ApiCallback _callback)
                                                throws ApiException
        Build call for getExpiringUserTargets
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getExpiringUserTargets

        public ExpiringUserTargetGetResponse getExpiringUserTargets​(java.lang.String projectKey,
                                                                    java.lang.String environmentKey,
                                                                    java.lang.String featureFlagKey)
                                                             throws ApiException
        Get expiring user targets for feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Get a list of user targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        ExpiringUserTargetGetResponse
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getExpiringUserTargetsWithHttpInfo

        public ApiResponse<ExpiringUserTargetGetResponse> getExpiringUserTargetsWithHttpInfo​(java.lang.String projectKey,
                                                                                             java.lang.String environmentKey,
                                                                                             java.lang.String featureFlagKey)
                                                                                      throws ApiException
        Get expiring user targets for feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Get a list of user targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        ApiResponse<ExpiringUserTargetGetResponse>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getExpiringUserTargetsAsync

        public okhttp3.Call getExpiringUserTargetsAsync​(java.lang.String projectKey,
                                                        java.lang.String environmentKey,
                                                        java.lang.String featureFlagKey,
                                                        ApiCallback<ExpiringUserTargetGetResponse> _callback)
                                                 throws ApiException
        Get expiring user targets for feature flag (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring context targets for feature flag](/tag/Feature-flags#operation/getExpiringContextTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Get a list of user targets on a feature flag that are scheduled for removal.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getFeatureFlagCall

        public okhttp3.Call getFeatureFlagCall​(java.lang.String projectKey,
                                               java.lang.String featureFlagKey,
                                               java.lang.String env,
                                               java.lang.String expand,
                                               ApiCallback _callback)
                                        throws ApiException
        Build call for getFeatureFlag
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Filter configurations by environment (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getFeatureFlag

        public FeatureFlag getFeatureFlag​(java.lang.String projectKey,
                                          java.lang.String featureFlagKey,
                                          java.lang.String env,
                                          java.lang.String expand)
                                   throws ApiException
        Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment. > #### Recommended use > > This endpoint can return a large amount of information. Specifying one or multiple environments with the `env` parameter can decrease response time and overall payload size. We recommend using this parameter to return only the environments relevant to your query. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Filter configurations by environment (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        Returns:
        FeatureFlag
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagWithHttpInfo

        public ApiResponse<FeatureFlag> getFeatureFlagWithHttpInfo​(java.lang.String projectKey,
                                                                   java.lang.String featureFlagKey,
                                                                   java.lang.String env,
                                                                   java.lang.String expand)
                                                            throws ApiException
        Get feature flag Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment. > #### Recommended use > > This endpoint can return a large amount of information. Specifying one or multiple environments with the `env` parameter can decrease response time and overall payload size. We recommend using this parameter to return only the environments relevant to your query. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Filter configurations by environment (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        Returns:
        ApiResponse<FeatureFlag>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagAsync

        public okhttp3.Call getFeatureFlagAsync​(java.lang.String projectKey,
                                                java.lang.String featureFlagKey,
                                                java.lang.String env,
                                                java.lang.String expand,
                                                ApiCallback<FeatureFlag> _callback)
                                         throws ApiException
        Get feature flag (asynchronously) Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment. > #### Recommended use > > This endpoint can return a large amount of information. Specifying one or multiple environments with the `env` parameter can decrease response time and overall payload size. We recommend using this parameter to return only the environments relevant to your query. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Filter configurations by environment (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getFeatureFlagStatusCall

        public okhttp3.Call getFeatureFlagStatusCall​(java.lang.String projectKey,
                                                     java.lang.String environmentKey,
                                                     java.lang.String featureFlagKey,
                                                     ApiCallback _callback)
                                              throws ApiException
        Build call for getFeatureFlagStatus
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getFeatureFlagStatus

        public FlagStatusRep getFeatureFlagStatus​(java.lang.String projectKey,
                                                  java.lang.String environmentKey,
                                                  java.lang.String featureFlagKey)
                                           throws ApiException
        Get feature flag status Get the status for a particular feature flag.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        FlagStatusRep
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusWithHttpInfo

        public ApiResponse<FlagStatusRep> getFeatureFlagStatusWithHttpInfo​(java.lang.String projectKey,
                                                                           java.lang.String environmentKey,
                                                                           java.lang.String featureFlagKey)
                                                                    throws ApiException
        Get feature flag status Get the status for a particular feature flag.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        Returns:
        ApiResponse<FlagStatusRep>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusAsync

        public okhttp3.Call getFeatureFlagStatusAsync​(java.lang.String projectKey,
                                                      java.lang.String environmentKey,
                                                      java.lang.String featureFlagKey,
                                                      ApiCallback<FlagStatusRep> _callback)
                                               throws ApiException
        Get feature flag status (asynchronously) Get the status for a particular feature flag.
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getFeatureFlagStatusAcrossEnvironmentsCall

        public okhttp3.Call getFeatureFlagStatusAcrossEnvironmentsCall​(java.lang.String projectKey,
                                                                       java.lang.String featureFlagKey,
                                                                       java.lang.String env,
                                                                       ApiCallback _callback)
                                                                throws ApiException
        Build call for getFeatureFlagStatusAcrossEnvironments
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Optional environment filter (optional)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getFeatureFlagStatusAcrossEnvironments

        public FeatureFlagStatusAcrossEnvironments getFeatureFlagStatusAcrossEnvironments​(java.lang.String projectKey,
                                                                                          java.lang.String featureFlagKey,
                                                                                          java.lang.String env)
                                                                                   throws ApiException
        Get flag status across environments Get the status for a particular feature flag across environments.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Optional environment filter (optional)
        Returns:
        FeatureFlagStatusAcrossEnvironments
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusAcrossEnvironmentsWithHttpInfo

        public ApiResponse<FeatureFlagStatusAcrossEnvironments> getFeatureFlagStatusAcrossEnvironmentsWithHttpInfo​(java.lang.String projectKey,
                                                                                                                   java.lang.String featureFlagKey,
                                                                                                                   java.lang.String env)
                                                                                                            throws ApiException
        Get flag status across environments Get the status for a particular feature flag across environments.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Optional environment filter (optional)
        Returns:
        ApiResponse<FeatureFlagStatusAcrossEnvironments>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusAcrossEnvironmentsAsync

        public okhttp3.Call getFeatureFlagStatusAcrossEnvironmentsAsync​(java.lang.String projectKey,
                                                                        java.lang.String featureFlagKey,
                                                                        java.lang.String env,
                                                                        ApiCallback<FeatureFlagStatusAcrossEnvironments> _callback)
                                                                 throws ApiException
        Get flag status across environments (asynchronously) Get the status for a particular feature flag across environments.
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key (required)
        env - Optional environment filter (optional)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getFeatureFlagStatusesCall

        public okhttp3.Call getFeatureFlagStatusesCall​(java.lang.String projectKey,
                                                       java.lang.String environmentKey,
                                                       ApiCallback _callback)
                                                throws ApiException
        Build call for getFeatureFlagStatuses
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getFeatureFlagStatuses

        public FeatureFlagStatuses getFeatureFlagStatuses​(java.lang.String projectKey,
                                                          java.lang.String environmentKey)
                                                   throws ApiException
        List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - `new`: You created the flag fewer than seven days ago and it has never been requested. - `active`: LaunchDarkly is receiving requests for this flag, but there are either multiple variations configured, or it is toggled off, or there have been changes to configuration in the past seven days. - `inactive`: You created the feature flag more than seven days ago, and hasn't been requested within the past seven days. - `launched`: LaunchDarkly is receiving requests for this flag, it is toggled on, there is only one variation configured, and there have been no changes to configuration in the past seven days. To learn more, read [Flag statuses](https://docs.launchdarkly.com/home/code/flag-status).
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        Returns:
        FeatureFlagStatuses
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusesWithHttpInfo

        public ApiResponse<FeatureFlagStatuses> getFeatureFlagStatusesWithHttpInfo​(java.lang.String projectKey,
                                                                                   java.lang.String environmentKey)
                                                                            throws ApiException
        List feature flag statuses Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - `new`: You created the flag fewer than seven days ago and it has never been requested. - `active`: LaunchDarkly is receiving requests for this flag, but there are either multiple variations configured, or it is toggled off, or there have been changes to configuration in the past seven days. - `inactive`: You created the feature flag more than seven days ago, and hasn't been requested within the past seven days. - `launched`: LaunchDarkly is receiving requests for this flag, it is toggled on, there is only one variation configured, and there have been no changes to configuration in the past seven days. To learn more, read [Flag statuses](https://docs.launchdarkly.com/home/code/flag-status).
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        Returns:
        ApiResponse<FeatureFlagStatuses>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagStatusesAsync

        public okhttp3.Call getFeatureFlagStatusesAsync​(java.lang.String projectKey,
                                                        java.lang.String environmentKey,
                                                        ApiCallback<FeatureFlagStatuses> _callback)
                                                 throws ApiException
        List feature flag statuses (asynchronously) Get a list of statuses for all feature flags. The status includes the last time the feature flag was requested, as well as a state, which is one of the following: - `new`: You created the flag fewer than seven days ago and it has never been requested. - `active`: LaunchDarkly is receiving requests for this flag, but there are either multiple variations configured, or it is toggled off, or there have been changes to configuration in the past seven days. - `inactive`: You created the feature flag more than seven days ago, and hasn't been requested within the past seven days. - `launched`: LaunchDarkly is receiving requests for this flag, it is toggled on, there is only one variation configured, and there have been no changes to configuration in the past seven days. To learn more, read [Flag statuses](https://docs.launchdarkly.com/home/code/flag-status).
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • getFeatureFlagsCall

        public okhttp3.Call getFeatureFlagsCall​(java.lang.String projectKey,
                                                java.lang.String env,
                                                java.lang.String tag,
                                                java.lang.Long limit,
                                                java.lang.Long offset,
                                                java.lang.Boolean archived,
                                                java.lang.Boolean summary,
                                                java.lang.String filter,
                                                java.lang.String sort,
                                                java.lang.Boolean compare,
                                                java.lang.String expand,
                                                ApiCallback _callback)
                                         throws ApiException
        Build call for getFeatureFlags
        Parameters:
        projectKey - The project key (required)
        env - Filter configurations by environment (optional)
        tag - Filter feature flags by tag (optional)
        limit - The number of feature flags to return. Defaults to -1, which returns all flags (optional)
        offset - Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
        archived - Deprecated, use `filter=archived:true` instead. A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned (optional)
        summary - By default, flags do _not_ include their lists of prerequisites, targets, or rules for each environment. Set `summary=0` to include these fields for each flag returned. (optional)
        filter - A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields. (optional)
        sort - A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields. (optional)
        compare - A boolean to filter results by only flags that have differences between environments (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • getFeatureFlags

        public FeatureFlags getFeatureFlags​(java.lang.String projectKey,
                                            java.lang.String env,
                                            java.lang.String tag,
                                            java.lang.Long limit,
                                            java.lang.Long offset,
                                            java.lang.Boolean archived,
                                            java.lang.Boolean summary,
                                            java.lang.String filter,
                                            java.lang.String sort,
                                            java.lang.Boolean compare,
                                            java.lang.String expand)
                                     throws ApiException
        List feature flags Get a list of all feature flags in the given project. By default, each flag includes configurations for each environment. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the `tag` query parameter. > #### Recommended use > > This endpoint can return a large amount of information. We recommend using some or all of these query parameters to decrease response time and overall payload size: `limit`, `env`, `query`, and `filter=creationDate`. ### Filtering flags You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`. The `filter` query parameter supports the following arguments: | Filter argument | Description | Example | |-----------------------|-------------|----------------------| | `archived` | A boolean value. It filters the list to archived flags. Setting the value to `true` returns only archived flags. When this is absent, only unarchived flags are returned. | `filter=archived:true` | | `contextKindsEvaluated` | A `+`-separated list of context kind keys. It filters the list to flags which have been evaluated in the past 30 days for all of the context kinds in the list. | `filter=contextKindsEvaluated:user+application` | | `contextKindTargeted` | A string. It filters the list to flags that are targeting the given context kind key. | `filter=contextKindTargeted:user` | | `codeReferences.max` | An integer value. Use `0` to return flags that do not have code references. | `filter=codeReferences.max:0` | | `codeReferences.min` | An integer value. Use `1` to return flags that do have code references. | `filter=codeReferences.min:1` | | `creationDate` | An object with optional `before` and `after` fields whose values are Unix time in milliseconds. It filters the list to flags created in the specified range. | `filter=creationDate:{\"before\":1690527600000}` | | `evaluated` | An object that contains a key of `after` and a value in Unix time in milliseconds. It filters the list to all flags that have been evaluated since the time you specify, in the environment provided. This filter requires the `filterEnv` filter. | `filter=evaluation:{\"after\":1690527600000}` | | `filterEnv` | A string with the key of a valid environment. You must use this field for filters that are environment-specific. If there are multiple environment-specific filters, you only need to include this field once. | `filter=evaluated:{\"after\": 1590768455282},filterEnv:production,status:active` | | `followerId` | A valid member ID. It filters the list to flags that are being followed by this member. | `filter=followerId:12ab3c45de678910abc12345` | | `hasDataExport` | A boolean value. It filters the list to flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter requires the `filterEnv` filter. | `filter=hasDataExport:true,filterEnv:production` | | `hasExperiment` | A boolean value. It filters the list to flags that are used in an experiment. | `filter=hasExperiment:true` | | `maintainerId` | A valid member ID. It filters the list to flags that are maintained by this member. | `filter=maintainerId:12ab3c45de678910abc12345` | | `maintainerTeamKey` | A string. It filters the list to flags that are maintained by the team with this key. | `filter=maintainerTeamKey:example-team-key` | | `query` | A string. It filters the list to flags that include the specified string in their key or name. It is not case sensitive. | `filter=query:example` | | `sdkAvailability` | A string, one of `client`, `mobile`, `anyClient`, `server`. Using `client` filters the list to flags whose client-side SDK availability is set to use the client-side ID. Using `mobile` filters to flags set to use the mobile key. Using `anyClient` filters to flags set to use either the client-side ID or the mobile key. Using `server` filters to flags set to use neither, that is, to flags only available in server-side SDKs. | `filter=sdkAvailability:client` | | `segmentTargeted` | A string. It filters the list to flags that target the segment with this key. This filter requires the `filterEnv` filter. | `filter=segmentTargeted:example-segment-key,filterEnv:production` | | `status` | A string, either `new`, `inactive`, `active`, or `launched`. It filters the list to flags with the specified status in the specified environment. This filter requires the `filterEnv` filter. | `filter=status:active,filterEnv:production` | | `tags` | A `+`-separated list of tags. It filters the list to flags that have all of the tags in the list. | `filter=tags:beta+test` | | `type` | A string, either `temporary` or `permanent`. It filters the list to flags with the specified type. | `filter=type:permanent` | The documented values for the `filter` query are prior to URL encoding. For example, the `+` in `filter=tags:beta+test` must be encoded to `%2B`. By default, this endpoint returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page. ### Sorting flags You can sort flags based on the following fields: - `creationDate` sorts by the creation date of the flag. - `key` sorts by the key of the flag. - `maintainerId` sorts by the flag maintainer. - `name` sorts by flag name. - `tags` sorts by tags. - `targetingModifiedDate` sorts by the date that the flag's targeting rules were last modified in a given environment. It must be used with `env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment. - `type` sorts by flag type All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `codeReferences` includes code references for the feature flag - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response, and default cohort information is included in the `fallthrough` property of a flag's response. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        env - Filter configurations by environment (optional)
        tag - Filter feature flags by tag (optional)
        limit - The number of feature flags to return. Defaults to -1, which returns all flags (optional)
        offset - Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
        archived - Deprecated, use `filter=archived:true` instead. A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned (optional)
        summary - By default, flags do _not_ include their lists of prerequisites, targets, or rules for each environment. Set `summary=0` to include these fields for each flag returned. (optional)
        filter - A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields. (optional)
        sort - A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields. (optional)
        compare - A boolean to filter results by only flags that have differences between environments (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        Returns:
        FeatureFlags
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagsWithHttpInfo

        public ApiResponse<FeatureFlags> getFeatureFlagsWithHttpInfo​(java.lang.String projectKey,
                                                                     java.lang.String env,
                                                                     java.lang.String tag,
                                                                     java.lang.Long limit,
                                                                     java.lang.Long offset,
                                                                     java.lang.Boolean archived,
                                                                     java.lang.Boolean summary,
                                                                     java.lang.String filter,
                                                                     java.lang.String sort,
                                                                     java.lang.Boolean compare,
                                                                     java.lang.String expand)
                                                              throws ApiException
        List feature flags Get a list of all feature flags in the given project. By default, each flag includes configurations for each environment. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the `tag` query parameter. > #### Recommended use > > This endpoint can return a large amount of information. We recommend using some or all of these query parameters to decrease response time and overall payload size: `limit`, `env`, `query`, and `filter=creationDate`. ### Filtering flags You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`. The `filter` query parameter supports the following arguments: | Filter argument | Description | Example | |-----------------------|-------------|----------------------| | `archived` | A boolean value. It filters the list to archived flags. Setting the value to `true` returns only archived flags. When this is absent, only unarchived flags are returned. | `filter=archived:true` | | `contextKindsEvaluated` | A `+`-separated list of context kind keys. It filters the list to flags which have been evaluated in the past 30 days for all of the context kinds in the list. | `filter=contextKindsEvaluated:user+application` | | `contextKindTargeted` | A string. It filters the list to flags that are targeting the given context kind key. | `filter=contextKindTargeted:user` | | `codeReferences.max` | An integer value. Use `0` to return flags that do not have code references. | `filter=codeReferences.max:0` | | `codeReferences.min` | An integer value. Use `1` to return flags that do have code references. | `filter=codeReferences.min:1` | | `creationDate` | An object with optional `before` and `after` fields whose values are Unix time in milliseconds. It filters the list to flags created in the specified range. | `filter=creationDate:{\"before\":1690527600000}` | | `evaluated` | An object that contains a key of `after` and a value in Unix time in milliseconds. It filters the list to all flags that have been evaluated since the time you specify, in the environment provided. This filter requires the `filterEnv` filter. | `filter=evaluation:{\"after\":1690527600000}` | | `filterEnv` | A string with the key of a valid environment. You must use this field for filters that are environment-specific. If there are multiple environment-specific filters, you only need to include this field once. | `filter=evaluated:{\"after\": 1590768455282},filterEnv:production,status:active` | | `followerId` | A valid member ID. It filters the list to flags that are being followed by this member. | `filter=followerId:12ab3c45de678910abc12345` | | `hasDataExport` | A boolean value. It filters the list to flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter requires the `filterEnv` filter. | `filter=hasDataExport:true,filterEnv:production` | | `hasExperiment` | A boolean value. It filters the list to flags that are used in an experiment. | `filter=hasExperiment:true` | | `maintainerId` | A valid member ID. It filters the list to flags that are maintained by this member. | `filter=maintainerId:12ab3c45de678910abc12345` | | `maintainerTeamKey` | A string. It filters the list to flags that are maintained by the team with this key. | `filter=maintainerTeamKey:example-team-key` | | `query` | A string. It filters the list to flags that include the specified string in their key or name. It is not case sensitive. | `filter=query:example` | | `sdkAvailability` | A string, one of `client`, `mobile`, `anyClient`, `server`. Using `client` filters the list to flags whose client-side SDK availability is set to use the client-side ID. Using `mobile` filters to flags set to use the mobile key. Using `anyClient` filters to flags set to use either the client-side ID or the mobile key. Using `server` filters to flags set to use neither, that is, to flags only available in server-side SDKs. | `filter=sdkAvailability:client` | | `segmentTargeted` | A string. It filters the list to flags that target the segment with this key. This filter requires the `filterEnv` filter. | `filter=segmentTargeted:example-segment-key,filterEnv:production` | | `status` | A string, either `new`, `inactive`, `active`, or `launched`. It filters the list to flags with the specified status in the specified environment. This filter requires the `filterEnv` filter. | `filter=status:active,filterEnv:production` | | `tags` | A `+`-separated list of tags. It filters the list to flags that have all of the tags in the list. | `filter=tags:beta+test` | | `type` | A string, either `temporary` or `permanent`. It filters the list to flags with the specified type. | `filter=type:permanent` | The documented values for the `filter` query are prior to URL encoding. For example, the `+` in `filter=tags:beta+test` must be encoded to `%2B`. By default, this endpoint returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page. ### Sorting flags You can sort flags based on the following fields: - `creationDate` sorts by the creation date of the flag. - `key` sorts by the key of the flag. - `maintainerId` sorts by the flag maintainer. - `name` sorts by flag name. - `tags` sorts by tags. - `targetingModifiedDate` sorts by the date that the flag's targeting rules were last modified in a given environment. It must be used with `env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment. - `type` sorts by flag type All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `codeReferences` includes code references for the feature flag - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response, and default cohort information is included in the `fallthrough` property of a flag's response. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        env - Filter configurations by environment (optional)
        tag - Filter feature flags by tag (optional)
        limit - The number of feature flags to return. Defaults to -1, which returns all flags (optional)
        offset - Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
        archived - Deprecated, use `filter=archived:true` instead. A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned (optional)
        summary - By default, flags do _not_ include their lists of prerequisites, targets, or rules for each environment. Set `summary=0` to include these fields for each flag returned. (optional)
        filter - A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields. (optional)
        sort - A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields. (optional)
        compare - A boolean to filter results by only flags that have differences between environments (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        Returns:
        ApiResponse<FeatureFlags>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • getFeatureFlagsAsync

        public okhttp3.Call getFeatureFlagsAsync​(java.lang.String projectKey,
                                                 java.lang.String env,
                                                 java.lang.String tag,
                                                 java.lang.Long limit,
                                                 java.lang.Long offset,
                                                 java.lang.Boolean archived,
                                                 java.lang.Boolean summary,
                                                 java.lang.String filter,
                                                 java.lang.String sort,
                                                 java.lang.Boolean compare,
                                                 java.lang.String expand,
                                                 ApiCallback<FeatureFlags> _callback)
                                          throws ApiException
        List feature flags (asynchronously) Get a list of all feature flags in the given project. By default, each flag includes configurations for each environment. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the `tag` query parameter. > #### Recommended use > > This endpoint can return a large amount of information. We recommend using some or all of these query parameters to decrease response time and overall payload size: `limit`, `env`, `query`, and `filter=creationDate`. ### Filtering flags You can filter on certain fields using the `filter` query parameter. For example, setting `filter=query:dark-mode,tags:beta+test` matches flags with the string `dark-mode` in their key or name, ignoring case, which also have the tags `beta` and `test`. The `filter` query parameter supports the following arguments: | Filter argument | Description | Example | |-----------------------|-------------|----------------------| | `archived` | A boolean value. It filters the list to archived flags. Setting the value to `true` returns only archived flags. When this is absent, only unarchived flags are returned. | `filter=archived:true` | | `contextKindsEvaluated` | A `+`-separated list of context kind keys. It filters the list to flags which have been evaluated in the past 30 days for all of the context kinds in the list. | `filter=contextKindsEvaluated:user+application` | | `contextKindTargeted` | A string. It filters the list to flags that are targeting the given context kind key. | `filter=contextKindTargeted:user` | | `codeReferences.max` | An integer value. Use `0` to return flags that do not have code references. | `filter=codeReferences.max:0` | | `codeReferences.min` | An integer value. Use `1` to return flags that do have code references. | `filter=codeReferences.min:1` | | `creationDate` | An object with optional `before` and `after` fields whose values are Unix time in milliseconds. It filters the list to flags created in the specified range. | `filter=creationDate:{\"before\":1690527600000}` | | `evaluated` | An object that contains a key of `after` and a value in Unix time in milliseconds. It filters the list to all flags that have been evaluated since the time you specify, in the environment provided. This filter requires the `filterEnv` filter. | `filter=evaluation:{\"after\":1690527600000}` | | `filterEnv` | A string with the key of a valid environment. You must use this field for filters that are environment-specific. If there are multiple environment-specific filters, you only need to include this field once. | `filter=evaluated:{\"after\": 1590768455282},filterEnv:production,status:active` | | `followerId` | A valid member ID. It filters the list to flags that are being followed by this member. | `filter=followerId:12ab3c45de678910abc12345` | | `hasDataExport` | A boolean value. It filters the list to flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter requires the `filterEnv` filter. | `filter=hasDataExport:true,filterEnv:production` | | `hasExperiment` | A boolean value. It filters the list to flags that are used in an experiment. | `filter=hasExperiment:true` | | `maintainerId` | A valid member ID. It filters the list to flags that are maintained by this member. | `filter=maintainerId:12ab3c45de678910abc12345` | | `maintainerTeamKey` | A string. It filters the list to flags that are maintained by the team with this key. | `filter=maintainerTeamKey:example-team-key` | | `query` | A string. It filters the list to flags that include the specified string in their key or name. It is not case sensitive. | `filter=query:example` | | `sdkAvailability` | A string, one of `client`, `mobile`, `anyClient`, `server`. Using `client` filters the list to flags whose client-side SDK availability is set to use the client-side ID. Using `mobile` filters to flags set to use the mobile key. Using `anyClient` filters to flags set to use either the client-side ID or the mobile key. Using `server` filters to flags set to use neither, that is, to flags only available in server-side SDKs. | `filter=sdkAvailability:client` | | `segmentTargeted` | A string. It filters the list to flags that target the segment with this key. This filter requires the `filterEnv` filter. | `filter=segmentTargeted:example-segment-key,filterEnv:production` | | `status` | A string, either `new`, `inactive`, `active`, or `launched`. It filters the list to flags with the specified status in the specified environment. This filter requires the `filterEnv` filter. | `filter=status:active,filterEnv:production` | | `tags` | A `+`-separated list of tags. It filters the list to flags that have all of the tags in the list. | `filter=tags:beta+test` | | `type` | A string, either `temporary` or `permanent`. It filters the list to flags with the specified type. | `filter=type:permanent` | The documented values for the `filter` query are prior to URL encoding. For example, the `+` in `filter=tags:beta+test` must be encoded to `%2B`. By default, this endpoint returns all flags. You can page through the list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the returned `_links` field. These links will not be present if the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page. ### Sorting flags You can sort flags based on the following fields: - `creationDate` sorts by the creation date of the flag. - `key` sorts by the key of the flag. - `maintainerId` sorts by the flag maintainer. - `name` sorts by flag name. - `tags` sorts by tags. - `targetingModifiedDate` sorts by the date that the flag's targeting rules were last modified in a given environment. It must be used with `env` parameter and it can not be combined with any other sort. If multiple `env` values are provided, it will perform sort using the first one. For example, `sort=-targetingModifiedDate&env=production&env=staging` returns results sorted by `targetingModifiedDate` for the `production` environment. - `type` sorts by flag type All fields are sorted in ascending order by default. To sort in descending order, prefix the field with a dash ( - ). For example, `sort=-name` sorts the response by flag name in descending order. ### Expanding response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `codeReferences` includes code references for the feature flag - `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days - `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`. For example, `expand=evaluation` includes the `evaluation` field in the response. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response, and default cohort information is included in the `fallthrough` property of a flag's response. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        env - Filter configurations by environment (optional)
        tag - Filter feature flags by tag (optional)
        limit - The number of feature flags to return. Defaults to -1, which returns all flags (optional)
        offset - Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
        archived - Deprecated, use `filter=archived:true` instead. A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned (optional)
        summary - By default, flags do _not_ include their lists of prerequisites, targets, or rules for each environment. Set `summary=0` to include these fields for each flag returned. (optional)
        filter - A comma-separated list of filters. Each filter is of the form field:value. Read the endpoint description for a full list of available filter fields. (optional)
        sort - A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields. (optional)
        compare - A boolean to filter results by only flags that have differences between environments (optional)
        expand - A comma-separated list of fields to expand in the response. Supported fields are explained above. (optional)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • patchExpiringTargetsCall

        public okhttp3.Call patchExpiringTargetsCall​(java.lang.String projectKey,
                                                     java.lang.String environmentKey,
                                                     java.lang.String featureFlagKey,
                                                     PatchFlagsRequest patchFlagsRequest,
                                                     ApiCallback _callback)
                                              throws ApiException
        Build call for patchExpiringTargets
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • patchExpiringTargets

        public ExpiringTargetPatchResponse patchExpiringTargets​(java.lang.String projectKey,
                                                                java.lang.String environmentKey,
                                                                java.lang.String featureFlagKey,
                                                                PatchFlagsRequest patchFlagsRequest)
                                                         throws ApiException
        Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context. You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring targets. <details> <summary>Click to expand instructions for <strong>updating expiring targets</strong></summary> #### addExpiringTarget Adds a date and time that LaunchDarkly will remove the context from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### updateExpiringTarget Updates the date and time that LaunchDarkly will remove the context from the flag's individual targeting ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` * `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### removeExpiringTarget Removes the scheduled removal of the context from the flag's individual targeting. The context will remain part of the flag's individual targeting until you explicitly remove it, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        Returns:
        ExpiringTargetPatchResponse
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchExpiringTargetsWithHttpInfo

        public ApiResponse<ExpiringTargetPatchResponse> patchExpiringTargetsWithHttpInfo​(java.lang.String projectKey,
                                                                                         java.lang.String environmentKey,
                                                                                         java.lang.String featureFlagKey,
                                                                                         PatchFlagsRequest patchFlagsRequest)
                                                                                  throws ApiException
        Update expiring context targets on feature flag Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context. You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring targets. <details> <summary>Click to expand instructions for <strong>updating expiring targets</strong></summary> #### addExpiringTarget Adds a date and time that LaunchDarkly will remove the context from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### updateExpiringTarget Updates the date and time that LaunchDarkly will remove the context from the flag's individual targeting ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` * `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### removeExpiringTarget Removes the scheduled removal of the context from the flag's individual targeting. The context will remain part of the flag's individual targeting until you explicitly remove it, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        Returns:
        ApiResponse<ExpiringTargetPatchResponse>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchExpiringTargetsAsync

        public okhttp3.Call patchExpiringTargetsAsync​(java.lang.String projectKey,
                                                      java.lang.String environmentKey,
                                                      java.lang.String featureFlagKey,
                                                      PatchFlagsRequest patchFlagsRequest,
                                                      ApiCallback<ExpiringTargetPatchResponse> _callback)
                                               throws ApiException
        Update expiring context targets on feature flag (asynchronously) Schedule a context for removal from individual targeting on a feature flag. The flag must already individually target the context. You can add, update, or remove a scheduled removal date. You can only schedule a context for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring targets. <details> <summary>Click to expand instructions for <strong>updating expiring targets</strong></summary> #### addExpiringTarget Adds a date and time that LaunchDarkly will remove the context from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### updateExpiringTarget Updates the date and time that LaunchDarkly will remove the context from the flag's individual targeting ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the context from individual targeting for this flag * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` * `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"value\": 1754006460000, \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` #### removeExpiringTarget Removes the scheduled removal of the context from the flag's individual targeting. The context will remain part of the flag's individual targeting until you explicitly remove it, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `contextKey`: The context key for the context to remove from individual targeting * `contextKind`: The kind of context represented by the `contextKey` Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"variationId\": \"4254742c-71ae-411f-a992-43b18a51afe0\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\" }] } ``` </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • patchExpiringUserTargetsCall

        public okhttp3.Call patchExpiringUserTargetsCall​(java.lang.String projectKey,
                                                         java.lang.String environmentKey,
                                                         java.lang.String featureFlagKey,
                                                         PatchFlagsRequest patchFlagsRequest,
                                                         ApiCallback _callback)
                                                  throws ApiException
        Build call for patchExpiringUserTargets
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • patchExpiringUserTargets

        public ExpiringUserTargetPatchResponse patchExpiringUserTargets​(java.lang.String projectKey,
                                                                        java.lang.String environmentKey,
                                                                        java.lang.String featureFlagKey,
                                                                        PatchFlagsRequest patchFlagsRequest)
                                                                 throws ApiException
        Update expiring user targets on feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key. You can add, update, or remove a scheduled removal date. You can only schedule a target for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting * `version`: (Optional) The version of the expiring user target to update. If included, update will fail if version doesn't match current version of the expiring user target. #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag's individual targeting. The user will remain part of the flag's individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        Returns:
        ExpiringUserTargetPatchResponse
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchExpiringUserTargetsWithHttpInfo

        public ApiResponse<ExpiringUserTargetPatchResponse> patchExpiringUserTargetsWithHttpInfo​(java.lang.String projectKey,
                                                                                                 java.lang.String environmentKey,
                                                                                                 java.lang.String featureFlagKey,
                                                                                                 PatchFlagsRequest patchFlagsRequest)
                                                                                          throws ApiException
        Update expiring user targets on feature flag > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key. You can add, update, or remove a scheduled removal date. You can only schedule a target for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting * `version`: (Optional) The version of the expiring user target to update. If included, update will fail if version doesn't match current version of the expiring user target. #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag's individual targeting. The user will remain part of the flag's individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        Returns:
        ApiResponse<ExpiringUserTargetPatchResponse>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchExpiringUserTargetsAsync

        public okhttp3.Call patchExpiringUserTargetsAsync​(java.lang.String projectKey,
                                                          java.lang.String environmentKey,
                                                          java.lang.String featureFlagKey,
                                                          PatchFlagsRequest patchFlagsRequest,
                                                          ApiCallback<ExpiringUserTargetPatchResponse> _callback)
                                                   throws ApiException
        Update expiring user targets on feature flag (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring context targets on feature flag](/tag/Feature-flags#operation/patchExpiringTargets) instead of this endpoint. To learn more, read [Contexts](https://docs.launchdarkly.com/home/contexts). Schedule a target for removal from individual targeting on a feature flag. The flag must already serve a variation to specific targets based on their key. You can add, update, or remove a scheduled removal date. You can only schedule a target for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * `value`: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting * `version`: (Optional) The version of the expiring user target to update. If included, update will fail if version doesn't match current version of the expiring user target. #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag's individual targeting. The user will remain part of the flag's individual targeting until you explicitly remove them, or until you schedule another removal. ##### Parameters * `variationId`: ID of a variation on the flag * `userKey`: The user key for the user to remove from individual targeting </details>
        Parameters:
        projectKey - The project key (required)
        environmentKey - The environment key (required)
        featureFlagKey - The feature flag key (required)
        patchFlagsRequest - (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • patchFeatureFlagCall

        public okhttp3.Call patchFeatureFlagCall​(java.lang.String projectKey,
                                                 java.lang.String featureFlagKey,
                                                 PatchWithComment patchWithComment,
                                                 ApiCallback _callback)
                                          throws ApiException
        Build call for patchFeatureFlag
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        patchWithComment - (required)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • patchFeatureFlag

        public FeatureFlag patchFeatureFlag​(java.lang.String projectKey,
                                            java.lang.String featureFlagKey,
                                            PatchWithComment patchWithComment)
                                     throws ApiException
        Update feature flag Perform a partial update to a feature flag. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](/#section/Overview/Updates). ### Using semantic patches on a feature flag To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating feature flags takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required for some instructions only) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions. ### Instructions Semantic patch requests support the following `kind` instructions for updating feature flags. <details> <summary>Click to expand instructions for <strong>turning flags on and off</strong></summary> These instructions require the `environmentKey` parameter. #### turnFlagOff Sets the flag's targeting state to **Off**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOff\" } ] } ``` #### turnFlagOn Sets the flag's targeting state to **On**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOn\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>working with targeting and variations</strong></summary> These instructions require the `environmentKey` parameter. Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the [Get feature flag](/tag/Feature-flags#operation/getFeatureFlag) response. The flag rule ID is the `_id` field of each element in the `rules` array within each environment listed in the `environments` object. The variation ID is the `_id` field in each element of the `variations` array. The clause ID is the `_id` field of each element of the `clauses` array within the `rules` array within each environment listed in the `environments` object. #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"USA\", \"Canada\"] }] }] } ``` #### addPrerequisite Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag in the path parameter. ##### Parameters - `key`: Flag key of the prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addPrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addRule Adds a new targeting rule to the flag. The rule may contain `clauses` and serve the variation that `variationId` indicates, or serve a percentage rollout that `rolloutWeights`, `rolloutBucketBy`, and `rolloutContextKind` indicate. If you set `beforeRuleId`, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `beforeRuleId`: (Optional) ID of a flag rule. - Either - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: (Optional) Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }] }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }], \"rolloutContextKind\": \"organization\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### addTargets Adds context keys to the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Returns an error if this causes the flag to target the same context key in multiple variations. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addUserTargets Adds user keys to the individual user targets for the variation that `variationId` specifies. Returns an error if this causes the flag to target the same user key in multiple variations. If you are working with contexts, use `addTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### addVariation Adds a variation to the flag. ##### Parameters - `value`: The variation value. - `name`: (Optional) The variation name. - `description`: (Optional) A description for the variation. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addVariation\", \"value\": 20, \"name\": \"New variation\" } ] } ``` #### clearTargets Removes all individual targets from the variation that `variationId` specifies. This includes both user and non-user targets. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### clearUserTargets Removes all individual user targets from the variation that `variationId` specifies. If you are working with contexts, use `clearTargets` instead of this instruction. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearUserTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removePrerequisite Removes the prerequisite flag indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removePrerequisite\", \"key\": \"prereq-flag-key-123abc\" } ] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" } ] } ``` #### removeTargets Removes context keys from the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Does nothing if the flag does not target the context keys. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeUserTargets Removes user keys from the individual user targets for the variation that `variationId` specifies. Does nothing if the flag does not target the user keys. If you are working with contexts, use `removeTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeVariation Removes a variation from the flag. ##### Parameters - `variationId`: ID of a variation of the flag to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### replacePrerequisites Removes all existing prerequisites and replaces them with the list you provide. ##### Parameters - `prerequisites`: A list of prerequisites. Each item in the list must include a flag `key` and `variationId`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replacePrerequisites\", \"prerequisites\": [ { \"key\": \"prereq-flag-key-123abc\", \"variationId\": \"10a58772-3121-400f-846b-b8a04e8944ed\" }, { \"key\": \"another-prereq-flag-key-456def\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\" } ] } ] } ``` #### replaceRules Removes all targeting rules for the flag and replaces them with the list you provide. ##### Parameters - `rules`: A list of rules. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceRules\", \"rules\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"description\": \"My new rule\", \"clauses\": [ { \"contextKind\": \"user\", \"attribute\": \"segmentMatch\", \"op\": \"segmentMatch\", \"values\": [\"test\"] } ], \"trackEvents\": true } ] } ] } ``` #### replaceTargets Removes all existing targeting and replaces it with the list of targets you provide. ##### Parameters - `targets`: A list of context targeting. Each item in the list includes an optional `contextKind` that defaults to `user`, a required `variationId`, and a required list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceTargets\", \"targets\": [ { \"contextKind\": \"user\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\"] }, { \"contextKind\": \"device\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"device-key-456def\"] } ] } ] } ``` #### replaceUserTargets Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag's variations. If you are working with contexts, use `replaceTargets` instead of this instruction. ##### Parameters - `targets`: A list of user targeting. Each item in the list must include a `variationId` and a list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceUserTargets\", \"targets\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\", \"user-key-456def\"] }, { \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"user-key-789ghi\"] } ] } ] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateDefaultVariation Updates the default on or off variation of the flag. ##### Parameters - `onVariationValue`: (Optional) The value of the variation of the new on variation. - `offVariationValue`: (Optional) The value of the variation of the new off variation Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDefaultVariation\", \"OnVariationValue\": true, \"OffVariationValue\": false } ] } ``` #### updateFallthroughVariationOrRollout Updates the default or \"fallthrough\" rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that `variationId` indicates, or a percentage rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutContextKind\": \"user\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### updateOffVariation Updates the default off variation to `variationId`. The flag serves the default off variation when the flag's targeting is **Off**. ##### Parameters - `variationId`: ID of a variation of the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateOffVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### updatePrerequisite Changes the prerequisite flag that `key` indicates to use the variation that `variationId` indicates. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updatePrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateRuleDescription Updates the description of the feature flag rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule. ##### Parameters - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleTrackEvents\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"trackEvents\": true }] } ``` #### updateRuleVariationOrRollout Updates what `ruleId` serves when its clauses evaluate to true. The rule can serve either the variation that `variationId` indicates, or a percent rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `ruleId`: ID of a rule in the flag. - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleVariationOrRollout\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEvents\", \"trackEvents\": true } ] } ``` #### updateTrackEventsFallthrough Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEventsFallthrough\", \"trackEvents\": true } ] } ``` #### updateVariation Updates a variation of the flag. ##### Parameters - `variationId`: The ID of the variation to update. - `name`: (Optional) The updated variation name. - `value`: (Optional) The updated variation value. - `description`: (Optional) The updated variation description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"value\": 20 } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating flag settings</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### addCustomProperties Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature's development. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### addTags Adds tags to the feature flag. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### makeFlagPermanent Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagPermanent\" } ] } ``` #### makeFlagTemporary Marks the feature flag as temporary. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagTemporary\" } ] } ``` #### removeCustomProperties Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property. ##### Parameters - `key`: The custom property key. - `values`: A list of the associated values to remove from the custom property. ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### removeMaintainer Removes the flag's maintainer. To set a new maintainer, use the flag's **Settings** tab in the LaunchDarkly user interface. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeMaintainer\" } ] } ``` #### removeTags Removes tags from the feature flag. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### replaceCustomProperties Replaces the existing associated values for a custom property with the new values. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the new associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### turnOffClientSideAvailability Turns off client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn off availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOffClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### turnOnClientSideAvailability Turns on client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn on availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOnClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### updateDescription Updates the feature flag description. ##### Parameters - `value`: The new description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDescription\", \"value\": \"Updated flag description\" } ] } ``` #### updateMaintainerMember Updates the maintainer of the flag to an existing member and removes the existing maintainer. ##### Parameters - `value`: The ID of the member. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerMember\", \"value\": \"61e9b714fd47591727db558a\" } ] } ``` #### updateMaintainerTeam Updates the maintainer of the flag to an existing team and removes the existing maintainer. ##### Parameters - `value`: The key of the team. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerTeam\", \"value\": \"example-team-key\" } ] } ``` #### updateName Updates the feature flag name. ##### Parameters - `value`: The new name. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateName\", \"value\": \"Updated flag name\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating the flag lifecycle</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### archiveFlag Archives the feature flag. This retires it from LaunchDarkly without deleting it. You cannot archive a flag that is a prerequisite of other flags. ```json { \"instructions\": [ { \"kind\": \"archiveFlag\" } ] } ``` #### deleteFlag Deletes the feature flag and its rules. You cannot restore a deleted flag. If this flag is requested again, the flag value defined in code will be returned for all contexts. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deleteFlag\" } ] } ``` #### deprecateFlag Deprecates the feature flag. This hides it from the live flags list without archiving or deleting it. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deprecateFlag\" } ] } ``` #### restoreDeprecatedFlag Restores the feature flag if it was previously deprecated. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreDeprecatedFlag\" } ] } ``` #### restoreFlag Restores the feature flag if it was previously archived. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreFlag\" } ] } ``` </details> ### Using JSON patches on a feature flag If you do not include the header described above, you can use a [JSON patch](/reference#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. When you use the update feature flag endpoint to add individual targets to a specific variation, there are two different patch documents, depending on whether there are already individual targets for the variation. If a flag variation already has individual targets, the path for the JSON patch operation is: ```json { \"op\": \"add\", \"path\": \"/environments/devint/targets/0/values/-\", \"value\": \"TestClient10\" } ``` If a flag variation does not already have individual targets, the path for the JSON patch operation is: ```json [ { \"op\": \"add\", \"path\": \"/environments/devint/targets/-\", \"value\": { \"variation\": 0, \"values\": [\"TestClient10\"] } } ] ``` ### Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows). ### Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an `ignoreConflicts` query parameter set to `true`. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response. You can update cohorts by updating `rules`. Default cohort information is included in the `fallthrough` property of a flag's response. You can update the default cohort by updating `fallthrough`. When you update the rollout for a cohort or the default cohort through the API, provide a rollout instead of a single `variationId`. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        patchWithComment - (required)
        Returns:
        FeatureFlag
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchFeatureFlagWithHttpInfo

        public ApiResponse<FeatureFlag> patchFeatureFlagWithHttpInfo​(java.lang.String projectKey,
                                                                     java.lang.String featureFlagKey,
                                                                     PatchWithComment patchWithComment)
                                                              throws ApiException
        Update feature flag Perform a partial update to a feature flag. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](/#section/Overview/Updates). ### Using semantic patches on a feature flag To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating feature flags takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required for some instructions only) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions. ### Instructions Semantic patch requests support the following `kind` instructions for updating feature flags. <details> <summary>Click to expand instructions for <strong>turning flags on and off</strong></summary> These instructions require the `environmentKey` parameter. #### turnFlagOff Sets the flag's targeting state to **Off**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOff\" } ] } ``` #### turnFlagOn Sets the flag's targeting state to **On**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOn\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>working with targeting and variations</strong></summary> These instructions require the `environmentKey` parameter. Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the [Get feature flag](/tag/Feature-flags#operation/getFeatureFlag) response. The flag rule ID is the `_id` field of each element in the `rules` array within each environment listed in the `environments` object. The variation ID is the `_id` field in each element of the `variations` array. The clause ID is the `_id` field of each element of the `clauses` array within the `rules` array within each environment listed in the `environments` object. #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"USA\", \"Canada\"] }] }] } ``` #### addPrerequisite Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag in the path parameter. ##### Parameters - `key`: Flag key of the prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addPrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addRule Adds a new targeting rule to the flag. The rule may contain `clauses` and serve the variation that `variationId` indicates, or serve a percentage rollout that `rolloutWeights`, `rolloutBucketBy`, and `rolloutContextKind` indicate. If you set `beforeRuleId`, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `beforeRuleId`: (Optional) ID of a flag rule. - Either - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: (Optional) Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }] }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }], \"rolloutContextKind\": \"organization\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### addTargets Adds context keys to the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Returns an error if this causes the flag to target the same context key in multiple variations. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addUserTargets Adds user keys to the individual user targets for the variation that `variationId` specifies. Returns an error if this causes the flag to target the same user key in multiple variations. If you are working with contexts, use `addTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### addVariation Adds a variation to the flag. ##### Parameters - `value`: The variation value. - `name`: (Optional) The variation name. - `description`: (Optional) A description for the variation. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addVariation\", \"value\": 20, \"name\": \"New variation\" } ] } ``` #### clearTargets Removes all individual targets from the variation that `variationId` specifies. This includes both user and non-user targets. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### clearUserTargets Removes all individual user targets from the variation that `variationId` specifies. If you are working with contexts, use `clearTargets` instead of this instruction. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearUserTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removePrerequisite Removes the prerequisite flag indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removePrerequisite\", \"key\": \"prereq-flag-key-123abc\" } ] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" } ] } ``` #### removeTargets Removes context keys from the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Does nothing if the flag does not target the context keys. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeUserTargets Removes user keys from the individual user targets for the variation that `variationId` specifies. Does nothing if the flag does not target the user keys. If you are working with contexts, use `removeTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeVariation Removes a variation from the flag. ##### Parameters - `variationId`: ID of a variation of the flag to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### replacePrerequisites Removes all existing prerequisites and replaces them with the list you provide. ##### Parameters - `prerequisites`: A list of prerequisites. Each item in the list must include a flag `key` and `variationId`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replacePrerequisites\", \"prerequisites\": [ { \"key\": \"prereq-flag-key-123abc\", \"variationId\": \"10a58772-3121-400f-846b-b8a04e8944ed\" }, { \"key\": \"another-prereq-flag-key-456def\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\" } ] } ] } ``` #### replaceRules Removes all targeting rules for the flag and replaces them with the list you provide. ##### Parameters - `rules`: A list of rules. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceRules\", \"rules\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"description\": \"My new rule\", \"clauses\": [ { \"contextKind\": \"user\", \"attribute\": \"segmentMatch\", \"op\": \"segmentMatch\", \"values\": [\"test\"] } ], \"trackEvents\": true } ] } ] } ``` #### replaceTargets Removes all existing targeting and replaces it with the list of targets you provide. ##### Parameters - `targets`: A list of context targeting. Each item in the list includes an optional `contextKind` that defaults to `user`, a required `variationId`, and a required list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceTargets\", \"targets\": [ { \"contextKind\": \"user\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\"] }, { \"contextKind\": \"device\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"device-key-456def\"] } ] } ] } ``` #### replaceUserTargets Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag's variations. If you are working with contexts, use `replaceTargets` instead of this instruction. ##### Parameters - `targets`: A list of user targeting. Each item in the list must include a `variationId` and a list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceUserTargets\", \"targets\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\", \"user-key-456def\"] }, { \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"user-key-789ghi\"] } ] } ] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateDefaultVariation Updates the default on or off variation of the flag. ##### Parameters - `onVariationValue`: (Optional) The value of the variation of the new on variation. - `offVariationValue`: (Optional) The value of the variation of the new off variation Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDefaultVariation\", \"OnVariationValue\": true, \"OffVariationValue\": false } ] } ``` #### updateFallthroughVariationOrRollout Updates the default or \"fallthrough\" rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that `variationId` indicates, or a percentage rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutContextKind\": \"user\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### updateOffVariation Updates the default off variation to `variationId`. The flag serves the default off variation when the flag's targeting is **Off**. ##### Parameters - `variationId`: ID of a variation of the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateOffVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### updatePrerequisite Changes the prerequisite flag that `key` indicates to use the variation that `variationId` indicates. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updatePrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateRuleDescription Updates the description of the feature flag rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule. ##### Parameters - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleTrackEvents\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"trackEvents\": true }] } ``` #### updateRuleVariationOrRollout Updates what `ruleId` serves when its clauses evaluate to true. The rule can serve either the variation that `variationId` indicates, or a percent rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `ruleId`: ID of a rule in the flag. - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleVariationOrRollout\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEvents\", \"trackEvents\": true } ] } ``` #### updateTrackEventsFallthrough Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEventsFallthrough\", \"trackEvents\": true } ] } ``` #### updateVariation Updates a variation of the flag. ##### Parameters - `variationId`: The ID of the variation to update. - `name`: (Optional) The updated variation name. - `value`: (Optional) The updated variation value. - `description`: (Optional) The updated variation description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"value\": 20 } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating flag settings</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### addCustomProperties Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature's development. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### addTags Adds tags to the feature flag. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### makeFlagPermanent Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagPermanent\" } ] } ``` #### makeFlagTemporary Marks the feature flag as temporary. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagTemporary\" } ] } ``` #### removeCustomProperties Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property. ##### Parameters - `key`: The custom property key. - `values`: A list of the associated values to remove from the custom property. ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### removeMaintainer Removes the flag's maintainer. To set a new maintainer, use the flag's **Settings** tab in the LaunchDarkly user interface. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeMaintainer\" } ] } ``` #### removeTags Removes tags from the feature flag. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### replaceCustomProperties Replaces the existing associated values for a custom property with the new values. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the new associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### turnOffClientSideAvailability Turns off client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn off availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOffClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### turnOnClientSideAvailability Turns on client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn on availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOnClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### updateDescription Updates the feature flag description. ##### Parameters - `value`: The new description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDescription\", \"value\": \"Updated flag description\" } ] } ``` #### updateMaintainerMember Updates the maintainer of the flag to an existing member and removes the existing maintainer. ##### Parameters - `value`: The ID of the member. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerMember\", \"value\": \"61e9b714fd47591727db558a\" } ] } ``` #### updateMaintainerTeam Updates the maintainer of the flag to an existing team and removes the existing maintainer. ##### Parameters - `value`: The key of the team. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerTeam\", \"value\": \"example-team-key\" } ] } ``` #### updateName Updates the feature flag name. ##### Parameters - `value`: The new name. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateName\", \"value\": \"Updated flag name\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating the flag lifecycle</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### archiveFlag Archives the feature flag. This retires it from LaunchDarkly without deleting it. You cannot archive a flag that is a prerequisite of other flags. ```json { \"instructions\": [ { \"kind\": \"archiveFlag\" } ] } ``` #### deleteFlag Deletes the feature flag and its rules. You cannot restore a deleted flag. If this flag is requested again, the flag value defined in code will be returned for all contexts. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deleteFlag\" } ] } ``` #### deprecateFlag Deprecates the feature flag. This hides it from the live flags list without archiving or deleting it. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deprecateFlag\" } ] } ``` #### restoreDeprecatedFlag Restores the feature flag if it was previously deprecated. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreDeprecatedFlag\" } ] } ``` #### restoreFlag Restores the feature flag if it was previously archived. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreFlag\" } ] } ``` </details> ### Using JSON patches on a feature flag If you do not include the header described above, you can use a [JSON patch](/reference#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. When you use the update feature flag endpoint to add individual targets to a specific variation, there are two different patch documents, depending on whether there are already individual targets for the variation. If a flag variation already has individual targets, the path for the JSON patch operation is: ```json { \"op\": \"add\", \"path\": \"/environments/devint/targets/0/values/-\", \"value\": \"TestClient10\" } ``` If a flag variation does not already have individual targets, the path for the JSON patch operation is: ```json [ { \"op\": \"add\", \"path\": \"/environments/devint/targets/-\", \"value\": { \"variation\": 0, \"values\": [\"TestClient10\"] } } ] ``` ### Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows). ### Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an `ignoreConflicts` query parameter set to `true`. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response. You can update cohorts by updating `rules`. Default cohort information is included in the `fallthrough` property of a flag's response. You can update the default cohort by updating `fallthrough`. When you update the rollout for a cohort or the default cohort through the API, provide a rollout instead of a single `variationId`. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        patchWithComment - (required)
        Returns:
        ApiResponse<FeatureFlag>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • patchFeatureFlagAsync

        public okhttp3.Call patchFeatureFlagAsync​(java.lang.String projectKey,
                                                  java.lang.String featureFlagKey,
                                                  PatchWithComment patchWithComment,
                                                  ApiCallback<FeatureFlag> _callback)
                                           throws ApiException
        Update feature flag (asynchronously) Perform a partial update to a feature flag. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](/#section/Overview/Updates). ### Using semantic patches on a feature flag To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](/reference#updates-using-semantic-patch). The body of a semantic patch request for updating feature flags takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required for some instructions only) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions. ### Instructions Semantic patch requests support the following `kind` instructions for updating feature flags. <details> <summary>Click to expand instructions for <strong>turning flags on and off</strong></summary> These instructions require the `environmentKey` parameter. #### turnFlagOff Sets the flag's targeting state to **Off**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOff\" } ] } ``` #### turnFlagOn Sets the flag's targeting state to **On**. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"turnFlagOn\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>working with targeting and variations</strong></summary> These instructions require the `environmentKey` parameter. Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the [Get feature flag](/tag/Feature-flags#operation/getFeatureFlag) response. The flag rule ID is the `_id` field of each element in the `rules` array within each environment listed in the `environments` object. The variation ID is the `_id` field in each element of the `variations` array. The clause ID is the `_id` field of each element of the `clauses` array within the `rules` array within each environment listed in the `environments` object. #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"USA\", \"Canada\"] }] }] } ``` #### addPrerequisite Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag in the path parameter. ##### Parameters - `key`: Flag key of the prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addPrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addRule Adds a new targeting rule to the flag. The rule may contain `clauses` and serve the variation that `variationId` indicates, or serve a percentage rollout that `rolloutWeights`, `rolloutBucketBy`, and `rolloutContextKind` indicate. If you set `beforeRuleId`, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `beforeRuleId`: (Optional) ID of a flag rule. - Either - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: (Optional) Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }] }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [{ \"contextKind\": \"organization\", \"attribute\": \"located_in\", \"op\": \"in\", \"negate\": false, \"values\": [\"Sweden\", \"Norway\"] }], \"rolloutContextKind\": \"organization\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### addTargets Adds context keys to the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Returns an error if this causes the flag to target the same context key in multiple variations. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addUserTargets Adds user keys to the individual user targets for the variation that `variationId` specifies. Returns an error if this causes the flag to target the same user key in multiple variations. If you are working with contexts, use `addTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### addVariation Adds a variation to the flag. ##### Parameters - `value`: The variation value. - `name`: (Optional) The variation name. - `description`: (Optional) A description for the variation. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addVariation\", \"value\": 20, \"name\": \"New variation\" } ] } ``` #### clearTargets Removes all individual targets from the variation that `variationId` specifies. This includes both user and non-user targets. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### clearUserTargets Removes all individual user targets from the variation that `variationId` specifies. If you are working with contexts, use `clearTargets` instead of this instruction. ##### Parameters - `variationId`: ID of a variation on the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"clearUserTargets\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removePrerequisite Removes the prerequisite flag indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removePrerequisite\", \"key\": \"prereq-flag-key-123abc\" } ] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" } ] } ``` #### removeTargets Removes context keys from the individual context targets for the context kind that `contextKind` specifies and the variation that `variationId` specifies. Does nothing if the flag does not target the context keys. ##### Parameters - `values`: List of context keys. - `contextKind`: (Optional) Context kind to target, defaults to `user` - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeTargets\", \"values\": [\"context-key-123abc\", \"context-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeUserTargets Removes user keys from the individual user targets for the variation that `variationId` specifies. Does nothing if the flag does not target the user keys. If you are working with contexts, use `removeTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. - `variationId`: ID of a flag variation. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeUserTargets\", \"values\": [\"user-key-123abc\", \"user-key-456def\"], \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeVariation Removes a variation from the flag. ##### Parameters - `variationId`: ID of a variation of the flag to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### replacePrerequisites Removes all existing prerequisites and replaces them with the list you provide. ##### Parameters - `prerequisites`: A list of prerequisites. Each item in the list must include a flag `key` and `variationId`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replacePrerequisites\", \"prerequisites\": [ { \"key\": \"prereq-flag-key-123abc\", \"variationId\": \"10a58772-3121-400f-846b-b8a04e8944ed\" }, { \"key\": \"another-prereq-flag-key-456def\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\" } ] } ] } ``` #### replaceRules Removes all targeting rules for the flag and replaces them with the list you provide. ##### Parameters - `rules`: A list of rules. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceRules\", \"rules\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"description\": \"My new rule\", \"clauses\": [ { \"contextKind\": \"user\", \"attribute\": \"segmentMatch\", \"op\": \"segmentMatch\", \"values\": [\"test\"] } ], \"trackEvents\": true } ] } ] } ``` #### replaceTargets Removes all existing targeting and replaces it with the list of targets you provide. ##### Parameters - `targets`: A list of context targeting. Each item in the list includes an optional `contextKind` that defaults to `user`, a required `variationId`, and a required list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceTargets\", \"targets\": [ { \"contextKind\": \"user\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\"] }, { \"contextKind\": \"device\", \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"device-key-456def\"] } ] } ] } ``` #### replaceUserTargets Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag's variations. If you are working with contexts, use `replaceTargets` instead of this instruction. ##### Parameters - `targets`: A list of user targeting. Each item in the list must include a `variationId` and a list of `values`. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"replaceUserTargets\", \"targets\": [ { \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"values\": [\"user-key-123abc\", \"user-key-456def\"] }, { \"variationId\": \"e5830889-1ec5-4b0c-9cc9-c48790090c43\", \"values\": [\"user-key-789ghi\"] } ] } ] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateDefaultVariation Updates the default on or off variation of the flag. ##### Parameters - `onVariationValue`: (Optional) The value of the variation of the new on variation. - `offVariationValue`: (Optional) The value of the variation of the new off variation Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDefaultVariation\", \"OnVariationValue\": true, \"OffVariationValue\": false } ] } ``` #### updateFallthroughVariationOrRollout Updates the default or \"fallthrough\" rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that `variationId` indicates, or a percentage rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example that uses a `variationId`: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` Here's an example that uses a percentage rollout: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutContextKind\": \"user\", \"rolloutWeights\": { \"2f43f67c-3e4e-4945-a18a-26559378ca00\": 15000, // serve 15% this variation \"e5830889-1ec5-4b0c-9cc9-c48790090c43\": 85000 // serve 85% this variation } }] } ``` #### updateOffVariation Updates the default off variation to `variationId`. The flag serves the default off variation when the flag's targeting is **Off**. ##### Parameters - `variationId`: ID of a variation of the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateOffVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" } ] } ``` #### updatePrerequisite Changes the prerequisite flag that `key` indicates to use the variation that `variationId` indicates. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: Flag key of an existing prerequisite flag. - `variationId`: ID of a variation of the prerequisite flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updatePrerequisite\", \"key\": \"example-prereq-flag-key\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateRuleDescription Updates the description of the feature flag rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule. ##### Parameters - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the flag. - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleTrackEvents\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"trackEvents\": true }] } ``` #### updateRuleVariationOrRollout Updates what `ruleId` serves when its clauses evaluate to true. The rule can serve either the variation that `variationId` indicates, or a percent rollout that `rolloutWeights` and `rolloutBucketBy` indicate. ##### Parameters - `ruleId`: ID of a rule in the flag. - `variationId`: ID of a variation of the flag. or - `rolloutWeights`: Map of `variationId` to weight, in thousandths of a percent (0-100000). - `rolloutBucketBy`: (Optional) Context attribute available in the specified `rolloutContextKind`. - `rolloutContextKind`: (Optional) Context kind, defaults to `user` Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [{ \"kind\": \"updateRuleVariationOrRollout\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\" }] } ``` #### updateTrackEvents Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEvents\", \"trackEvents\": true } ] } ``` #### updateTrackEventsFallthrough Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule. ##### Parameters - `trackEvents`: Whether or not events are tracked. Here's an example: ```json { \"environmentKey\": \"environment-key-123abc\", \"instructions\": [ { \"kind\": \"updateTrackEventsFallthrough\", \"trackEvents\": true } ] } ``` #### updateVariation Updates a variation of the flag. ##### Parameters - `variationId`: The ID of the variation to update. - `name`: (Optional) The updated variation name. - `value`: (Optional) The updated variation value. - `description`: (Optional) The updated variation description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateVariation\", \"variationId\": \"2f43f67c-3e4e-4945-a18a-26559378ca00\", \"value\": 20 } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating flag settings</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### addCustomProperties Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature's development. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### addTags Adds tags to the feature flag. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [ { \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### makeFlagPermanent Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagPermanent\" } ] } ``` #### makeFlagTemporary Marks the feature flag as temporary. Here's an example: ```json { \"instructions\": [ { \"kind\": \"makeFlagTemporary\" } ] } ``` #### removeCustomProperties Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property. ##### Parameters - `key`: The custom property key. - `values`: A list of the associated values to remove from the custom property. ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### removeMaintainer Removes the flag's maintainer. To set a new maintainer, use the flag's **Settings** tab in the LaunchDarkly user interface. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeMaintainer\" } ] } ``` #### removeTags Removes tags from the feature flag. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [ { \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] } ] } ``` #### replaceCustomProperties Replaces the existing associated values for a custom property with the new values. ##### Parameters - `key`: The custom property key. - `name`: The custom property name. - `values`: A list of the new associated values for the custom property. Here's an example: ```json { \"instructions\": [{ \"kind\": \"replaceCustomProperties\", \"key\": \"example-custom-property\", \"name\": \"Example custom property\", \"values\": [\"value1\", \"value2\"] }] } ``` #### turnOffClientSideAvailability Turns off client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn off availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOffClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### turnOnClientSideAvailability Turns on client-side SDK availability for the flag. This is equivalent to unchecking the **SDKs using Mobile Key** and/or **SDKs using client-side ID** boxes for the flag. If you're using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them. ##### Parameters - `value`: Use \"usingMobileKey\" to turn on availability for mobile SDKs. Use \"usingEnvironmentId\" to turn on availability for client-side SDKs. Here's an example: ```json { \"instructions\": [ { \"kind\": \"turnOnClientSideAvailability\", \"value\": \"usingMobileKey\" } ] } ``` #### updateDescription Updates the feature flag description. ##### Parameters - `value`: The new description. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateDescription\", \"value\": \"Updated flag description\" } ] } ``` #### updateMaintainerMember Updates the maintainer of the flag to an existing member and removes the existing maintainer. ##### Parameters - `value`: The ID of the member. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerMember\", \"value\": \"61e9b714fd47591727db558a\" } ] } ``` #### updateMaintainerTeam Updates the maintainer of the flag to an existing team and removes the existing maintainer. ##### Parameters - `value`: The key of the team. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateMaintainerTeam\", \"value\": \"example-team-key\" } ] } ``` #### updateName Updates the feature flag name. ##### Parameters - `value`: The new name. Here's an example: ```json { \"instructions\": [ { \"kind\": \"updateName\", \"value\": \"Updated flag name\" } ] } ``` </details><br /> <details> <summary>Click to expand instructions for <strong>updating the flag lifecycle</strong></summary> These instructions do not require the `environmentKey` parameter. They make changes that apply to the flag across all environments. #### archiveFlag Archives the feature flag. This retires it from LaunchDarkly without deleting it. You cannot archive a flag that is a prerequisite of other flags. ```json { \"instructions\": [ { \"kind\": \"archiveFlag\" } ] } ``` #### deleteFlag Deletes the feature flag and its rules. You cannot restore a deleted flag. If this flag is requested again, the flag value defined in code will be returned for all contexts. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deleteFlag\" } ] } ``` #### deprecateFlag Deprecates the feature flag. This hides it from the live flags list without archiving or deleting it. Here's an example: ```json { \"instructions\": [ { \"kind\": \"deprecateFlag\" } ] } ``` #### restoreDeprecatedFlag Restores the feature flag if it was previously deprecated. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreDeprecatedFlag\" } ] } ``` #### restoreFlag Restores the feature flag if it was previously archived. Here's an example: ```json { \"instructions\": [ { \"kind\": \"restoreFlag\" } ] } ``` </details> ### Using JSON patches on a feature flag If you do not include the header described above, you can use a [JSON patch](/reference#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. When you use the update feature flag endpoint to add individual targets to a specific variation, there are two different patch documents, depending on whether there are already individual targets for the variation. If a flag variation already has individual targets, the path for the JSON patch operation is: ```json { \"op\": \"add\", \"path\": \"/environments/devint/targets/0/values/-\", \"value\": \"TestClient10\" } ``` If a flag variation does not already have individual targets, the path for the JSON patch operation is: ```json [ { \"op\": \"add\", \"path\": \"/environments/devint/targets/-\", \"value\": { \"variation\": 0, \"values\": [\"TestClient10\"] } } ] ``` ### Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows). ### Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an `ignoreConflicts` query parameter set to `true`. ### Migration flags For migration flags, the cohort information is included in the `rules` property of a flag's response. You can update cohorts by updating `rules`. Default cohort information is included in the `fallthrough` property of a flag's response. You can update the default cohort by updating `fallthrough`. When you update the rollout for a cohort or the default cohort through the API, provide a rollout instead of a single `variationId`. To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagKey - The feature flag key. The key identifies the flag in your code. (required)
        patchWithComment - (required)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object
      • postFeatureFlagCall

        public okhttp3.Call postFeatureFlagCall​(java.lang.String projectKey,
                                                FeatureFlagBody featureFlagBody,
                                                java.lang.String clone,
                                                ApiCallback _callback)
                                         throws ApiException
        Build call for postFeatureFlag
        Parameters:
        projectKey - The project key (required)
        featureFlagBody - (required)
        clone - The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting `clone=flagKey` copies the full targeting configuration for all environments, including `on/off` state, from the original flag to the new flag. (optional)
        _callback - Callback for upload/download progress
        Returns:
        Call to execute
        Throws:
        ApiException - If fail to serialize the request body object
      • postFeatureFlag

        public FeatureFlag postFeatureFlag​(java.lang.String projectKey,
                                           FeatureFlagBody featureFlagBody,
                                           java.lang.String clone)
                                    throws ApiException
        Create a feature flag Create a feature flag with the given name, key, and variations. ### Creating a migration flag When you create a migration flag, the variations are pre-determined based on the number of stages in the migration. To create a migration flag, omit the `variations` and `defaults` information. Instead, provide a `purpose` of `migration`, and `migrationSettings`. If you create a migration flag with six stages, `contextKind` is required. Otherwise, it should be omitted. Here's an example: ```json { \"key\": \"flag-key-123\", \"purpose\": \"migration\", \"migrationSettings\": { \"stageCount\": 6, \"contextKind\": \"account\" } } ``` To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagBody - (required)
        clone - The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting `clone=flagKey` copies the full targeting configuration for all environments, including `on/off` state, from the original flag to the new flag. (optional)
        Returns:
        FeatureFlag
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • postFeatureFlagWithHttpInfo

        public ApiResponse<FeatureFlag> postFeatureFlagWithHttpInfo​(java.lang.String projectKey,
                                                                    FeatureFlagBody featureFlagBody,
                                                                    java.lang.String clone)
                                                             throws ApiException
        Create a feature flag Create a feature flag with the given name, key, and variations. ### Creating a migration flag When you create a migration flag, the variations are pre-determined based on the number of stages in the migration. To create a migration flag, omit the `variations` and `defaults` information. Instead, provide a `purpose` of `migration`, and `migrationSettings`. If you create a migration flag with six stages, `contextKind` is required. Otherwise, it should be omitted. Here's an example: ```json { \"key\": \"flag-key-123\", \"purpose\": \"migration\", \"migrationSettings\": { \"stageCount\": 6, \"contextKind\": \"account\" } } ``` To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagBody - (required)
        clone - The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting `clone=flagKey` copies the full targeting configuration for all environments, including `on/off` state, from the original flag to the new flag. (optional)
        Returns:
        ApiResponse<FeatureFlag>
        Throws:
        ApiException - If fail to call the API, e.g. server error or cannot deserialize the response body
      • postFeatureFlagAsync

        public okhttp3.Call postFeatureFlagAsync​(java.lang.String projectKey,
                                                 FeatureFlagBody featureFlagBody,
                                                 java.lang.String clone,
                                                 ApiCallback<FeatureFlag> _callback)
                                          throws ApiException
        Create a feature flag (asynchronously) Create a feature flag with the given name, key, and variations. ### Creating a migration flag When you create a migration flag, the variations are pre-determined based on the number of stages in the migration. To create a migration flag, omit the `variations` and `defaults` information. Instead, provide a `purpose` of `migration`, and `migrationSettings`. If you create a migration flag with six stages, `contextKind` is required. Otherwise, it should be omitted. Here's an example: ```json { \"key\": \"flag-key-123\", \"purpose\": \"migration\", \"migrationSettings\": { \"stageCount\": 6, \"contextKind\": \"account\" } } ``` To learn more, read [Migration Flags](https://docs.launchdarkly.com/home/flag-types/migration-flags).
        Parameters:
        projectKey - The project key (required)
        featureFlagBody - (required)
        clone - The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting `clone=flagKey` copies the full targeting configuration for all environments, including `on/off` state, from the original flag to the new flag. (optional)
        _callback - The callback to be executed when the API call finishes
        Returns:
        The request call
        Throws:
        ApiException - If fail to process the API call, e.g. serializing the request body object