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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
Responses
| Status | Description | Body |
|---|---|---|
200 | List of cleanup policies | application/json: object |
400 | Invalid request, including a NUL byte in the URL or the body | application/json: Error |
403 | Forbidden | application/json: Error |
404 | Repository or addressed resource not found | application/json: Error |
Fields of the 200 response (application/json):
| Field | Type | Required | Description |
|---|---|---|---|
policies | array of CleanupPolicy | no | - |
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
Request body (required)
application/json: object
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | no | - |
keep_last_n | integer | no | Minimum: 1. |
keep_since_days | integer | no | - |
name | string | yes | - |
name_pattern | string | no | - |
schedule_cron | string | no | - |
Responses
| Status | Description | Body |
|---|---|---|
201 | Cleanup policy created | application/json: CleanupPolicy |
400 | Invalid request | application/json: Error |
403 | Forbidden | application/json: Error |
404 | Repository or addressed resource not found | application/json: Error |
GET /api/v1/repositories/{name}/cleanup-policies/{id}
Get cleanup policy
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
id | path | string | yes | - |
Responses
| Status | Description | Body |
|---|---|---|
200 | Success | - |
default | Error | application/json: Error |
PUT /api/v1/repositories/{name}/cleanup-policies/{id}
Update cleanup policy
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
id | path | string | yes | - |
Request body (required)
application/json: object
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | no | - |
keep_last_n | integer | no | - |
keep_since_days | integer | no | - |
name | string | no | - |
name_pattern | string | no | - |
schedule_cron | string | no | - |
Responses
| Status | Description | Body |
|---|---|---|
200 | Success | - |
default | Error | application/json: Error |
DELETE /api/v1/repositories/{name}/cleanup-policies/{id}
Delete cleanup policy
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
id | path | string | yes | - |
Responses
| Status | Description | Body |
|---|---|---|
204 | No content | - |
default | Error | application/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
id | path | string | yes | - |
Responses
| Status | Description | Body |
|---|---|---|
200 | What a run would remove | application/json: CleanupPreview |
default | Error | application/json: Error |
POST /api/v1/repositories/{name}/cleanup-policies/{id}/run
Run cleanup policy now (501 if no runner, 409 if already running)
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
id | path | string | yes | - |
Responses
| Status | Description | Body |
|---|---|---|
202 | Accepted | - |
default | Error | application/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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | path | string | yes | - |
Request body
application/json: DockerGCRequest
Responses
| Status | Description | Body |
|---|---|---|
200 | GC report | application/json: DockerGCReport |
default | Error | application/json: Error |