Send a POST request to https://<NEXUS_URL>/service/rest/v1/cleanup-policies with a JSON body containing name, format (maven2), and the criteriaLastDownloaded field set to 60 (days)
Authenticate with an account that holds the nexus:settings:read and nexus:settings:update permissions; use HTTP Basic Auth or a user token
Associate the cleanup policy with one or more hosted repositories by PATCHing the repository configuration at /service/rest/v1/repositories/maven/hosted/<repoName> and adding the cleanup policy name to the cleanup.policyNames array
Trigger the cleanup task manually via POST to /service/rest/v1/tasks/<taskId>/run where the task type is repository.cleanup, or let the scheduled task run on its configured interval
Review the Cleanup Performance Data page in the Nexus UI or query /service/rest/v1/cleanup-policies/<policyName> to confirm artifact counts targeted
Known gotchas
The cleanup policies REST API endpoint (/service/rest/v1/cleanup-policies) is available in Nexus Repository Pro; the OSS edition may expose a limited subset or require direct database/script approaches
criteriaLastDownloaded counts days since last download for hosted repos but counts days since first upload for proxy repos — this asymmetry is a common source of misconfiguration
Running the cleanup task removes component metadata but does not immediately reclaim disk space; a separate 'Compact blob store' task must be run afterward to free storage
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp