Get Libraries

A Plex server can have many different libraries setup for various media. You can easily retrieve the information about all libraries that are available on a Plex server using this API command.


GET http://[IP address]:32400/library/sections/?X-Plex-Token=[PlexToken]


IP addressThe IP address of the Plex Media server.
PlexTokenThe temporary authentication Plex token.

Return Status

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


XML string value that lists the libraries that have been created on the Plex server. An example of the XML returned from the request is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="4" allowSync="0" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1638961228" title1="Plex Library">
    <Directory allowSync="1" art="/:/resources/movie-fanart.jpg" composite="/library/sections/2/composite/1640879224" filters="1" refreshing="0" thumb="/:/resources/movie.png" key="2" type="movie" title="Movies" agent="" scanner="Plex Movie Scanner" language="en" uuid="493a64e7-b541-4667-b050-d702beebf2f6" updatedAt="1595491662" createdAt="1419621957" scannedAt="1640879224" content="1" directory="1" contentChangedAt="87188911" hidden="0">
        <Location id="9" path="M:\Media\Movies" />
    <Directory allowSync="1" art="/:/resources/show-fanart.jpg" composite="/library/sections/4/composite/1640879304" filters="1" refreshing="0" thumb="/:/resources/show.png" key="4" type="show" title="TV Shows" agent="com.plexapp.agents.thetvdb" scanner="Plex Series Scanner" language="en" uuid="3bbbe6f7-628f-4983-ae5d-7c05779c4c28" updatedAt="1595493250" createdAt="1419642504" scannedAt="1640879304" content="1" directory="1" contentChangedAt="5613493" hidden="0">
        <Location id="11" path="M:\Media\TV Shows" />
    <Directory allowSync="1" art="/:/resources/artist-fanart.jpg" composite="/library/sections/8/composite/1640879225" filters="1" refreshing="0" thumb="/:/resources/artist.png" key="8" type="artist" title="Music" agent="" scanner="Plex Music" language="en" uuid="b6031749-2969-4027-afee-64172b72b77d" updatedAt="1598392667" createdAt="1430573735" scannedAt="1640879225" content="1" directory="1" contentChangedAt="59913170" hidden="0">
        <Location id="16" path="M:\Media\Music" />
    <Directory allowSync="1" art="/:/resources/photo-fanart.jpg" composite="/library/sections/1/composite/1640879303" filters="1" refreshing="0" thumb="/:/resources/photo.png" key="1" type="photo" title="Photos" agent="com.plexapp.agents.none" scanner="Plex Photo Scanner" language="xn" uuid="fc948ea9-3fad-45e2-99ef-b461b2d746d2" updatedAt="1600821139" createdAt="1419611117" scannedAt="1640879303" enableAutoPhotoTags="0" content="1" directory="1" contentChangedAt="115673999" hidden="0">
        <Location id="10" path="M:\Media\Pictures" />


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

MediaContainer Attributes for Plex Libraries
sizeThe number of libraries added to the Plex server.
allowSync1 - allow syncing.
0 - do not allow syncing.
Note: Not sure how this attribute works as the server and libraries can have allowsync = 1, and this value can be 0.
identifierThe identifier for this type of item in Plex.
mediaTagPrefixPrefix for the media tag.
mediaTagVersionMedia tag version.
Note: This could be a date and time value.
title1The title of the library item.
Note: This appears to be internally created, and can't be changed by the server owner.

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

Plex Library Attributes
allowSync1 - allow the items in the library to be synced.
0 - do not allow the items in the library to be synced.
artLocation of the image file used for the library artwork.
compositeThe relative URL of the composite artwork for the library.
filters1 - allow library filters.
0 - do no allow library filters.
refreshing1 - the library is refreshing the metadata.
0 - the library is not refreshing the metadata.
thumbLocation of the thumbnail for the library.
keyThe unique key value for the library.
typeThe type of library.
titleThe title of library that was specified when the library was created.
agentThe agent used to set the metadata for the items in the library.
scannerThe name of the scanner used to scan the library.
languageThe two-character language for the library.
uuidUnique identifier for the library.
updatedAtThe date and time when the library was last updated.
createdAtThe date and time when the library was created.
scannedAtThe date and time when the library was last scanned.
contentChangedAtThe date and time when the library content was last changed.
hidden1 - the library is hidden.
0 - the library is not hidden.

Within each of the Directory elements can be one or more Location child elements. These child elements specify the folder path of the files associated with each library.

The attributes of the Location elements are:

Plex Library Location Attributes
idUnique integer value used as the location identifier.
pathThe full path to the folder containing the files for the library. This value was specified when the library was added to the Plex server.


Example 1

Get the library information for the Plex Media Server located at the IP address of