For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Get started
    • Overview
    • Onboarding
    • Get started
    • Launch Insights
    • LaunchDarkly architecture
    • LaunchDarkly vocabulary
  • AgentControl
    • AgentControl
    • Manage AgentControl
  • Feature flags
    • Create flags
    • Target with flags
    • Flag templates
    • Manage flags
    • Code references
    • Contexts
      • An introduction to contexts
      • The Contexts list
      • Context kinds
        • Viewing context kinds
        • Creating and editing context kinds
        • Archiving context kinds
      • Context attributes
      • Multi-contexts
      • Anonymous contexts
    • Segments
  • Releases
    • Releasing features with LaunchDarkly
    • Release policies
    • Percentage rollouts
    • Progressive rollouts
    • Guarded rollouts
    • Feature monitoring
    • Release pipelines
    • Engineering insights
    • Release management tools
    • Applications and app versions
    • Change history
    • Restoring previous flag versions
  • Observability
    • Observability
    • Session replay
    • Error monitoring
    • Logs
    • Traces
    • Observability metrics
    • Product analytics events
    • LLM observability
    • Alerts
    • Dashboards
    • Service map
    • Vega for auto-remediation
    • Observability MCP server
    • Search specification
    • Observability settings
    • Observability integrations
  • Experimentation
    • Experimentation
    • Experiment metric types
    • Experiment configuration
    • Managing experiments
    • Analyzing experiments
    • Multi-armed bandits
    • Holdouts
  • Metrics and events
    • Metrics in LaunchDarkly
    • Creating metrics
    • Metric groups
    • Events
    • Autogenerated metrics
  • Warehouse native
    • Warehouse native metrics
    • Setting up external warehouses
    • Creating experiments using warehouse native metrics
  • Infrastructure
    • Connect apps and services to LaunchDarkly
    • LaunchDarkly in China and Pakistan
    • LaunchDarkly in the European Union (EU)
    • LaunchDarkly in federal environments
    • Public IP list
  • Your account
    • Projects
    • Views
    • Environments
    • Tags
    • Teams
    • Members
    • Roles
    • Account security
    • Feature previews
    • Billing and usage
    • Changelog
Sign inTry it free
LogoLogo
On this page
  • Create context kinds
  • Create context kinds in the UI
  • Create context kinds from an SDK
  • Edit context kinds
Feature flagsContextsContext kinds

Creating and editing context kinds

Was this page helpful?
Previous

Archiving context kinds

Next
Built with

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.

Create context kinds in the UI

To create a context kind in the LaunchDarkly UI:

  1. In the left sidebar, click Code. The CodeControl menu appears.
  2. Click Contexts.
  3. Click the gear icon on the right. The context kinds list appears.
  4. Click Add kind.
  5. The “New context kind” dialog appears.
  6. Enter a Name for the context kind. This appears in the context kind list, and as a filter option in the Contexts list.
  7. 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.
  8. (Optional) Enter a Description for the context kind.
  9. (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 checkbox if you want new experiments and guarded rollouts to default to this context kind as the randomization unit.
  10. Click Create kind.

Create context kinds from an SDK

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.