Skip to content

Cleanup API ​

8 endpoints. Request and response schemas are described on the schemas page; the other tags are listed in the API index.

Endpoints ​

GET /api/v1/repositories/{name}/cleanup-policies ​

List cleanup policies

List cleanup policies for a repository. Requires global admin, or the maintainer or owner role in the repository's project (a caller who cannot read the repository gets 404).

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Responses

StatusDescriptionBody
200List of cleanup policiesapplication/json: object
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Forbiddenapplication/json: Error
404Repository or addressed resource not foundapplication/json: Error

Fields of the 200 response (application/json):

FieldTypeRequiredDescription
policiesarray of CleanupPolicyno-

POST /api/v1/repositories/{name}/cleanup-policies ​

Create cleanup policy

Create a new cleanup policy for a repository. Requires global admin, or the maintainer or owner role in the repository's project (a caller who cannot read the repository gets 404).

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Request body (required)

application/json: object

FieldTypeRequiredDescription
enabledbooleanno-
keep_last_nintegernoMinimum: 1.
keep_since_daysintegerno-
namestringyes-
name_patternstringno-
schedule_cronstringno-

Responses

StatusDescriptionBody
201Cleanup policy createdapplication/json: CleanupPolicy
400Invalid requestapplication/json: Error
403Forbiddenapplication/json: Error
404Repository or addressed resource not foundapplication/json: Error

GET /api/v1/repositories/{name}/cleanup-policies/{id} ​

Get cleanup policy

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstringyes-

Responses

StatusDescriptionBody
200Success-
defaultErrorapplication/json: Error

PUT /api/v1/repositories/{name}/cleanup-policies/{id} ​

Update cleanup policy

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstringyes-

Request body (required)

application/json: object

FieldTypeRequiredDescription
enabledbooleanno-
keep_last_nintegerno-
keep_since_daysintegerno-
namestringno-
name_patternstringno-
schedule_cronstringno-

Responses

StatusDescriptionBody
200Success-
defaultErrorapplication/json: Error

DELETE /api/v1/repositories/{name}/cleanup-policies/{id} ​

Delete cleanup policy

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstringyes-

Responses

StatusDescriptionBody
204No content-
defaultErrorapplication/json: Error

POST /api/v1/repositories/{name}/cleanup-policies/{id}/dry-run ​

Preview what a cleanup policy would remove (admin; nothing is changed)

Evaluates the policy now with every protection a run applies (immutable releases, release bundles, quarantine, dist-tagged npm versions, the newest build of a maven snapshot) and lists the rows a run would remove or move to the trash. Synchronous; the list is capped at 500 rows.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstringyes-

Responses

StatusDescriptionBody
200What a run would removeapplication/json: CleanupPreview
defaultErrorapplication/json: Error

POST /api/v1/repositories/{name}/cleanup-policies/{id}/run ​

Run cleanup policy now (501 if no runner, 409 if already running)

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstringyes-

Responses

StatusDescriptionBody
202Accepted-
defaultErrorapplication/json: Error

POST /api/v1/repositories/{name}/registry-gc ​

Run Docker registry garbage collection now (admin; 409 if already running, 400 if not a docker repository)

Deletes untagged manifests older than the grace period (keeping index children, subjects and referrers of kept manifests) and then the blob records no manifest references any more, freeing their storage once no other repository uses it. Synchronous; the body is optional.

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Request body

application/json: DockerGCRequest

Responses

StatusDescriptionBody
200GC reportapplication/json: DockerGCReport
defaultErrorapplication/json: Error

Free software under the AGPL-3.0-or-later.