Skip to content

Create or update approval configuration for a project

POST
/api/v4/projects/{id}/approvals

Creates or updates the approval configuration for a project. The currently authenticated user must be an eligible approver.

id
required
One of:
string

The ID or URL-encoded path of the project

Media type application/json
object
approvals_before_merge

The amount of approvals required before an MR can be merged

integer
nullable
reset_approvals_on_push

Should the approval count be reset on a new push

boolean
nullable
selective_code_owner_removals

Reset approvals from Code Owners if their files changed

boolean
nullable
disable_overriding_approvers_per_merge_request

Should MRs be able to override approvers and approval count

boolean
nullable
merge_requests_author_approval

Should merge request authors be able to self approve merge requests; true means authors cannot self approve

boolean
nullable
merge_requests_disable_committers_approval

Should committers be able to self approve merge requests

boolean
nullable
require_password_to_approve

Should approvers authenticate via password before adding approval

boolean
nullable
require_reauthentication_to_approve

Should approvers authenticate via password or SAML before adding approval

boolean
nullable
Example generated
{
"approvals_before_merge": 1,
"reset_approvals_on_push": true,
"selective_code_owner_removals": true,
"disable_overriding_approvers_per_merge_request": true,
"merge_requests_author_approval": true,
"merge_requests_disable_committers_approval": true,
"require_password_to_approve": true,
"require_reauthentication_to_approve": true
}

Created

Media type application/json
object
approvers
object
user
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
approver_groups
object
group
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
approvals_before_merge
integer
reset_approvals_on_push
boolean
selective_code_owner_removals
boolean
disable_overriding_approvers_per_merge_request
boolean
merge_requests_author_approval
boolean
merge_requests_disable_committers_approval
boolean
require_password_to_approve
boolean
require_reauthentication_to_approve
boolean
Example
{
"approvers": {
"user": {
"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"
}
},
"approver_groups": {
"group": {
"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"
}
}
}
}

Bad Request

Not Found