Delete All Items from a Playlist

Each playlist that is created on a Plex server contains different media files. Each playlist can contain only one type of file, but can contain hundreds of the same media type.

This API command will delete all items from a playlist.

URL

DELETE http://{ip_address}:32400/playlists/{id}/items?X-Plex-Token={plex_token}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex user token.
idThe key associated with a playlist. This key can be found by calling the view playlists for a user API command and getting the value in the ratingsKey attribute.

Return Status

HTTP CodeDescription
200Success - The request was successful.
401Unauthorized - The Plex token provided was not valid.
404Not Found - The playlist associated with the ID was not found.

Response

XML string value that lists the all the items in a playlist. The XML return is dependent on the type of media that is contained in the playlist.

For movie playlists, an example XML returned is:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1">
    <Playlist ratingKey="892" key="/playlists/892/items" guid="com.plexapp.agents.none://80f382aa-89eb-4a3d-bf9d-54dff7912b4b" type="playlist" title="1990s Movie" titleSort="1990s Movies" summary="Movies from the 1990s" smart="0" playlistType="video" thumb="/library/metadata/892/thumb/1710508894" art="/library/metadata/892/art/1710508894" leafCount="0" addedAt="1710506337" updatedAt="1710508894">
        <Field locked="1" name="thumb" />
        <Field locked="1" name="art" />
    </Playlist>
</MediaContainer>

The XML returned provides information about the items associated with the specified playlist ID. The root is the MediaContainer element. This element contains an attribute that indicates the number of playlists returned - in this case it would be one.

MediaContainer Attributes
AttributeDescription
sizeThe number of playlists returned from the request.

Playlist

Within the MediaContainer there is one Playlist child element that contains the details about the playlist.

Playlist Attributes
AttributeDescription
ratingKeyA key associated with the playlist.
keyThe relative URL of the playlist information.
guidThe unique identifier comprised of the Plex agent and playlist identifier for the agent.
typeThe type of media.
titleThe title of the playlist.
titleSortThe title of the playlist used to sort the playlists in a collection or list.
summaryA summary of the playlist.
smart1 - playlist is a smart playlist.
0 - playlist is not a smart playlist.
playlistTypevideo - playlist contains videos/movies.
audio - playlist contains audio/music.
photo - playlist contains photos.
thumbThe thumbnail for the playlist.
artThe background artwork used to represent the playlist.
leafCountNumber of items in the playlist.
addedAtThe date and time, in Unix time, the playlist was added to the library.
updatedAtThe date and time in epoch time, the playlist was updated in the library.

Field

Within the Playlist there are one or more Field child elements. Each Field element represents one field associated with the playlist.

Field Attributes
AttributeDescription
lockedThe field is locked.
nameThe name of the field.

Remarks

A playlist is specific to a user on the Plex server. Only that user can request information about a playlist.

When using a device Plex authentication token, the administrative user playlists will be returned by the Plex server. This means that the administrator's Plex token and any device token will return the same XML response.

Examples

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