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
| Code | Description | Schema |
|---|---|---|
200 | Success | — |
400 | Bad Request | — |
401 | Invalid Token | — |
List all registry repositories for a group
GET /api/v4/groups/{id}/registry/repositories
Lists all registry repositories for a specified group.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Group 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
tagsQuery | Boolean | If true,tags in the responseDefault: false |
tags_Query | Boolean | If true,tags_ in the responseDefault: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
repository_Path, | Integer | ID of the container registry repository |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Success | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
repository_Path, | Integer | ID of the container registry repository |
order_Query | String | Field to order tags by.published_ requires keyset pagination.Default: name |
sortQuery | String | Direction to sort tags in,asc or desc.asc.Default: asc |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not Found | — |
405 | Method 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
repository_Path, | Integer | ID of the container registry repository |
name_Query | String | RE2 regular expression of the tag names to delete.. to delete all tags.name_,name_ must be provided |
name_Query | String | RE2 regular expression of the tag names to delete.. to delete all tags.name_ instead.name_,name_ must be provided |
name_Query | String | RE2 regular expression of the tag names to keep.name_.. results in a no- |
keep_Query | Integer | Number of most recent tags with a matching name to keep |
older_Query | String | Delete tags older than this age,1h,1d,1month |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Success | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
repository_Path, | Integer | ID of the container registry repository |
tag_Path, | String | Name of the tag |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
repository_Path, | Integer | ID of the container registry repository |
tag_Path, | String | Name of the tag |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Success | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Retrieve details of a container registry repository
GET /api/v4/registry/repositories/{id}
Retrieves details of a specified container registry repository.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID of the repository |
tagsQuery | Boolean | If true,tags in the responseDefault: false |
tags_Query | Boolean | If true,tags_ in the responseDefault: false |
sizeQuery | Boolean | If true,2021-Default: false |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Repository Not Found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesContainerRegistryRepository
| Property | Type | Description |
|---|---|---|
cleanup_ | String (date- | Example:2020- |
created_ | String (date- | Example:2019- |
delete_ | String | Example:delete/ |
id | Integer (int64) | Example:1 |
location | String | Example:gitlab. |
name | String | Example:releases |
path | String | Example:group/ |
project_ | Integer (int64) | Example:9 |
size | Integer | Example:12345 |
status | String | Example:delete_ |
tags | Array of APIEntities | — |
tags_ | Integer | Example:3 |
APIEntitiesContainerRegistryTag
| Property | Type | Description |
|---|---|---|
location | String | Example:registry. |
name | String | Example:latest |
path | String | Example:namespace1/ |
APIEntitiesContainerRegistryTagDetails
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2022- |
digest | String | Example:shadigest |
location | String | Example:registry. |
name | String | Example:latest |
path | String | Example:namespace1/ |
revision | String | Example:tagrevision |
short_ | String | Example:shortrevison |
total_ | Integer | Example:3 |