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 integerID or URL-encoded path of the project
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: desc
order_by
Query
StringSort results by the specified field. Sorting by version uses the semantic version number
Allowed values: name, updated, version
Default: updated
search
Query
StringReturn only tags matching the search criteria. Use ^term to find tags that begin with term, and term$ to find tags that end with term. No other regular expressions are supported
page_token
Query
StringName of the tag to start the pagination from. Used for keyset pagination
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesTag
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 integerID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
messageStringMessage for the annotated tag. If specified, creates an annotated tag
Example: Release 1.0.0
ref
Required
StringCommit SHA or name of the branch or tag to create the tag from
Example: 2695effb5807a22ff3d138d593fd856244e155e7
tag_name
Required
StringName 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 integerID or URL-encoded path of the project
tag_name
Path, required
StringName 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 integerID or URL-encoded path of the project
tag_name
Path, required
StringName 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 integerID or URL-encoded path of the project
tag_name
Path, required
StringName 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