Create a feature flag
POST
/api/v4/projects/{id}/feature_flags
Creates a feature flag for a specified project.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Request Body required
Section titled “ Request Body required ” Media type application/json
object
name
required
The name of the feature flag
string
description
The description of the feature flag
string
active
The active state of the flag. Defaults to true. Supported in GitLab 13.3 and later
boolean
strategies
Array of feature flag strategies
Array<object>
object
name
required
The strategy name. Can be default, gradualRolloutUserId, userWithId, or gitlabUserList. In GitLab 13.5 and later, can be flexibleRollout
string
parameters
The strategy parameters as a JSON-formatted string e.g. {"userIds":"user1"}
object
user_list_id
The ID of the feature flag user list. If strategy is gitlabUserList.
integer
scopes
Array of scopes for the strategy
Array<object>
object
environment_scope
required
The environment scope of the scope
string
Example generated
{ "name": "example", "description": "example", "active": true, "strategies": [ { "name": "example", "parameters": {}, "user_list_id": 1, "scopes": [ { "environment_scope": "example" } ] } ]}Responses
Section titled “ Responses ”Created
Media type application/json
object
name
string
description
string
active
boolean
version
string
created_at
string format: date-time
updated_at
string format: date-time
scopes
array
strategies
object
id
integer format: int64
name
string
parameters
string
scopes
object
id
integer format: int64
environment_scope
string
user_list
object
id
integer format: int64
iid
integer
name
string
user_xids
string
Example
{ "name": "merge_train", "description": "merge train feature flag", "version": "new_version_flag", "created_at": "2019-11-04T08:13:51.423Z", "updated_at": "2019-11-04T08:13:51.423Z", "strategies": { "id": 1, "name": "userWithId", "parameters": "{\"userIds\": \"user1\"}", "scopes": { "id": 1, "environment_scope": "production" }, "user_list": { "id": 1, "iid": 1, "name": "user_list", "user_xids": "user1,user2" } }}Bad request
Unauthorized
Forbidden
Not Found