Use this API to manage Git tags. This API also returns X.509 signature information from signed tags.

List all project repository tags

GET /api/v4/projects/{id}/repository/tags

Lists all repository tags from a project, sorted by update date and time in descending order.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
sort
Query
StringReturn tags sorted in updated by asc or desc order
Allowed values: asc, desc
Default: desc
order_by
Query
StringReturn tags ordered by name, updated, version fields
Allowed values: name, updated, version
Default: updated
search
Query
StringReturn list of tags matching the search criteria
page_token
Query
StringName of tag to start the pagination from
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesTag
400Bad Request—
403Unauthenticated—
404Not found—
422Unprocessable entity—
503Service unavailable—

Create a tag

POST /api/v4/projects/{id}/repository/tags

Creates a tag in the repository that points to a specified reference.

Parameters

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

Request body (application/json)

PropertyTypeDescription
messageStringSpecifying a message creates an annotated tag
Example: Release 1.0.0
ref
Required
StringThe commit sha or branch name
Example: 2695effb5807a22ff3d138d593fd856244e155e7
tag_name
Required
StringThe name of the tag
Example: v.1.0.0

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesTag
400Bad request—
403Unauthenticated—
404Not found—
429Too many requests—

Retrieve a single repository tag

GET /api/v4/projects/{id}/repository/tags/{tag_name}

Retrieves a repository tag with a specified name. This endpoint can be accessed without authentication if the repository is publicly accessible.

Parameters

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

Responses

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

Delete a tag

DELETE /api/v4/projects/{id}/repository/tags/{tag_name}

Deletes a specified repository tag.

Parameters

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

Responses

CodeDescriptionSchema
204No Content—
400Bad request—
403Unauthenticated—
404Not found—
412Precondition failed—

Retrieve X.509 signature of a tag

GET /api/v4/projects/{id}/repository/tags/{tag_name}/signature

Retrieves the X.509 signature from a signed tag. Unsigned tags return a 404 Not Found response.

Parameters

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

Responses

CodeDescriptionSchema
200OKAPIEntitiesTagSignature
400Bad Request—
404Not found—

Schemas

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

APIEntitiesCommit

PropertyTypeDescription
author_emailStringExample: john@example.com
author_nameStringExample: John Smith
authored_dateString (date-time)Example: 2012-05-28T04:42:42-07:00
committed_dateString (date-time)Example: 2012-05-28T04:42:42-07:00
committer_emailStringExample: jack@example.com
committer_nameStringExample: Jack Smith
created_atString (date-time)Example: 2017-07-26T11:08:53.000+02:00
extended_trailersObjectExample: {"Signed-off-by":["John Doe \u003cjohndoe@gitlab.com\u003e","Jane Doe \u003cjanedoe@gitlab.com\u003e"]}
idStringExample: 2695effb5807a22ff3d138d593fd856244e155e7
messageStringExample: Initial commit
parent_idsArray of stringsExample: ["2a4b78934375d7f53875269ffd4f45fd83a84ebe"]
short_idStringExample: 2695effb
titleStringExample: Initial commit
trailersObjectExample: {"Merged-By":"Jane Doe janedoe@gitlab.com"}
web_urlStringExample: https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746

APIEntitiesTag

PropertyTypeDescription
commitAPIEntitiesCommit—
created_atString (date-time)Example: 2023-10-12T02:16:52.000Z
messageStringExample: Release v1.0.0
nameStringExample: v1.0.0
protectedBooleanExample: true
releaseAPIEntitiesTagRelease—
targetStringExample: 2695effb5807a22ff3d138d593fd856244e155e7

APIEntitiesTagRelease

PropertyTypeDescription
descriptionStringExample: Amazing release. Wow
tag_nameStringExample: 1.0.0

APIEntitiesTagSignature

PropertyTypeDescription
signatureObject—
signature_typeStringExample: PGP