Get All Tracks for a Music Album

Each music album on Plex can have one or more tracks associated with it. This API command will return information about all the tracks, including the full path to the file.

URL

GET http://{ip_address}:32400/library/metadata/{id}/children?X-Plex-Token={plex_token}&includeGuids={include_guids}

Parameters

NameDescription
ip_addressThe IP address of the Plex Media server.
plex_tokenThe Plex token.
idThe key associated with a music album. This key can be found by calling the Get All Music Albums for an Artist API command and using the ratingKey attribute for the album.
include_guids(Optional) Returns the GUID values of the online metadata services associated to the media item.

Return Status

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

Response

XML string value that lists all the tracks for the album specified in the request. An example of the XML returned from the request is shown below:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="19" allowSync="1" art="/library/metadata/218548/art/1686115671" grandparentRatingKey="218548" grandparentThumb="/library/metadata/218548/thumb/1686115671" grandparentTitle="ABBA" identifier="com.plexapp.plugins.library" key="218549" librarySectionID="8" librarySectionTitle="Music" librarySectionUUID="b6031749-2969-4027-afee-64172b72b77d" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1682076900" nocache="1" parentIndex="1" parentTitle="Gold: Greatest Hits" parentYear="1992" sortAsc="1" summary="ABBA's 19-song Gold collection was the first hits compilation prepared specifically for the CD format by the 1970s supergroup, and, appearing after a period of several years in which their music had been off the market, was a welcome addition to the catalog. It is still the simplest and most straightforward collection of the group's material that it is possible to buy. ~ Bruce Eder" thumb="/library/metadata/218549/thumb/1685475601" title1="ABBA" title2="Gold: Greatest Hits" viewGroup="track" viewMode="458810">
    <Track ratingKey="218550" key="/library/metadata/218550" parentRatingKey="218549" grandparentRatingKey="218548" guid="plex://track/5d07cdc7403c640290f6a452" parentGuid="plex://album/5d07c182403c64029084e584" grandparentGuid="plex://artist/5d07bbfd403c6402904a6593" parentStudio="Polydor" type="track" title="Dancing Queen" grandparentKey="/library/metadata/218548" parentKey="/library/metadata/218549" grandparentTitle="ABBA" parentTitle="Gold: Greatest Hits" summary="" index="1" parentIndex="1" ratingCount="1448426" parentYear="1992" thumb="/library/metadata/218549/thumb/1685475601" art="/library/metadata/218548/art/1686115671" parentThumb="/library/metadata/218549/thumb/1685475601" grandparentThumb="/library/metadata/218548/thumb/1686115671" grandparentArt="/library/metadata/218548/art/1686115671" duration="231400" addedAt="1598373482" updatedAt="1686115672" musicAnalysisVersion="1">
        <Media id="278042" duration="231400" bitrate="978" audioChannels="2" audioCodec="flac" container="flac">
            <Part id="278372" key="/library/parts/278372/1598369723/file.flac" duration="231400" file="I:\Music\ABBA\Gold- Greatest Hits\01 Dancing Queen.flac" size="28310307" container="flac" />
        </Media>
    </Track>
    <Track ratingKey="218551" key="/library/metadata/218551" parentRatingKey="218549" grandparentRatingKey="218548" guid="plex://track/5d07cdd3403c640290f7cb52" parentGuid="plex://album/5d07c182403c64029084e584" grandparentGuid="plex://artist/5d07bbfd403c6402904a6593" parentStudio="Polydor" type="track" title="Knowing Me, Knowing You" grandparentKey="/library/metadata/218548" parentKey="/library/metadata/218549" grandparentTitle="ABBA" parentTitle="Gold: Greatest Hits" summary="" index="2" parentIndex="1" ratingCount="455281" parentYear="1992" thumb="/library/metadata/218549/thumb/1685475601" art="/library/metadata/218548/art/1686115671" parentThumb="/library/metadata/218549/thumb/1685475601" grandparentThumb="/library/metadata/218548/thumb/1686115671" grandparentArt="/library/metadata/218548/art/1686115671" duration="242226" addedAt="1598373482" updatedAt="1686115672" musicAnalysisVersion="1">
        <Media id="278043" duration="242226" bitrate="946" audioChannels="2" audioCodec="flac" container="flac">
            <Part id="278373" key="/library/parts/278373/1598369823/file.flac" duration="242226" file="I:\Music\ABBA\Gold- Greatest Hits\02 Knowing Me, Knowing You.flac" size="28660739" container="flac" />
        </Media>
    </Track>
    ...
</MediaContainer>

The XML returned provides a list of the all the tracks associated with a music album 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 tracks on the server.

MediaContainer Attributes
AttributeDescription
sizeThe number of tracks.
allowSync1 - allow syncing content.
0 - don't allow syncing content.
artBackground artwork used to represent the track.
grandparentRatingKeyThe key associated with the artist.
grandparentThumbThe thumbnail image associated with the artist.
grandparentTitleThe title of the artist.
identifierThe type of item.
keyUnique identifier for the track.
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.
parentIndexThe index of the album.
parentTitleThe title of the album.
parentYearThe year of the album.
sortAsc1 - the library is sorted in ascending order.
0 - the library is sorted in descending order.
summaryThe summary for the track.
thumbThe thumbnail for the track.
title1The title of the track.
Note: This appears to be internally created, and can't be changed by the server owner.
title2A descriptive title for the track.
viewGroupThe group type used to view the track.
viewModeUnknown integer value.

Within the MediaContainer there are one or more Track child elements. Each Track element represents one music track available on the Plex server.

Track Attributes
AttributeDescription
ratingKeyA key associated with the track.
keyThe relative URL of the track information.
parentRatingKeyThe relative URL of the information for the album.
grandparentRatingKeyThe relative URL of the information for the artist.
guidThe unique identifier comprised of the Plex agent and track identifier for the agent.
parentGuidThe GUID for the album.
grandparentGuidThe GUID for the artist.
grandparentTitleThe title of the artist.
parentTitleThe title of the album.
typeThe type of media.
titleThe title of the track.
grandparentKeyThe unique identifier for the artist.
parentKeyThe unique identifier for the album.
grandparentTitleThe title of the artist.
parentTitleThe title of the album.
summaryA summary of the track.
indexThe index of the track.
parentIndexThe index of the album.
ratingCountA count of the rating.
parentYearThe year the album was released.
thumbThe thumbnail for the track.
artThe background artwork used to represent the track.
parentThumbThe thumbnail for the album.
grandparentThumbThe thumbnail for the artist.
grandparentArtThe background artwork used to represent the artist.
durationThe length of the track in milliseconds.
addedAtThe date and time, in Unix time, the track was added to the library.
updatedAtThe date and time in epoch time, the track was updated in the library.
musicAnalysisVersionThe version of the music analyzer used.

Also within the Track element there are one or more Media elements that represent each media item for that track. If the track has multiple file versions, then each file would be represented by one Media element.

Each Media element contains the following:

Media Attributes
AttributeDescription
idUnique ID associated with the track.
durationThe length of the track in milliseconds.
bitrateThe bitrate of the track.
audioChannelsThe number of audio channels.
audioCodecThe audio codec used to encode the audio.
containerThe track container.

There is at least one Part element that contains information about the actual media file. Teh Part element contains the following:

Part Attributes
AttributeDescription
idUnique ID associated with the part.
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.

If the include_guids parameter was specified with the value of 1, then there would be a Guid element for each online metadata service associated with the item.

Examples

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