---
updatedAt: 2026-04-03T15:44:50.000Z
agentTools:
  siteIndex: https://docs.jfrog.com/llms.txt
  projectIndex: https://docs.jfrog.com/administration/llms.txt
---

# Update a Package-Level Cleanup Policy

This REST API is called to update configuration settings for an existing package-level cleanup policy. A policy cannot be updated if it is currently running.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "JFrog Artifactory Cleanup Policies API",
    "description": "REST API for managing cleanup policies in JFrog Artifactory. This includes cleanup policies for Packages, Release Bundles V2, and Builds.",
    "version": "1.0.0",
    "contact": {
      "name": "JFrog Support"
    }
  },
  "servers": [
    {
      "url": "https://{jfrog_url}/artifactory/api/cleanup",
      "description": "Cleanup Policies API base path"
    }
  ],
  "tags": [
    {
      "name": "Package Cleanup Policies",
      "description": "Package cleanup policy management operations"
    }
  ],
  "security": [
    {
      "BasicAuth": []
    },
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/packages/policies/{policyKey}": {
      "put": {
        "tags": [
          "Package Cleanup Policies"
        ],
        "summary": "Update a Package-Level Cleanup Policy",
        "description": "This REST API is called to update configuration settings for an existing package-level cleanup policy. A policy cannot be updated if it is currently running.",
        "operationId": "updatePackageCleanupPolicy",
        "parameters": [
          {
            "name": "policyKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The ID that identifies the policy."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PackageCleanupPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PackageCleanupPolicyResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestResponse"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BasicAuth": {
        "type": "http",
        "scheme": "basic"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-JFrog-Art-Api"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "responses": {
      "BadRequestResponse": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal Server Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PackageCleanupPolicyRequest": {
        "type": "object",
        "required": [
          "key",
          "searchCriteria"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "An ID that is used to identify the cleanup policy. A minimum of three characters is required and can include letters, numbers, underscore and hyphen."
          },
          "description": {
            "type": "string",
            "maxLength": 256,
            "description": "A description of the policy."
          },
          "cronExp": {
            "type": "string",
            "description": "The cron expression that determines when the policy is run. This parameter is not mandatory, however if left empty the policy will not run automatically and can only be triggered manually."
          },
          "projectKey": {
            "type": "string",
            "description": "This key is obtained from the Project Settings screen. This parameter is used only for project-level cleanup policies, it is not used for global-level policies."
          },
          "itemType": {
            "type": "string",
            "description": "The type of item (package)."
          },
          "durationInMinutes": {
            "type": "integer",
            "description": "The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed."
          },
          "enabled": {
            "type": "boolean",
            "description": "A cleanup policy must be created inactive. This parameter is optional, but if used it must be set to FALSE. If set to TRUE when calling this API, the API call will fail and an error message is received."
          },
          "skipTrashcan": {
            "type": "boolean",
            "description": "A true value means that when this policy is executed, packages will be permanently deleted. false means that when the policy is executed packages will be deleted to the Trash Can."
          },
          "searchCriteria": {
            "$ref": "#/components/schemas/PackageCleanupSearchCriteria"
          }
        }
      },
      "PackageCleanupSearchCriteria": {
        "type": "object",
        "required": [
          "packageTypes",
          "repos",
          "includedPackages"
        ],
        "properties": {
          "packageTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The package types that are cleaned up by the policy. You must enter at least one package type."
          },
          "repos": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify one or more patterns for the repository name(s) on which you want the cleanup policy to run. You can also specify explicit repository names. Specifying at least one pattern or explicit name is mandatory."
          },
          "excludedRepos": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify patterns for repository names or explicit repository names that you want excluded from the cleanup policy."
          },
          "includedPackages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify a pattern for a package name or an explicit package name on which you want the cleanup policy to run. To include all packages, use \"**\"."
          },
          "excludedPackages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify explicit package names that you want excluded from the policy. Only explicit names (and not patterns) are accepted."
          },
          "includeAllProjects": {
            "type": "boolean",
            "description": "Set this value to true if you want the policy to run on all Artifactory projects. The default value is false. This parameter is relevant only on the global level, for Platform Admins."
          },
          "includedProjects": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Enter the project keys for the projects on which you want the policy to run. To include repositories that are not assigned to any project, enter the project key default."
          },
          "includeAllStages": {
            "type": "boolean",
            "description": "Set this value to true if you want the policy to run on all stages/environments. When true, includedStages should be empty."
          },
          "includedStages": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of specific stages/environments to include in the policy. When includeAllStages is false, at least one stage must be specified."
          },
          "createdBeforeInMonths": {
            "type": "integer",
            "minimum": 0,
            "description": "The cleanup policy will delete packages based on how long ago they were created. Before Version 7.111 Use this param if you are using versions below 7.111."
          },
          "createdBeforeInDays": {
            "type": "integer",
            "minimum": 0,
            "description": "The cleanup policy will delete packages based on how long ago they were created. From Version 7.111 Onwards. A day in this context is a 24-hour period from the moment the policy is executed."
          },
          "lastDownloadedBeforeInMonths": {
            "type": "integer",
            "minimum": 0,
            "description": "The cleanup policy will delete packages based on how long ago they were downloaded. Before Version 7.111."
          },
          "lastDownloadedBeforeInDays": {
            "type": "integer",
            "minimum": 0,
            "description": "The cleanup policy will delete packages based on how long ago they were downloaded. From Version 7.111 Onwards."
          },
          "keepLastNVersions": {
            "type": "integer",
            "minimum": 0,
            "description": "Set a value for the number of latest versions to keep. The cleanup policy will remove all versions prior to the number you select here. The latest version is always excluded."
          },
          "includedProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "A key-value pair applied to the lead artifact of a package. Packages with this property will be deleted."
          },
          "excludedProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "A key-value pair applied to the lead artifact of a package. Packages with this property will be excluded from deletion."
          },
          "includedPackageVersions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify package version to include explicitly or use wildcards. Available from V 7.127 (Cloud) and V 7.125.7 (Self-managed)."
          },
          "excludedPackageVersions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Specify explicit package versions that you want excluded from the policy. Supports patterns such as 1.*, *.1."
          }
        }
      },
      "PackageCleanupPolicyResponse": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The ID that identifies the policy."
          },
          "description": {
            "type": "string",
            "description": "Description that was defined for the policy."
          },
          "cronExp": {
            "type": "string",
            "description": "The cron expression that determines when the policy is run."
          },
          "projectKey": {
            "type": "string",
            "description": "The project key if this is a project-level policy."
          },
          "itemType": {
            "type": "string",
            "description": "The type of item (package)."
          },
          "durationInMinutes": {
            "type": "integer",
            "description": "The maximum duration (in minutes) for policy execution."
          },
          "enabled": {
            "type": "boolean",
            "description": "Indicates if the cleanup policy is active (true) or disabled (false)."
          },
          "skipTrashcan": {
            "type": "boolean",
            "description": "Indicates if packages are permanently deleted or sent to Trash Can."
          },
          "searchCriteria": {
            "$ref": "#/components/schemas/PackageCleanupSearchCriteria"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": false
  }
}
```