add_segment_to_treatment
Add a segment to a feature flag's treatment using read-modify-write, avoiding accidental removal of existing targeting. Idempotent; does nothing if segment already present.
Instructions
Add a segment to a specific treatment of a feature flag via read-modify-write — safer than update_flag_definition's full replace, where a dropped field silently removes existing targeting. Idempotent: a no-op if the segment is already on the treatment. For workspaces where list_workspaces reports requiresTitleAndComments: true, pass title (and comment).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Change title. Required for workspaces with requiresTitleAndComments: true | |
| comment | No | Change comment. Required for workspaces with requiresTitleAndComments: true | |
| segment | Yes | The segment name to add | |
| flag_name | Yes | The feature flag name | |
| treatment | Yes | The treatment name to add the segment to (e.g. 'on') | |
| workspace_id | Yes | The workspace ID | |
| environment_id | Yes | The environment ID or name |