#8413·flagsmith

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_feature doesn't have any dependencies, and feature is not a prerequisite feature.
  • finds the system segment via the environment's live FeatureSegment.
  • if found, appends a $.flags.{prerequisite_feature}.enabled != true rule.
  • if not, creates the segment with that single rule and persists an enabled: false override in line with the environment's versioning.

Acceptance criteria

  • POST creates a system, feature-specific segment with a enabled != true condition and an override setting enabled: false at priority 0, shifting conflicting priorities to a weaker position.
  • A POST for 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_OVERRIDES permission on the environment.
  • A prerequisite feature cannot be a dependent feature.
  • A dependent feature cannot be a prerequisite feature.