POST /api/projects/:id/feature_flags
Creates a new feature flag in your PostHog project. Feature flags allow you to roll out features to specific users or groups based on properties, cohorts, and rollout percentages.Path Parameters
Project ID
Request Body
Unique identifier for the flag. Only letters, numbers, hyphens (-) and underscores (_) allowed. Max 400 characters.
Human-readable description of the flag (despite field name, this is the description)
Whether the flag is active
Release conditions for the feature flag
Array of condition groups. At least one group required.
Percentage of users to roll out to (0-100)
Property filters for this group
Property name
Property type:
person, group, cohort, or flagValue to match against
Comparison operator:
exact, is_not, icontains, regex, gt, gte, lt, lte, is_set, is_not_set, is_date_before, is_date_after, etc.Override to serve a specific variant to this group (multivariate flags only)
JSON payloads to return with flag evaluation. Keys must match variant keys for multivariate flags, or be “true” for boolean flags.
Group type index for group-based flags (0-4)
Ensure consistent experience for anonymous users across sessions
Array of tag names to associate with this flag
Array of tag names for runtime evaluation context constraints (must be subset of tags)
Conditions that trigger automatic rollback
Whether payloads are encrypted
Response
Feature flag ID
Feature flag key
Feature flag description
Release conditions
Whether the flag is active
Whether the flag is soft-deleted
ISO 8601 timestamp
User who created the flag
Associated tags
Version number for optimistic locking
Examples
Boolean Flag with Rollout Percentage
Flag with Property Filters
Multivariate Flag with Variants
Flag with Cohort Filter
Validation Rules:
- Flag key must be unique within the project
- At least one condition group required
- Multivariate variant rollout percentages must sum to 100
- Property values in lists cannot exceed 1000 items (10 in tests)
- Cohorts with behavioral filters (events) cannot be used in feature flags
- Maximum flag filter size is configurable per deployment