Skip to content

Update an approval rule for a merge request

PUT
/api/v4/projects/{id}/merge_requests/{merge_request_iid}/approval_rules/{approval_rule_id}

Updates a specified approval rule for a merge request. This endpoint removes any approvers and groups not included in the group_ids, user_ids, or usernames attributes. The report_approver or code_owner rules are system-generated, and you cannot edit them.

id
required
One of:
string

The ID or URL-encoded path of the project

merge_request_iid
required
integer

The IID of a merge request

approval_rule_id
required
integer

The ID of a merge request approval rule

Media type application/json
object
name

The name of the approval rule

string
nullable
approvals_required

The number of required approvals for this rule

integer
nullable
user_ids

The user ids for this rule

Array<integer>
nullable
group_ids

The group ids for this rule

Array<integer>
nullable
usernames

The group ids for this rule

Array<string>
nullable
remove_hidden_groups

Whether hidden groups should be removed

boolean
nullable
Example generated
{
"name": "example",
"approvals_required": 1,
"user_ids": [
1
],
"group_ids": [
1
],
"usernames": [
"example"
],
"remove_hidden_groups": true
}

OK

Media type application/json
object
id
integer format: int64
name
string
rule_type
string
eligible_approvers
Array<object>
object
id
integer format: int64
username
string
public_email
string
name
string
state
string
locked
boolean
avatar_url
string
avatar_path
string
custom_attributes
Array<object>
object
key
string
value
string
web_url
string
approvals_required
integer
users
Array<object>
object
id
integer format: int64
username
string
public_email
string
name
string
state
string
locked
boolean
avatar_url
string
avatar_path
string
custom_attributes
Array<object>
object
key
string
value
string
web_url
string
groups
Array<object>
object
id
integer format: int64
web_url
string
name
string
path
string
description
string
visibility
string
share_with_group_lock
boolean
require_two_factor_authentication
boolean
two_factor_grace_period
integer
project_creation_level
string
auto_devops_enabled
string
subgroup_creation_level
string
emails_disabled
boolean
emails_enabled
boolean
show_diff_preview_in_email
boolean
mentions_disabled
string
lfs_enabled
boolean
archived
boolean
math_rendering_limits_enabled
boolean
lock_math_rendering_limits_enabled
boolean
crm_enabled
boolean
resource_access_token_notify_inherited
boolean
lock_resource_access_token_notify_inherited
boolean
default_branch
string
default_branch_protection
integer
default_branch_protection_defaults
string
avatar_url
string
request_access_enabled
boolean
full_name
string
full_path
string
created_at
string
parent_id
string
organization_id
integer format: int64
shared_runners_setting
string
max_artifacts_size
integer
custom_attributes
object
key
string
value
string
statistics
string
marked_for_deletion_on
string
root_storage_statistics
object
build_artifacts_size

CI artifacts size in bytes.

integer
container_registry_size

Container registry size in bytes.

integer
container_registry_size_is_estimated

Indicates whether the deduplicated container registry size for the namespace is an estimated value or not.

boolean
dependency_proxy_size

Dependency Proxy sizes in bytes.

integer
lfs_objects_size

LFS objects size in bytes.

integer
packages_size

Packages size in bytes.

integer
pipeline_artifacts_size

CI pipeline artifacts size in bytes.

integer
repository_size

Git repository size in bytes.

integer
snippets_size

Snippets size in bytes.

integer
storage_size

Total storage in bytes.

integer
uploads_size

Uploads size in bytes.

integer
wiki_size

Wiki size in bytes.

integer
ldap_cn
string
ldap_access
string
ldap_group_links
object
cn
string
group_access
integer
provider
string
filter
string
member_role_id
integer format: int64
saml_group_links
object
name
string
access_level
integer
member_role_id
integer format: int64
provider
string
file_template_project_id
string
wiki_access_level
string
repository_storage
string
duo_core_features_enabled

[Experimental] Indicates whether GitLab Duo Core features are enabled for the group

boolean
duo_features_enabled
string
lock_duo_features_enabled
string
auto_duo_code_review_enabled
string
web_based_commit_signing_enabled
string
allow_personal_snippets
string
duo_namespace_access_rules
string
built_in_project_templates_enabled
boolean
lock_built_in_project_templates_enabled
boolean
contains_hidden_groups
boolean
report_type
string
section
string
source_rule
object
approvals_required
integer
overridden
boolean
Example
{
"id": 1,
"name": "QA",
"rule_type": "regular",
"eligible_approvers": [
{
"id": 1,
"username": "admin",
"public_email": "john@example.com",
"name": "Administrator",
"state": "active",
"avatar_url": "https://gravatar.com/avatar/1",
"avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
"custom_attributes": [
{
"key": "foo",
"value": "bar"
}
],
"web_url": "https://gitlab.example.com/root"
}
],
"approvals_required": 2,
"users": [
{
"id": 1,
"username": "admin",
"public_email": "john@example.com",
"name": "Administrator",
"state": "active",
"avatar_url": "https://gravatar.com/avatar/1",
"avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
"custom_attributes": [
{
"key": "foo",
"value": "bar"
}
],
"web_url": "https://gitlab.example.com/root"
}
],
"groups": [
{
"web_url": "http://gitlab.example.com/groups/diaspora",
"name": "Diaspora",
"custom_attributes": {
"key": "foo",
"value": "bar"
},
"ldap_group_links": {
"cn": "ldap-group-1",
"group_access": 10,
"provider": "ldapmain",
"filter": "id >= 500",
"member_role_id": 12
},
"saml_group_links": {
"name": "saml-group-1",
"access_level": 40,
"member_role_id": 12,
"provider": "saml"
}
}
],
"section": "Backend",
"source_rule": {
"approvals_required": 2
}
}

Bad Request

Not Found