Get All TV Shows

A library, such as movies or TV shows, can contain many items. This API command will return all TV shows for a specific library that is available on the Plex server.


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


ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.
idThe key associated with a TV shows library. This key can be found by calling the Libraries API command and looking for a TV shows library.
filterThe filter to apply to the response.

Return Status

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


XML string value that lists the all the TV shows in the library. An example of the XML returned from the request is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="11" allowSync="1" art="/:/resources/show-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="4" librarySectionTitle="TV Shows" librarySectionUUID="3bbbe6f7-628f-4983-ae5d-7c05779c4c28" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1641342384" nocache="1" thumb="/:/resources/show.png" title1="TV Shows" title2="All Shows" viewGroup="show" viewMode="65592">
    <Directory ratingKey="1161" key="/library/metadata/1161/children" guid="com.plexapp.agents.thetvdb://74205?lang=en" studio="HBO" type="show" title="Band of Brothers" contentRating="TV-MA" summary="The miniseries follows Easy Company, an army unit during World War II, from their initial training at Camp Toccoa to the conclusion of the war. The series is based on the book written by the late Stephen E. Ambrose. Band of Brothers is executive produced by Steven Spielberg and Tom Hanks, the series won 6 Emmy Awards. " index="1" rating="9.5" viewCount="14" lastViewedAt="1468515134" year="2001" thumb="/library/metadata/1161/thumb/1487294876" art="/library/metadata/1161/art/1487294876" banner="/library/metadata/1161/banner/1487294876" theme="/library/metadata/1161/theme/1487294876" duration="3600000" originallyAvailableAt="2001-09-09" leafCount="10" viewedLeafCount="10" childCount="1" addedAt="1420683142" updatedAt="1487294876">
        <Genre tag="Action" />
        <Genre tag="Adventure" />
        <Role tag="Ron Livingston" />
        <Role tag="Damian Lewis" />
        <Role tag="Matthew Settle" />

The XML returned provides a list of the all TV shows 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 TV shows on the server.

MediaContainer Attributes
sizeThe number of TV shows.
allowSync1 - allow syncing content.
0 - don't allow syncing content.
artBackground artwork used to represent the TV show.
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.
nocache1 - cache the library.
0 - do not cache the library.
thumbThe thumbnail for the TV show.
title1The title of the TV show.
Note: This appears to be internally created, and can't be changed by the server owner.
title2A descriptive title for the TV show.
viewGroupThe group type used to view the TV show.
viewModeUnknown integer value.

Within the MediaContainer there are one or more Directory child elements. Each Directory element represents one TV show series available on the Plex server.

Directory Attributes
ratingKeyA key associated with the TV show.
keyThe relative URL of the information for the TV show.
guidThe unique identifier for the TV show.
studioThe name of the studio that created the TV show.
titleThe name of the TV show.
contentRatingThe content rating associated with the TV show.
summaryInformation about the TV show.
ratingThe rating for the TV show.
viewCountThe number of times the TV show was viewed.
lastViewedAtThe date and time the TV show was last viewed.
yearThe year the TV show was released.
thumbThe thumbnail for the TV show.
artThe background artwork used to represent the TV show.
bannerThe banner artwork use to represent the TV show.
themeThe musical theme for the TV show.
durationThe length of the in milliseconds..
originallyAvailableAtThe original release date of the TV show.
leafCountThe number of items in the TV show.
viewedLeafCountThe number of the TV show items that have been viewed.
childCountThe number of child items.
addedAtThe date and time the TV show was added to the library.
updatedAtThe date and time the TV show was updated in the library.

Also within the Directory element there are multiple additional child elements that provide more details about the TV show. These child elements include Genre and Role.

Within each of these child elements is a single tag attribute that provides the information for the element. There could be multiple of the same child element within the Directory, as each TV show can be in multiple genres and list multiple actors.

Genre Attributes
tagA genre of the TV show.
Role Attributes
tagThe name of a person with a role in the TV show.


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.


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)
$response = Invoke-RestMethod 'http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token}' -Method 'GET'
Write-Output $response