Manually Run Cleanup Policy API

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: This REST API is called to manually run a package cleanup policy. For information on how to manually run a cleanup policy from the UI, see Manually Run a Cleanup Policy.Manually Run a Cleanup Policy

Security: Requires a platform admin. A project admin with permission can manually run a policy on the project level.

Produces: application/json

Usage: PUT /artifactory/api/cleanup/packages/policies/{policyKey}/run?dryRun=<Boolean>

Query Parameters:

Field

Type

Description

policyKey

string

ID of the policy you want to run. This ID was configured when creating the policy. You can find the policy ID by running the Get all Cleanup Policies API, searching through the results for the appropriate description, then its corresponding ID.

dryRun

boolean

Optional, default is FALSE. Dry runs are used to run a policy without actual cleanup. It produces a report used to determine which packages will be removed if an actual run will be performed.

Sample Query:

PUT /artifactory/api/cleanup/packages/policies/sample-policy/run

Sample Response:

201 Created
Content-Type: application/json
{
  "runId": 1 // Integer
}

The response includes the following information:

Property

Description

runId

An ID that identifies the run. This ID is used by the Stop a Running Cleanup Policy API if you want to stop running a cleanup policy that was executed.

Response Error Codes

Code

Description

400

This code indicates one of the following errors:

  • The policyKey was not provided.

  • The policy is set to clean to the Trash Can, but the Trash Can is disabled.

  • The policy is disabled.

404

The policy with the key <policyKey> was not found.