Delete a Library

A Plex server can have many different libraries setup for various media. You may find that you need to delete one of the libraries. This API command will delete a library from the Plex server.

URL

DELETE http://{ip_address}:32400/library/sections/{id}/?async={async}X-Plex-Token={plex_token}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.
idThe ID associated with the library to be deleted. This value can be found by calling the Get Libraries API command and using the value from the key attribute for the library.
asyncA flag indicating if the API command will be run asynchronously. 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.

Examples

curl -X DELETE http://{ip_address}:32400/library/sections/{id}/?async={async}X-Plex-Token={plex_token}
import requests
plex_url = http://{ip_address}:32400/library/sections/{id}/?async={async}X-Plex-Token={plex_token}
response = requests.delete(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/library/sections/{id}/?async={async}X-Plex-Token={plex_token}' -Method 'DELETE'
Write-Output $response
Subscribe
Display