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/[Library ID]/?async=[Async]X-Plex-Token=[PlexToken]

Parameters

NameDescription
IP addressThe IP address of the Plex Media server.
PlexTokenThe authentication Plex token.
Library 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/[Library ID]/?async=[Async]X-Plex-Token=[PlexToken]
import requests
plex_url = http://[IP address]:32400/library/sections/[Library ID]/?async=[Async]X-Plex-Token=[PlexToken]
response = requests.delete(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://[IP address]:32400/library/sections/[Library ID]/?async=[Async]X-Plex-Token=[PlexToken]' -Method 'DELETE'
Write-Output $response
Subscribe
Display