Clean Bundles

When a media item is removed from Plex, the bundle associated with the item will still exist on the server's drive. To remove the bundle files, the clean bundles API command can be run. This command is the same one that is run from the Clean Bundles option in Plex.

URL

PUT http://[IP address]:32400/library/clean/bundles?async=[Async]&X-Plex-Token=[PlexToken]

Parameters

NameDescription
IP addressThe IP address of the Plex Media server.
PlexTokenThe temporary authentication Plex token.
AsyncA flag indicating if the API command will be run async. 1 for async, otherwise 0.

Return Status

HTTP CodeDescription
200Success - The request was successful.
401Unauthorized - The Plex token provided was not valid.

Response

No response is returned. You will be able to see the clean bundles API command run from the Plex console.

Remarks

When the async parameter is set to 1, the status code will be returned immediately, but the command will still be running on the server. By setting the async parameter to 0, the status won't be returned until the command has completed running on the server.

There is also a clean old bundles scheduled task that will do the same thing as this API on a regular basis. You can run the clean old bundles task API command to run it as needed.

Examples

curl -X PUT http://[IP address]:32400/library/clean/bundles?async=[Async]&X-Plex-Token=[PlexToken]
import requests
plex_url = http://[IP address]:32400/library/clean/bundles?async=[Async]&X-Plex-Token=[PlexToken]
response = requests.put(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://[IP address]:32400/library/clean/bundles?async=[Async]&X-Plex-Token=[PlexToken]' -Method 'PUT'
Write-Output $response
Subscribe
Display