This topic explains how to use custom rules to target contexts based on their attributes.
You can create custom targeting rules using any context kinds and any context attributes.
To create a custom targeting rule:

If you are using a mobile SDK that supports environment attributes, you can target your mobile applications based on details about your application, application version, and device using a mobile targeting rule. To create custom targeting rules using this same context information, use the ld_application and ld_device context kinds.
If you are using other mobile SDKs, you can target your mobile applications using any context attributes that you have created.
If a targeting rule references any context kinds or attributes with null values, or that do not exist for a given context, then the flag skips that rule. For example, in a rule that checks “region is one of Canada,” any context whose region attribute is not set or is set to null does not match the rule. Similarly, in a rule that checks “region is not one of Canada,” any context whose region attribute is not set or is set to null does not match the rule. This behavior ensures that your rules only target contexts for which you explicitly have attribute information.
You can add multiple conditions to a rule. Here is how rules handle multiple conditions and values:
For segment-based conditions, selecting multiple segments in a single condition uses OR logic. The condition matches if the context is a member of any one of the selected segments.
To reference a rule when working with other members of your organization, click the three-dot overflow menu and choose Copy link to rule.
You can also use the REST API: Update feature flag