Standard segments
Read time: 3 minutes
Last edited: Feb 27, 2023
Overview
This topic explains how to build and manage standard segments. Standard segments let you target groups of contexts by attribute.
To learn how to build standard segments, read Creating segments.
The contents on this page are only applicable to standard segments. To learn how to create and manage Big Segments, read Big Segments.
Customizing segments
You can customize a segment to apply to different contexts or attributes, or exclude contexts and attributes, in the segment's Targeting tab. Segment targeting rules function the same way as flag targeting rules. To learn more, read Targeting with flags.
To customize a segment:
- Navigate to the Targeting tab of the segment you wish to modify.
- Individually target contexts, or lists of contexts, with the Included targets or Excluded targets options.
- Click + Add rules to create a custom rule for this segment. The custom rule menu appears:

- Specify an attribute, an operator, and values for the rule.
- If you want to add more criteria, click the plus button beside the rule criteria.

- Select whether to include in the segment all contexts that match the rule, or a percentage of contexts that match the rule.
- If you select a percentage of contexts, select a context kind and enter the percentage to include in the segment.
- Click Save.
When you specify rules for a segment, LaunchDarkly parses them in order of appearance from top to bottom. You can change how segment targeting applies based on the order of the rules you create.
Targeting a segment in multiple flags
You can target the same segment from multiple feature flags. If you have many flags that need the same targeting rules, it may be easier to set up a single segment with those rules for your flags to target, rather than setting up the rules repeatedly in each flag.
If you target only a percentage of contexts that match your segment targeting rule, each flag that targets that segment will include the same contexts in its targeting, assuming there are no other differences between the flags' targeting rules.
For example, imagine you configure a segment to target 50% of user contexts that match its rule. As a result, the segment includes user contexts Adrian
, Bailey
, and Cristiano
, and excludes user contexts DJ
, Ellis
, and Felicia
. If there are no other differences between the flags' targeting rules, each flag that targets that segment will also include user contexts Adrian
, Bailey
, and Cristiano
in its targeting, while excluding user contexts DJ
, Ellis
, and Felicia
.
Targeting individual contexts
You can individually target contexts for inclusion in or exclusion from a segment.
To individually target a context:
- Navigate to the Segments list and choose the segment you wish to modify.
- In the "Included targets" or "Excluded targets" section, search for the context you want to include or exclude by searching for its name or key in the search field.
- Click the context name or key. The context is now individually targeted within the segment.
Here is an image of an individually targeted context:

You can remove all included or excluded contexts from a segment by clicking the overflow menu and selecting "Clear."

If you're on an Enterprise plan, you can also bulk edit segments to make changes to multiple contexts simultaneously. To learn more, read Bulk editing contexts in segments.
Exporting segments
You can export the contexts within a segment to a CSV file for use in other systems.
To export included or excluded contexts within a segment to a CSV file:
- Navigate to the Segments list and click the name of the segment you wish to export. The segment's Targeting tab appears.
- In the "Included targets" or "Excluded targets" section, click the overflow menu.
- Click "Export as CSV." A CSV file including the list of context keys the segment is targeting downloads to your machine.
Scheduling context removal from segments
Scheduling removal dates is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.
You can schedule a date and time on which LaunchDarkly removes a context from a segment. You can do this for existing contexts, or when you add a context to a segment.
This is useful if you want to give contexts temporary access to a feature that has their segment targeted. The ability to remove contexts from segments, instead of flag targeting, allows you to keep your flag's targeting rules permanent and clean.
To set a targeting removal date:
- Navigate to the Segments list and choose the segment you wish to modify.
- In the Included targets field, click the calendar icon on the context you want to remove:

- Set a date and time for the context to be removed from the segment.
- Click Save.
Additionally, when you add a context to a segment, you can schedule it for removal later by clicking Add + schedule removal.
Here is an image of the targeting field:

You can also use the REST API: Update expiring targets for segment