Creates a new FeatureWriter client instance.
Configuration options including API URL, auth token provider, and workspace
Archives a feature flag (moves it to archived state while preserving data).
Name of the feature flag to archive
Current feature flag data
Promise resolving to true if archived successfully, false if featureData is null/undefined
Archived flags can be restored using unarchiveFeatureFlag. This is preferred over deleteFeatureFlag when you might need the configuration later.
Copies a feature flag to another workspace without removing it from current workspace.
Name of the feature flag to copy
Feature flag data to copy
Target workspace ID
Promise resolving to false if featureData or workspace is null/undefined
Permanently deletes a feature flag.
Name of the feature flag to delete
This operation is irreversible. Consider using archiveFeatureFlag instead if you might need to restore the flag later.
Moves a feature flag from current workspace to another workspace.
Name of the feature flag to move
Current feature flag data
Target workspace ID
Promise resolving to false if featureData or workspace is null/undefined
This operation copies the flag to the target workspace and then deletes it from the current workspace. If you want to keep the flag in both workspaces, use copyFeatureToWorkspace instead.
Registers a new condition configuration.
Name for the condition (must be snake_case)
Condition logic definition
Registers a new user segment group.
Name for the segment (must be snake_case)
Type of segment ('user' or 'device')
Criteria for segment membership
Creates a new feature flag.
Name of the feature flag (must be snake_case)
Optionaloptions: Partial<FeatureData>Feature flag configuration data
Optionalworkspace: stringTarget workspace (defaults to instance workspace)
Restores an archived feature flag to active state.
Name of the archived feature flag
Archived feature flag data to restore
Promise resolving to true if unarchived successfully, false if featureData is null/undefined
Updates an existing condition configuration.
Name of the condition to update
New condition logic
Updates an existing feature flag.
Name of the feature flag to update
Optionaloptions: Partial<FeatureData>Partial feature flag data to update
Updates an existing segment group.
Name of the segment to update
Updated segment type
Updated segment criteria
Staticpreserve
Client for managing feature flags, segments, and conditions.
Provides full write access to the Brave Ship feature flag system, including creating, updating, deleting, archiving, and moving feature flags between workspaces.
Remarks
All feature flag names must follow snake_case convention (lowercase with underscores).
Example: Basic usage