Get a Playlist
Each user on the Plex server can create their own playlists. This API command can be used to get the information about one of those playlists for a specified user.
URL
GET http://{ip_address}:32400/playlists/{id}?X-Plex-Token={plex_token}
Parameters
Name | Description |
---|---|
ip_address | The IP address of the Plex Media server. |
plex_token | The Plex user token. |
id | The 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 Code | Description |
---|---|
200 | Success - The request was successful. |
401 | Unauthorized - The Plex token provided was not valid. |
404 | Not Found - The playlist associated with the ID was not found. |
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="1"> <Playlist content="library://x/directory/%2Flibrary%2Fsections%2F2%2Fall%3Ftype%3D1%26originallyAvailableAt%253E%253E%3D315464400%26originallyAvailableAt%253C%253C%3D631170000" 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/1649882407" icon="playlist://image.smart" duration="150764000" leafCount="22" addedAt="1649464327" updatedAt="1649882407"></Playlist> </MediaContainer>
The XML returned provides information about the playlist associated with the specified playlist ID. The root is the MediaContainer
element. This element contains a few attributes that provide overall information about the playlist.
Attribute | Description |
---|---|
size | The number of playlists. |
Within the MediaContainer
there is one Playlist
child element that contains the details about the playlist.
Attribute | Description |
---|---|
content | Address of the playlist. |
ratingKey | A key associated with the playlist. |
key | The relative URL of the items in the playlist. This URL returns information about the items in the playlist. |
guid | The unique identifier comprised of the Plex agent and playlist identifier for the agent. |
type | The type of media. |
title | The title of the playlist. |
summary | A description of the playlist. This can be changed by editing the playlist from within Plex after it has been created. |
smart | 1 - playlist is a smart playlist. 0 - playlist is not a smart playlist. |
playlistType | video - playlist contains videos/movies. audio - playlist contains audio/music. photo - playlist contains photos. |
composite | The URL of the image used to represent the playlist. |
icon | Icon used for smart playlists. Not used for non-smart playlists. |
duration | The total duration, in milliseconds, of the number of items in the playlist. This value doesn't exist for photo playlists. |
leafCount | Number of items in the playlist. |
addedAt | The date and time, in Unix time, the playlist was added to the library. |
updatedAt | The 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 a playlist.
When using a device Plex authentication token, the administrative user playlist 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/{id}?X-Plex-Token={plex_token}
import requests plex_url = http://{ip_address}:32400/playlists/{id}?X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/playlists/{id}?X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response