Scan or execute cleanup of stale configs
const url = 'https://example.com/api/v1/arr/cleanup';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"instanceId":1,"includeUnmanaged":true,"action":"scan"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/arr/cleanup \ --header 'Content-Type: application/json' \ --data '{ "instanceId": 1, "includeUnmanaged": true, "action": "scan" }'Detects and deletes stale namespace-suffixed custom formats and quality profiles from an Arr instance that are no longer in the current sync selections.
Two actions are supported via the action field in the request body:
scan: Scans for stale items and returns what would be deleted.execute: Re-scans server-side and deletes only the requested items whoseidandnameboth match a currently stale item of the same kind. Requested items that are no longer stale are not deleted; they are reported with reasonNo longer stale; not deleted(custom formats infailedCustomFormats, quality profiles inskippedQualityProfiles).
Namespaces whose expected contents cannot currently be determined (missing PCD cache, or a selected TRaSH source with no cached data or a transform failure) are kept, never reported stale.
Quality profiles assigned to media will be skipped with a warning (Arr returns HTTP 500 “in use”).
Request Bodyrequired
Section titled “Request Bodyrequired”object
Arr instance ID
Include entities outside the ownership ledger. Defaults to false (managed entities only).
object
Arr instance ID
Include entities outside the ownership ledger. Defaults to false (managed entities only).
object
Custom formats that are no longer in sync selections
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Quality profiles that are no longer in sync selections
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Responses
Section titled “Responses”Scan or delete result
object
Custom formats that are no longer in sync selections
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Quality profiles that are no longer in sync selections
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
object
Custom formats that were successfully deleted
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Quality profiles that were successfully deleted
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Quality profiles that were not deleted: assigned to media, no longer stale at execute time, or the delete failed
object
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Closed user-safe reason the item was not deleted (e.g. “Profile is assigned to media”, “No longer stale; not deleted”, “The Arr instance rejected the request (HTTP 400).”, “The delete failed unexpectedly.”); the raw Arr error is logged server-side only
Custom formats that were not deleted (no longer stale at execute time, or the delete failed)
object
object
Arr entity ID
Full name including namespace suffix
Name with namespace suffix removed
Closed user-safe reason the item was not deleted (e.g. “Profile is assigned to media”, “No longer stale; not deleted”, “The Arr instance rejected the request (HTTP 400).”, “The delete failed unexpectedly.”); the raw Arr error is logged server-side only
Examplegenerated
{ "staleCustomFormats": [ { "id": 1, "name": "example", "strippedName": "example" } ], "staleQualityProfiles": [ { "id": 1, "name": "example", "strippedName": "example" } ]}Invalid request (malformed JSON or non-object body, missing instanceId, invalid action, or missing/malformed scanResult for execute)
object
Error message
Stable machine-readable code present on 5xx responses; error is a fixed user-safe message, raw detail is logged server-side only
Example
{ "code": "cleanup_failed"}Instance not found
object
Error message
Stable machine-readable code present on 5xx responses; error is a fixed user-safe message, raw detail is logged server-side only
Example
{ "code": "cleanup_failed"}Failed to perform cleanup (fixed message with code cleanup_failed; raw error logged server-side)
object
Error message
Stable machine-readable code present on 5xx responses; error is a fixed user-safe message, raw detail is logged server-side only
Example
{ "code": "cleanup_failed"}