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 integerThe ID or URL-encoded path of the group accessible by the authenticated user
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesContainerRegistryRepository
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 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
tags
Query
BooleanDetermines if tags should be included
Default: false
tags_count
Query
BooleanDetermines if the tags count should be included
Default: false

Responses

CodeDescriptionSchema
200OKAPIEntitiesContainerRegistryRepository
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 integerThe ID or URL-encoded path of the project
repository_id
Path, required
IntegerThe ID of the 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.

Parameters

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

Responses

CodeDescriptionSchema
200OKAPIEntitiesContainerRegistryTag
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.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
repository_id
Path, required
IntegerThe ID of the repository
name_regex_delete
Query
StringThe tag name regexp to delete, specify .* to delete all
name_regex
Query
StringThe tag name regexp to delete, specify .* to delete all
name_regex_keep
Query
StringThe tag name regexp to retain
keep_n
Query
IntegerKeep n of latest tags with matching name
older_than
Query
StringDelete older than: 1h, 1d, 1month

Responses

CodeDescriptionSchema
204Success—
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 integerThe ID or URL-encoded path of the project
repository_id
Path, required
IntegerThe ID of the repository
tag_name
Path, required
StringThe name 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.

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
repository_id
Path, required
IntegerThe ID of the repository
tag_name
Path, required
StringThe name 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 integerThe ID of the repository
tags
Query
BooleanDetermines if tags should be included
Default: false
tags_count
Query
BooleanDetermines if the tags count should be included
Default: false
size
Query
BooleanDetermines if the size should be included
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
tagsAPIEntitiesContainerRegistryTag—
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