---
title: "Create or update a feature flag"
method: POST
path: "/api/v4/features/{name}"
tags: ["features"]
---

# Create or update a feature flag

`POST /api/v4/features/{name}`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/features/{name}`
- Auth: none declared

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.

## Path parameters

- `name` string, required

## Request body

- PostApiV4FeaturesName: Create or update a feature flag
  - `value` string, required: `true` or `false` to enable/disable, or an integer for percentage of time
  - `key` string: `percentage_of_actors` or `percentage_of_time` (default)
  - `feature_group` string: A Feature group name
  - `user` string: A GitLab username or comma-separated multiple usernames
  - `group` string: A GitLab group's path, for example `gitlab-org`, or comma-separated multiple group paths
  - `namespace` string: A GitLab group or user namespace's path, for example `john-doe`, or comma-separated multiple namespace paths. Introduced in GitLab 15.0.
  - `project` string: A projects path, for example `gitlab-org/gitlab-foss`, or comma-separated multiple project paths
  - `organization` string: An organization ID or path, for example `1` or `default`, or comma-separated multiple organization IDs or paths
  - `repository` string: 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
  - `runner` string: A runner ID, or comma-separated list of runner IDs
  - `endpoint` string: A caller_id identifying a code path, for example `GET /api/v4/projects/:id` or `ProjectsController#show`. Use comma to separate multiple endpoint paths
  - `force` boolean: Skip feature flag validation checks, such as a YAML definition

## Response `201`

Create or update a feature flag

- APIEntitiesFeature: API_Entities_Feature model
  - `name` string, required
  - `state` string, required
  - `gates` APIEntitiesFeatureGate, required
    - `key` string, required
    - `value` integer, required
  - `definition` APIEntitiesFeatureDefinition, required: API_Entities_Feature_Definition model
    - `name` string, required
    - `feature_issue_url` string, required
    - `introduced_by_url` string, required
    - `rollout_issue_url` string, required
    - `milestone` string, required
    - `log_state_changes` boolean, required
    - `type` string, required
    - `group` string, required
    - `default_enabled` boolean, required
    - `intended_to_rollout_by` string, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
