Use this API to manage protected tags.

List all protected tags

GET /api/v4/projects/{id}/protected_tags

Lists all protected tags for a specified project.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesProtectedTag
400Bad Request—
403Unauthenticated—
404Not found—

Protect a repository tag

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

Protects a specified repository tag using a wildcard protected tag.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
allowed_to_createArray of objectsArray of deploy keys allowed to create protected tags
create_access_levelIntegerAccess levels allowed to create (defaults: 40, maintainer access level)
Allowed values: 30, 40, 60, 0
name
Required
StringThe name of the protected tag
Example: release-1-0

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesProtectedTag
400Bad Request—
403Unauthenticated—
404Not found—
422Unprocessable entity—

Retrieve a protected tag or wildcard protected tag

GET /api/v4/projects/{id}/protected_tags/{name}

Retrieves a specified protected tag or wildcard protected tag.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
name
Path, required
StringThe name of the tag or wildcard
Example: release*

Responses

CodeDescriptionSchema
200OKAPIEntitiesProtectedTag
400Bad Request—
403Unauthenticated—
404Not found—

Unprotect repository tags

DELETE /api/v4/projects/{id}/protected_tags/{name}

Unprotects a specified protected tag or wildcard protected tag.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
name
Path, required
StringThe name of the protected tag
Example: release-1-0

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
403Unauthenticated—
404Not found—
412Precondition Failed—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesProtectedRefAccess

PropertyTypeDescription
access_levelIntegerExample: 40
access_level_descriptionStringExample: Maintainers
deploy_key_idInteger (int64)Example: 1
group_idIntegerExample: 1
idInteger (int64)Example: 1
user_idIntegerExample: 1

APIEntitiesProtectedTag

PropertyTypeDescription
create_access_levelsArray of APIEntitiesProtectedRefAccess—
nameStringExample: release-1-0