Use this API to manage a project’s feature flags and the user lists that scope them to particular users.
These endpoints require the Developer, Maintainer, or Owner role.
List all feature flags for a project
GET /api/v4/projects/{id}/feature_flags
Lists all feature flags of the requested project. Use the page and per_page pagination parameters to control the pagination of results.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
scopeQuery | String | The scope of feature flags,enabled,disabledAllowed values: enabled,disabled |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Create a feature flag
POST /api/v4/projects/{id}/feature_flags
Creates a feature flag for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
active | Boolean | The active state of the flag.true. |
description | String | The description of the feature flag |
nameRequired | String | The name of the feature flag |
strategies | Array of objects | Array of feature flag strategies |
strategies[].Required | String | The strategy name.default,gradual,user,gitlab.flexible |
strategies[]. | Object | The strategy parameters as a JSON-{"user |
strategies[]. | Array of objects | Array of scopes for the strategy |
strategies[].Required | String | The environment scope of the scope |
strategies[]. | Integer | The ID of the feature flag user list.gitlab |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Retrieve a feature flag
GET /api/v4/projects/{id}/feature_flags/{feature_flag_name}
Retrieves a specified feature flag.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
feature_Path, | String | The name of the feature flag |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Update a feature flag
PUT /api/v4/projects/{id}/feature_flags/{feature_flag_name}
Updates a specified feature flag.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
feature_Path, | String | The name of the feature flag |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
active | Boolean | The active state of the flag. |
description | String | The description of the feature flag |
name | String | The new name of the feature flag. |
strategies | Array of objects | Array of feature flag strategies |
strategies[]. | Boolean | Delete the strategy when true |
strategies[]. | Integer | The feature flag strategy ID |
strategies[]. | String | The strategy name |
strategies[]. | Object | The strategy parameters as a JSON-{"user |
strategies[]. | Array of objects | Array of scopes for the strategy |
strategies[]. | Boolean | Delete the scope when true |
strategies[]. | String | The environment scope of the scope |
strategies[]. | Integer | The scope id |
strategies[]. | Integer | The ID of the feature flag user list |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
422 | Unprocessable entity | — |
Delete a feature flag
DELETE /api/v4/projects/{id}/feature_flags/{feature_flag_name}
Deletes a specified feature flag.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
feature_Path, | String | The name of the feature flag |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Retrieve feature flag settings
GET /api/v4/projects/{id}/feature_flags_settings
Retrieves the feature flag settings of a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Update feature flag settings
PUT /api/v4/projects/{id}/feature_flags_settings
Updates the feature flag settings of a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
minimum_Required | String | Minimum role required to create, Allowed values: no_,developer,maintainer,ownerMinimum length: 1 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
List all feature flag user lists for a project
GET /api/v4/projects/{id}/feature_flags_user_lists
Lists all feature flag user lists for a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
searchQuery | String | Return user lists matching the search criteria |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Create a feature flag user list
POST /api/v4/projects/{id}/feature_flags_user_lists
Creates a feature flag user list in a specified project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
nameRequired | String | The name of the list |
user_Required | String | A comma separated list of external user ids |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
Retrieve a feature flag user list
GET /api/v4/projects/{id}/feature_flags_user_lists/{iid}
Retrieves a specified feature flag user list.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
iidPath, | String or integer | The internal ID of the project’s feature flag user list |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Update a feature flag user list
PUT /api/v4/projects/{id}/feature_flags_user_lists/{iid}
Updates a specified feature flag user list.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
iidPath, | String or integer | The internal ID of the project’s feature flag user list |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
name | String | The name of the list |
user_ | String | A comma separated list of external user ids |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
404 | Not found | — |
Delete feature flag user list
DELETE /api/v4/projects/{id}/feature_flags_user_lists/{iid}
Deletes a specified feature flag user list.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID or URL- |
iidPath, | String or integer | The internal ID of the project’s feature flag user list |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Resource deleted | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
409 | Conflict | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesFeatureFlag
| Property | Type | Description |
|---|---|---|
active | Boolean | — |
created_ | String (date- | Example:2019- |
description | String | Example:merge train feature flag |
name | String | Example:merge_ |
scopes | Array | — |
strategies | APIEntities | — |
updated_ | String (date- | Example:2019- |
version | String | Example:new_ |
APIEntitiesFeatureFlagBasicUserList
| Property | Type | Description |
|---|---|---|
id | Integer (int64) | Example:1 |
iid | Integer | Example:1 |
name | String | Example:user_ |
user_ | String | Example:user1, |
APIEntitiesFeatureFlagScope
| Property | Type | Description |
|---|---|---|
environment_ | String | Example:production |
id | Integer (int64) | Example:1 |
APIEntitiesFeatureFlagSettings
| Property | Type | Description |
|---|---|---|
minimum_ | String | Example:developer |
APIEntitiesFeatureFlagStrategy
| Property | Type | Description |
|---|---|---|
id | Integer (int64) | Example:1 |
name | String | Example:user |
parameters | String | Example:{"user |
scopes | APIEntities | — |
user_ | APIEntities | — |
APIEntitiesFeatureFlagUserList
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2020- |
edit_ | String | — |
id | Integer (int64) | Example:1 |
iid | Integer | Example:1 |
name | String | Example:user_ |
path | String | — |
project_ | Integer (int64) | Example:2 |
updated_ | String (date- | Example:2020- |
user_ | String | Example:user1, |