Skip to content

Create or update a feature flag

POST
/api/v4/features/{name}

Creates or updates a feature flag value. If a feature with the given name doesn’t exist yet, the operation creates one. The value can be a boolean or an integer to indicate percentage of time.

name
required
string

The name of the feature flag

Media type application/json
object
value
required
One of:
string
nullable
key

percentage_of_actors or percentage_of_time (default)

string
nullable
feature_group

A Feature group name

string
nullable
user

A GitLab username or comma-separated multiple usernames

string
nullable
group

A GitLab group’s path, for example gitlab-org, or comma-separated multiple group paths

string
nullable
namespace

A GitLab group or user namespace’s path, for example john-doe, or comma-separated multiple namespace paths. Introduced in GitLab 15.0.

string
nullable
project

A projects path, for example gitlab-org/gitlab-foss, or comma-separated multiple project paths

string
nullable
organization

An organization ID or path, for example 1 or default, or comma-separated multiple organization IDs or paths

string
nullable
repository

A repository path, for example gitlab-org/gitlab-test.git, gitlab-org/gitlab-test.wiki.git, snippets/21.git, to name a few. Use comma to separate multiple repository paths

string
nullable
runner

A runner ID, or comma-separated list of runner IDs

string
nullable
endpoint

A caller_id identifying a code path, for example GET /api/v4/projects/:id or ProjectsController#show. Use comma to separate multiple endpoint paths

string
nullable
force

Skip feature flag validation checks, such as a YAML definition

boolean
nullable
Example generated
{
"value": "example",
"key": "example",
"feature_group": "example",
"user": "example",
"group": "example",
"namespace": "example",
"project": "example",
"organization": "example",
"repository": "example",
"runner": "example",
"endpoint": "example",
"force": true
}

Created

Media type application/json
object
name
string
state
string
gates
object
key
string
value
integer
definition
object
name
string
feature_issue_url
string
introduced_by_url
string
rollout_issue_url
string
milestone
string
log_state_changes
boolean
type
string
group
string
default_enabled
boolean
intended_to_rollout_by
string
Example
{
"name": "experimental_feature",
"state": "off",
"gates": {
"key": "percentage_of_actors",
"value": 34
}
}

Bad request

Unauthorized

Forbidden

Not Found