Dependencies API: `POST`
Author: khvn26Created Aug 31, 2026Updated Sep 18, 2026
Add POST /api/v1/environments/{environment_api_key}/features/{feature}/dependencies/{prerequisite_feature}.
POST, in a transaction:
- builds the graph from index rows and checks that
prerequisite_featuredoesn't have any dependencies, andfeatureis not a prerequisite feature. - finds the system segment via the environment's live
FeatureSegment. - if found, appends a
$.flags.{prerequisite_feature}.enabled != truerule. - if not, creates the segment with that single rule and persists an
enabled: falseoverride in line with the environment's versioning.
Acceptance criteria
POSTcreates a system, feature-specific segment with aenabled != truecondition and an override settingenabled: falseat priority 0, shifting conflicting priorities to a weaker position.- A
POSTfor the same feature and a different prerequisite feature appends a rule to the existing segment. - Dependencies added in one environment do not appear in another.
- V2 versioning environments get a published version.
- V1 versioning environments get a direct write.
- Both V2 and V1 versioned environments emit audit logs:
Feature {prerequisite_feature} added as dependency for feature {feature}. - Requires
MANAGE_SEGMENT_OVERRIDESpermission on the environment. - A prerequisite feature cannot be a dependent feature.
- A dependent feature cannot be a prerequisite feature.
Source: Flagsmith/flagsmith