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
      • Creating new flags
      • Flag types
      • Turning flags on and off
      • Creating flag variations
      • Cloning existing flags
      • Importing flags
      • Flag settings
    • Target with flags
    • Flag templates
    • Manage flags
    • Code references
    • 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
  • Overview
  • Boolean flags
  • String flags
  • Number flags
  • JSON flags
  • Flag types and SDKs
Feature flagsCreate flags

Flag types

Was this page helpful?
Previous

Turning flags on and off

Next
Built with

Overview

This topic explains the four types of feature flags and when to use them. When you create a flag, you can choose from four different flag types for different common use cases.

The four flag types include boolean, string, number, and JSON.

When you choose a flag type, you should choose one whose variations are the same data type as the value your code returns.

Boolean flags

Boolean flags are the most common and simple flag type, having two possible variations: true or false.

Boolean flags can be used for on/off switches, new feature rollouts, or anything that requires a binary option.

You can change the name and description of boolean flag variations, but you cannot change the variation values, and you cannot add more than two variations.

String flags

String flag variations hold simple configuration values instead of booleans. They are multivariate flags, meaning they can have more than two variations.

String flags can be used for things like switching between different versions of header text, URLs, or other configurations.

String flags have a size limit of 32KB. Strings are UTF-8 encoded, so certain characters, such as emojis and non-ASCII characters, take more than one byte each.

You can use escape sequences in string values. For example, LaunchDarkly treats string values ab\u0063 and abc as the same value.

Number flags

Number flag variations hold numerical integer or floating point values. They are multivariate flags, meaning they can have more than two variations.

Number flags are useful for numerical configuration parameters, such as thresholds or timeouts.

Some LaunchDarkly SDKs treat certain types of number variations slightly differently. To learn more, read the SDK topic on Number flags.

JSON flags

JSON flag variations hold structured data as a JSON object or array. They are multivariate flags, meaning they can have more than two variations. JSON flags have a size limit of 32KB.

JSON flags are useful when you need to bundle multiple related values within a single variation, such as settings for a UI layout or an API response.

You can treat an optional array or object property as empty if no property value is present. You can write an empty array as [], an empty object as {}, or omit the property completely.

Flag types and SDKs

To learn how LaunchDarkly SDKs interact with different flag types, read Using flag types.