Skip to content

Create a container registry protection tag rule

POST
/api/v4/projects/{id}/registry/protection/tag/rules

Creates a container registry protection tag rule for a project to control who can push or delete container tags. This feature was introduced in GitLab 18.8.

id
required
One of:
string

The ID or URL-encoded path of the project.

Media type application/json
object
tag_name_pattern
required

Container tag name pattern protected by the protection rule. For example, v*-release. Wildcard character * allowed.

string
nullable
minimum_access_level_for_push
required

Minimum GitLab access level required to push container tags. For example, Maintainer, Owner, or Admin.

string
>= 1 characters
Allowed values: maintainer owner admin
minimum_access_level_for_delete
required

Minimum GitLab access level required to delete container tags. For example, Maintainer, Owner, or Admin.

string
>= 1 characters
Allowed values: maintainer owner admin

Created

Media type application/json
object
id
integer format: int64
project_id
integer format: int64
tag_name_pattern
string
minimum_access_level_for_push
string
minimum_access_level_for_delete
string
Example
{
"id": 1,
"project_id": 123,
"tag_name_pattern": "v*-release",
"minimum_access_level_for_push": "maintainer",
"minimum_access_level_for_delete": "maintainer"
}

Bad Request

Unauthorized

Forbidden

Not Found

Unprocessable Entity