Creating and editing context kinds
Overview
This topic explains how to create and edit context kinds.
Create context kinds
Creating context kinds requires specific permissions
You can only create new context kinds in the LaunchDarkly user interface (UI) if have a role that allows the createContextKind
action. The LaunchDarkly Project Admin, Maintainer, and Developer project roles, as well as the Admin and Owner base roles, all have this ability. To learn more, read About member roles and Context kind actions.
You can create context kinds in the LaunchDarkly UI, or automatically when you evaluate a context using a LaunchDarkly SDK.
To create a context kind in the LaunchDarkly UI:
- Navigate to the Contexts list.
- Click the gear icon on the right. The context kinds list appears.
- Click Add kind.
- The “New context kind” dialog appears.
- Enter a Name for the context kind. This appears in the context kind list, and as a filter option in the Contexts list.
- Enter a Key for the context kind. You cannot change this later. It appears in the Contexts list and on the context details page in the “Attributes” section.
- (Optional) Enter a Description for the context kind.
- (Optional) Uncheck the Available for experiments and guarded rollouts checkbox if you don’t want to use this context kind as a randomization unit in experiments and guarded rollouts. To learn more, read Randomization units.
- (Optional) Check the Set as the default for experiments and guarded rollouts checkbox if you want new experiments and guarded rollouts to default to this context kind as the randomization unit.
- Click Create kind.
To create a context kind automatically, create a context object in your LaunchDarkly SDK. When you evaluate a flag for the context, LaunchDarkly automatically creates a new context kind for that context’s kind, if one of the same name does not already exist.
Try it in your SDK: Evaluating flags
You can also use the REST API: Create or update context kind
Edit context kinds
You can edit existing context kinds from the context kinds list by clicking on the three-dot overflow menu next to the context kind and selecting “Edit.”
You can edit the name and description of the context kind, but you cannot edit the key.
If you use Experimentation or guarded rollouts, you can also edit whether the context kind is available for these features, and whether the context kind should be the default for experiments and guarded rollouts. To learn more, read Randomization units.