Get All Playlists

A user on the Plex server can create multiple playlists for each type of media. This API will return all the playlists that are associated with the user. This command won't get all playlists available on the Plex server for all users. To do so, you would need to run this command once for each user on the Plex server using their Plex token.

URL

GET http://{ip_address}:32400/playlists?X-Plex-Token={plex_token}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex user token.

Return Status

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

Response

XML string value that lists the all the playlists associated with the user. An example of the XML returned from the request is shown below:

    <?xml version="1.0" encoding="UTF-8"?>
    <MediaContainer size="8">
    <Playlist ratingKey="279065" key="/playlists/279065/items" guid="com.plexapp.agents.none://4aeb2048-d28c-4f72-9bd9-ec8ed697dde0" type="playlist" title="1980's Movies" summary="" smart="1" playlistType="video" composite="/playlists/279065/composite/1649880207" icon="playlist://image.smart" viewCount="1" lastViewedAt="1649464327" duration="150764000" leafCount="22" addedAt="1649464327" updatedAt="1649880207"></Playlist>
    <Playlist ratingKey="279055" key="/playlists/279055/items" guid="com.plexapp.agents.none://63c6563b-9a8c-4a77-8a03-eef1a91662b7" type="playlist" title="1990's Movies" summary="" smart="1" playlistType="video" composite="/playlists/279055/composite/1649449919" icon="playlist://image.smart" viewCount="1" lastViewedAt="1649449844" duration="300463000" leafCount="38" addedAt="1649449844" updatedAt="1649449919"></Playlist>
    <Playlist ratingKey="279056" key="/playlists/279056/items" guid="com.plexapp.agents.none://6a57094c-855e-4eb5-8ba6-46209cd939f8" type="playlist" title="2000's Movies" summary="" smart="1" playlistType="video" composite="/playlists/279056/composite/1649449929" icon="playlist://image.smart" viewCount="1" lastViewedAt="1649449883" duration="466917000" leafCount="61" addedAt="1649449883" updatedAt="1649449929"></Playlist>
    <Playlist ratingKey="279057" key="/playlists/279057/items" guid="com.plexapp.agents.none://cdad72bd-8d05-4436-9d92-72f74f844671" type="playlist" title="2010's Movies" summary="" smart="1" playlistType="video" composite="/playlists/279057/composite/1649449944" icon="playlist://image.smart" viewCount="1" lastViewedAt="1649449912" duration="459953000" leafCount="62" addedAt="1649449912" updatedAt="1649449944"></Playlist>
    <Playlist ratingKey="275025" key="/playlists/275025/items" guid="com.plexapp.agents.none://1fb7c34f-dd93-42cb-9073-f24433cf6baa" type="playlist" title="All Music" summary="The easiest way to play or shuffle your entire collection." smart="1" playlistType="audio" composite="/playlists/275025/composite/1647266136" icon="playlist://image.smart" viewCount="4" lastViewedAt="1649641458" duration="268843000" leafCount="1096" addedAt="1614960582" updatedAt="1647266136"></Playlist>
    <Playlist ratingKey="275028" key="/playlists/275028/items" guid="com.plexapp.agents.none://a93ad046-919e-4e28-a55c-5b0b43865857" type="playlist" title="Recently Added" summary="Music added to your library recently." smart="1" playlistType="audio" icon="playlist://image.smart" viewCount="1" lastViewedAt="1614960582" leafCount="0" addedAt="1614960582" updatedAt="1614960582"></Playlist>
    <Playlist ratingKey="275027" key="/playlists/275027/items" guid="com.plexapp.agents.none://1ee47b0f-2814-4546-89d6-b933e2743494" type="playlist" title="Recently Played" summary="Tracks you've listened to lately." smart="1" playlistType="audio" icon="playlist://image.smart" viewCount="2" lastViewedAt="1620000297" leafCount="0" addedAt="1614960582" updatedAt="1638416576"></Playlist>
    <Playlist ratingKey="134729" key="/playlists/134729/items" guid="com.plexapp.agents.none://b2ae33af-8bfd-42ef-b504-513f52f4da99" type="playlist" title="Christmas" summary="" smart="0" playlistType="audio" composite="/playlists/134729/composite/1634676389" viewCount="3" lastViewedAt="1478569654" duration="11294000" leafCount="68" addedAt="1477075480" updatedAt="1634676389"></Playlist>
</MediaContainer>

The XML returned provides a list of the playlists that are available on the Plex server for a user. The root is the MediaContainer element. This element contains a few attributes that provide overall information about the playlists for the user on the server.

MediaContainer Attributes
AttributeDescription
sizeThe number of playlists available on the Plex server for the user.

Within the MediaContainer there are one or more Playlist child elements. Each Playlist element represents one playlist on the Plex server.

Playlist Attributes
AttributeDescription
ratingKeyA key associated with the playlist.
keyThe relative URL of the items in the playlist. This URL returns information about the items in the playlist.
guidThe unique identifier comprised of the Plex agent and playlist identifier for the agent.
typeThe type of media.
titleThe title of the playlist.
summaryA description of the playlist. This can be changed by editing the playlist from within Plex after it has been created.
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.
compositeThe URL of the image used to represent the playlist.
iconIcon used for smart playlists. Not used for non-smart playlists.
viewCountThe number of times the playlist has been viewed.
lastViewedAtThe date and time for the last time the playlist was viewed.
durationThe total duration, in milliseconds, of the number of items in the playlist. This value doesn't exist for photo playlists.
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.

Remarks

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

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 GET http://{ip_address}:32400/playlists?X-Plex-Token={plex_token}
import requests
plex_url = http://{ip_address}:32400/playlists?X-Plex-Token={plex_token}
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/playlists?X-Plex-Token={plex_token}' -Method 'GET'
Write-Output $response
Subscribe
Display