Get All Videos

A library, such as movies or TV shows, can contain many items. This API command will return all other videos for a specific library that is available on the Plex server. These videos can be media files that aren't standard movies, such as home videos.

URL

GET http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token}&{filter}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.
idThe key associated with a videos library. This key can be found by calling the Libraries API command and looking for a videos library.
filter(Optional) The filter to apply to the response.

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 videos in the library. An example of the XML returned from the request is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="443" allowSync="1" art="/:/resources/movie-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="7" librarySectionTitle="Home Videos" librarySectionUUID="1704f844-5d35-474d-84d2-3f398c4a1684" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1641342384" sortAsc="1" thumb="/:/resources/video.png" title1="Home Videos" title2="All Home Videos" viewGroup="movie" viewMode="131624">
    <Video ratingKey="77963" key="/library/metadata/77963" guid="com.plexapp.agents.none://a186aa7249d7043eeb16e5b45ffbf2601d0590c0?lang=xn" type="movie" title="00000" contentRating="G" subtype="clip" summary="" viewCount="1" lastViewedAt="1640720544" year="2010" thumb="/library/metadata/77963/thumb/1597469053" art="/library/metadata/77963/art/1597469053" duration="32032" originallyAvailableAt="2010-12-12" addedAt="1450725246" updatedAt="1597469053" createdAtAccuracy="epoch" createdAtTZOffset="-14400">
        <Media id="86785" duration="32032" bitrate="23866" width="1920" height="1080" aspectRatio="1.78" audioChannels="2" audioCodec="ac3" videoCodec="h264" videoResolution="1080" container="mpegts" videoFrameRate="NTSC" videoProfile="high" title="Original">
            <Part id="86918" key="/library/parts/86918/1292187170/file.MTS" duration="32032" file="I:\Videos\2010\Christmas Tree\00000.MTS" size="95557632" container="mpegts" packetLength="192" timeStamp="1" videoProfile="high" />
        </Media>
        <Media id="277883" duration="32032" bitrate="3543" width="1280" height="720" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="720" container="mp4" videoFrameRate="NTSC" optimizedForStreaming="1" proxyType="42" audioProfile="lc" has64bitOffsets="0" target="Optimized for Mobile" targetTagID="6207" videoProfile="high" title="Optimized for Mobile">
            <Part id="278213" key="/library/parts/278213/1597255970/file.mp4" duration="32032" file="I:\Videos\2010\Christmas Tree\Plex Versions\Optimized for Mobile\00000 (2010).mp4" size="14223890" audioProfile="lc" container="mp4" has64bitOffsets="0" optimizedForStreaming="1" videoProfile="high" />
        </Media>
    </Video>
    ...
</MediaContainer>

The XML returned provides a list of the all videos in a library that are available on the Plex server. The root is the MediaContainer element. This element contains a few attributes that provide overall information about the videos on the server.

MediaContainer Attributes
AttributeDescription
sizeThe number of videos.
allowSync1 - allow syncing content.
0 - don't allow syncing content.
artBackground artwork used to represent the video.
identifierThe type of item.
librarySectionIDThe unique key associated with the library.
librarySectionTitleThe title of the library.
librarySectionUUIDUnique GUID identifier for the library.
mediaTagPrefixPrefix for the media tag.
mediaTagVersionMedia tag version.
Note: This could be a date and time value.
sortAsc1 - the library is sorted in ascending order.
0 - the library is sorted in descending order.
thumbThe thumbnail for the video.
title1The title of the video.
Note: This appears to be internally created, and can't be changed by the server owner.
title2A descriptive title for the video.
viewGroupThe group type used to view the video.
viewModeUnknown integer value.

Within the MediaContainer there are one or more Video child elements. Each Video element represents one video available on the Plex server.

Video Attributes
AttributeDescription
ratingKeyA key associated with the video.
keyThe relative URL of the video information.
guidThe unique identifier comprised of the Plex agent and video identifier for the agent.
typeThe type of media.
titleThe title of the video.
contentRatingThe content rating associated with the video.
subtypeThe subtype of the video.
summaryA summary of the video.
viewCountThe number of times the video has been viewed.
lastViewedAtThe date and time for the last time the video was viewed.
yearThe year the video was released.
thumbThe thumbnail for the video.
artThe background artwork used to represent the video.
durationThe length of the video in milliseconds.
originallyAvailableAtThe original release date of the video.
addedAtThe date and time, in Unix time, the video was added to the library.
updatedAtThe date and time in epoch time, the video was updated in the library.
createdAtAccuracyThe accuracy of the created date.
createdAtTZOffsetThe time zone offset to GMT in seconds.

Within the Video there are one or more Media child elements. Each Media element represents one media file of the video available on the Plex server.

If there are two video files associated with the video, such as a 1080p and 480p version, then there would be two Media child elements in the Video element.

Media Attributes
AttributeDescription
idUnique ID associated with the video.
durationThe length of the video in milliseconds.
bitrateThe bitrate of the video.
widthThe width of the video.
heightThe height of the video.
aspectRatioThe aspect ratio of the video.
audioChannelsThe number of audio channels.
audioCodecThe audio codec used to encode the audio.
videoCodecThe video codec used to encode the video.
videoResolutionThe video resolution.
containerThe video container.
videoFrameRateThe framerate standard used for the video.
videoProfileThe video profile of the media.
titleThe title of the video.

Within the Media there are one or more Part child elements. Each Part element represents one part of the video. If the video has been added to the Plex server as a multi-part video, then each of those parts will be represented by one Part child element.

Part Attributes
AttributeDescription
keyThe unique relative path for the part that is used at its key.
durationThe length of the part in milliseconds.
fileThe file associated with the part.
sizeThe file size of the part.
containerThe type of media container.
packetLengthThe packet length.
timeStamp1 - the video contains a timestamp.
0 - the video doesn't contain a timestamp.
videoProfileThe video profile associated with the video part.

Remarks

To reduce the number of items returned, you can filter the API response to only return items that meet a specific criteria.

For more information, check out the Filter page.

Examples

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