Use this API to manage the GitLab container registry: list the registry repositories in a project or a group, retrieve or delete individual repositories and their tags, and receive registry events.

To authenticate with these endpoints from a CI/CD job, pass the $CI_JOB_TOKEN variable as the JOB-TOKEN header. The job token only has access to the container registry of the project that created the pipeline.

Receives notifications from the container registry when an operation occurs

POST /api/v4/container_registry_event/events

This feature was introduced in GitLab 12.10

Responses

CodeDescriptionSchema
200Success—
400Bad Request—
401Invalid Token—

List all registry repositories for a group

GET /api/v4/groups/{id}/registry/repositories

Lists all registry repositories for a specified group.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the group
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 APIEntitiesContainerRegistryRepository
400Bad Request—
401Unauthorized—
404Group Not Found—

List all registry repositories for a project

GET /api/v4/projects/{id}/registry/repositories

Lists all registry repositories for a specified project. Responses are paginated and return 20 results by default.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
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
tags
Query
BooleanIf true, includes an array of tags in the response
Default: false
tags_count
Query
BooleanIf true, includes tags_count in the response
Default: false

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesContainerRegistryRepository
400Bad Request—
401Unauthorized—
404Not Found—

Delete registry repository

DELETE /api/v4/projects/{id}/registry/repositories/{repository_id}

Deletes a specified repository in the registry. This operation is executed asynchronously and might take some time to execute.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
repository_id
Path, required
IntegerID of the container registry repository

Responses

CodeDescriptionSchema
204Success—
400Bad Request—
401Unauthorized—
404Not Found—

List all registry repository tags for a project

GET /api/v4/projects/{id}/registry/repositories/{repository_id}/tags

Lists all tags for a specified registry repository. Responses are paginated and return 20 results by default. Offset pagination is deprecated. Use keyset pagination instead. Keyset pagination requires the container registry metadata database. Otherwise, 405 Method Not Allowed is returned.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
repository_id
Path, required
IntegerID of the container registry repository
order_by
Query
StringField to order tags by. published_at requires keyset pagination. Introduced in GitLab 19.5
Default: name
sort
Query
StringDirection to sort tags in, asc or desc. Default is asc. Only applies to keyset pagination
Default: asc
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 APIEntitiesContainerRegistryTag
400Bad Request—
401Unauthorized—
404Not Found—
405Method Not Allowed—

Delete multiple registry repository tags

DELETE /api/v4/projects/{id}/registry/repositories/{repository_id}/tags

Deletes multiple registry repository tags based on the specified criteria. The request is accepted and the tags are deleted asynchronously in the background. Tags that match name_regex_delete (or the deprecated name_regex) are deleted, except tags that match name_regex_keep, the keep_n most recent matching tags, tags newer than older_than, protected tags, and the tag named latest. You can run this at most once an hour for a given container repository. The number of tags deleted by one request is limited, so if the repository has many tags to delete, you might need to call this endpoint more than once. This operation does not delete blobs. To reclaim disk space, run garbage collection.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
repository_id
Path, required
IntegerID of the container registry repository
name_regex_delete
Query
StringRE2 regular expression of the tag names to delete. Specify .* to delete all tags. At least one of name_regex, name_regex_delete must be provided
name_regex
Query
StringRE2 regular expression of the tag names to delete. Specify .* to delete all tags. Deprecated. Use name_regex_delete instead. At least one of name_regex, name_regex_delete must be provided
name_regex_keep
Query
StringRE2 regular expression of the tag names to keep. Overrides any matches from name_regex_delete. Setting to .* results in a no-op
keep_n
Query
IntegerNumber of most recent tags with a matching name to keep
older_than
Query
StringDelete tags older than this age, such as 1h, 1d, or 1month

Responses

CodeDescriptionSchema
202Success—
400Bad Request—
401Unauthorized—
404Not Found—

Retrieve details of a registry repository tag

GET /api/v4/projects/{id}/registry/repositories/{repository_id}/tags/{tag_name}

Retrieves details of a specified registry repository tag.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
repository_id
Path, required
IntegerID of the container registry repository
tag_name
Path, required
StringName of the tag

Responses

CodeDescriptionSchema
200OKAPIEntitiesContainerRegistryTagDetails
400Bad Request—
401Unauthorized—
404Not Found—

Delete a registry repository tag

DELETE /api/v4/projects/{id}/registry/repositories/{repository_id}/tags/{tag_name}

Deletes a specified container registry repository tag. This operation does not delete blobs. To reclaim disk space, run garbage collection.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
repository_id
Path, required
IntegerID of the container registry repository
tag_name
Path, required
StringName of the tag

Responses

CodeDescriptionSchema
204Success—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Retrieve details of a container registry repository

GET /api/v4/registry/repositories/{id}

Retrieves details of a specified container registry repository.

Parameters

NameTypeDescription
id
Path, required
String or integerID of the repository
tags
Query
BooleanIf true, includes an array of tags in the response
Default: false
tags_count
Query
BooleanIf true, includes tags_count in the response
Default: false
size
Query
BooleanIf true, response includes the deduplicated size of all images in the repository. Only available on GitLab.com for repositories created after 2021-11-04
Default: false

Responses

CodeDescriptionSchema
200OKAPIEntitiesContainerRegistryRepository
400Bad Request—
401Unauthorized—
404Repository Not Found—

Schemas

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

APIEntitiesContainerRegistryRepository

PropertyTypeDescription
cleanup_policy_started_atString (date-time)Example: 2020-08-17T03:12:35.489Z
created_atString (date-time)Example: 2019-01-10T13:39:08.229Z
delete_api_pathStringExample: delete/api/path
idInteger (int64)Example: 1
locationStringExample: gitlab.example.com/group/project/releases
nameStringExample: releases
pathStringExample: group/project/releases
project_idInteger (int64)Example: 9
sizeIntegerExample: 12345
statusStringExample: delete_scheduled
tagsArray of APIEntitiesContainerRegistryTag—
tags_countIntegerExample: 3

APIEntitiesContainerRegistryTag

PropertyTypeDescription
locationStringExample: registry.dev/namespace1/project1/test_image_1:latest
nameStringExample: latest
pathStringExample: namespace1/project1/test_image_1:latest

APIEntitiesContainerRegistryTagDetails

PropertyTypeDescription
created_atString (date-time)Example: 2022-01-10T13:39:08.229Z
digestStringExample: shadigest
locationStringExample: registry.dev/namespace1/project1/test_image_1:latest
nameStringExample: latest
pathStringExample: namespace1/project1/test_image_1:latest
revisionStringExample: tagrevision
short_revisionStringExample: shortrevison
total_sizeIntegerExample: 3