Server
Media
Butler
Plex
Library
- GETGet Hash Value
- GETGet Recently Added
- GETGet All Libraries
- GETGet library details
- DELDelete library section
- GETGet library items
- GETGet all media of library
- GETRefresh Metadata Of The Library
- GETSearch library
- GETGet Genres of library media
- GETGet Countries of library media
- GETGet Actors of library media
- GETSearch All Libraries
- GETGet Media Metadata
- GETGet Items Children
- GETGet Top Watched Content
- GETGet On Deck
Watchlist
Playlists
Authentication
Sessions
Search All Libraries
Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type.
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$request = new Operations\GetSearchAllLibrariesRequest(
query: '<value>',
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
searchTypes: [
Operations\SearchTypes::People,
],
);
$response = $sdk->library->getSearchAllLibraries(
request: $request
);
if ($response->object !== null) {
// handle response
}
{
"MediaContainer": {
"size": 123,
"SearchResult": [
{
"score": 123,
"Metadata": {
"ratingKey": "58683",
"key": "/library/metadata/58683",
"guid": "plex://movie/5d7768ba96b655001fdc0408",
"studio": "20th Century Studios",
"skipChildren": false,
"librarySectionID": 1,
"librarySectionTitle": "Movies",
"librarySectionKey": "/library/sections/1",
"type": "movie",
"title": "Avatar: The Way of Water",
"slug": "4-for-texas",
"contentRating": "PG-13",
"summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.",
"rating": 7.6,
"audienceRating": 9.2,
"year": 2022,
"seasonCount": 2022,
"tagline": "Return to Pandora.",
"flattenSeasons": "1",
"episodeSort": "0",
"enableCreditsMarkerGeneration": "-1",
"showOrdering": "absolute",
"thumb": "/library/metadata/58683/thumb/1703239236",
"art": "/library/metadata/58683/art/1703239236",
"banner": "/library/metadata/58683/banner/1703239236",
"duration": 11558112,
"originallyAvailableAt": "2022-12-14T00:00:00.000Z",
"addedAt": 1556281940,
"updatedAt": 1556281940,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "media",
"primaryExtraKey": "/library/metadata/58684",
"ratingImage": "rottentomatoes://image.rating.ripe",
"grandparentRatingKey": "66",
"grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4",
"grandparentKey": "/library/metadata/66",
"grandparentTitle": "Caprica",
"grandparentThumb": "/library/metadata/66/thumb/1705716261",
"parentSlug": "alice-in-borderland-2020",
"grandparentSlug": "alice-in-borderland-2020",
"grandparentArt": "/library/metadata/66/art/1705716261",
"grandparentTheme": "/library/metadata/66/theme/1705716261",
"Media": [
{
"id": 119534,
"duration": 11558112,
"bitrate": 25025,
"width": 3840,
"height": 2072,
"aspectRatio": 1.85,
"audioProfile": "dts",
"audioChannels": 6,
"audioCodec": "eac3",
"videoCodec": "hevc",
"videoResolution": "4k",
"container": "mkv",
"videoFrameRate": "24p",
"videoProfile": "main 10",
"hasVoiceActivity": false,
"optimizedForStreaming": 1,
"has64bitOffsets": false,
"Part": [
{
"id": 119542,
"key": "/library/parts/119542/1680457526/file.mkv",
"duration": 11558112,
"file": "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv",
"size": 36158371307,
"container": "mkv",
"audioProfile": "dts",
"has64bitOffsets": false,
"optimizedForStreaming": false,
"videoProfile": "main 10",
"indexes": "sd",
"hasThumbnail": "1",
"Stream": [
{
"id": 272796,
"streamType": 1,
"default": true,
"selected": true,
"codec": "h264",
"index": 0,
"bitrate": 6273,
"colorPrimaries": "bt709",
"colorRange": "tv",
"colorSpace": "bt709",
"colorTrc": "bt709",
"bitDepth": 8,
"chromaLocation": "left",
"streamIdentifier": "2",
"chromaSubsampling": "4:2:0",
"codedHeight": 1088,
"codedWidth": 1920,
"frameRate": 29.97,
"hasScalingMatrix": false,
"hearingImpaired": false,
"closedCaptions": false,
"embeddedInVideo": "1",
"height": 1080,
"level": 40,
"profile": "main",
"refFrames": 4,
"scanType": "progressive",
"width": 1920,
"displayTitle": "1080p (H.264)",
"extendedDisplayTitle": "1080p (H.264)",
"channels": 2,
"language": "English",
"languageTag": "en",
"languageCode": "eng",
"audioChannelLayout": "stereo",
"samplingRate": 48000,
"title": "English",
"canAutoSync": false
}
]
}
]
}
],
"Genre": [
{
"tag": "Adventure"
}
],
"Country": [
{
"tag": "United States of America"
}
],
"Director": [
{
"tag": "James Cameron"
}
],
"Writer": [
{
"tag": "James Cameron"
}
],
"Collection": [
{
"tag": "Working NL Subs"
}
],
"Role": [
{
"id": 294129,
"filter": "actor=294129",
"thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg",
"tag": "Mike Smith",
"tagKey": "668e7e7b22bcad9064350c91",
"role": "Self"
}
],
"Location": [
{
"path": "/TV Shows/House"
}
],
"Guid": [
{
"id": "imdb://tt13015952"
}
],
"UltraBlurColors": {
"topLeft": "11333b",
"topRight": "0a232d",
"bottomRight": 73958,
"bottomLeft": "1f5066"
},
"Rating": [
{
"image": "themoviedb://image.rating",
"value": 3,
"type": "audience"
}
],
"Image": [
{
"alt": "Episode 1",
"type": "background",
"url": "/library/metadata/45521/thumb/1644710589"
}
],
"titleSort": "Whale",
"viewCount": 1,
"lastViewedAt": 1682752242,
"originalTitle": "映画 ブラッククローバー 魔法帝の剣",
"viewOffset": 5222500,
"skipCount": 1,
"index": 1,
"theme": "/library/metadata/1/theme/1705636920",
"leafCount": 14,
"viewedLeafCount": 0,
"childCount": 1,
"hasPremiumExtras": "1",
"hasPremiumPrimaryExtra": "1",
"parentRatingKey": "66",
"parentGuid": "plex://show/5d9c081b170e24001f2a7be4",
"parentStudio": "UCP",
"parentKey": "/library/metadata/66",
"parentTitle": "Caprica",
"parentIndex": 1,
"parentYear": 2010,
"parentThumb": "/library/metadata/66/thumb/1705716261",
"parentTheme": "/library/metadata/66/theme/1705716261"
}
}
]
}
}
Authorizations
Plex Authentication Token
Headers
An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
Query Parameters
The search query term.
Limit the number of results returned.
A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv.
movies
, music
, otherVideos
, people
, tv
"movies,music,otherVideos,people,tv"
Whether to include collections in the search results.
0
, 1
1
Whether to include external media in the search results.
0
, 1
1
Response
The rating key (Media ID) of this media item. Note: This is always an integer, but is represented as a string in the API.
"58683"
"/library/metadata/58683"
"plex://movie/5d7768ba96b655001fdc0408"
The type of media content
movie
, show
, season
, episode
, artist
, album
"movie"
"Avatar: The Way of Water"
"Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home."
Unix epoch datetime in seconds
1556281940
"20th Century Studios"
false
1
"Movies"
"/library/sections/1"
"4-for-texas"
"PG-13"
7.6
9.2
2022
2022
"Return to Pandora."
Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
-1
, 0
, 1
"1"
Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).
-1
, 0
, 1
"0"
Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
-1
, 0
"-1"
Setting that indicates the episode ordering for the show. None = Library default, tmdbAiring = The Movie Database (Aired), aired = TheTVDB (Aired), dvd = TheTVDB (DVD), absolute = TheTVDB (Absolute)).
None
, tmdbAiring
, aired
, dvd
, absolute
"absolute"
"/library/metadata/58683/thumb/1703239236"
"/library/metadata/58683/art/1703239236"
"/library/metadata/58683/banner/1703239236"
11558112
"2022-12-14T00:00:00.000Z"
Unix epoch datetime in seconds
1556281940
"rottentomatoes://image.rating.upright"
"media"
"/library/metadata/58684"
"rottentomatoes://image.rating.ripe"
"66"
"plex://show/5d9c081b170e24001f2a7be4"
"/library/metadata/66"
"Caprica"
"/library/metadata/66/thumb/1705716261"
"alice-in-borderland-2020"
"alice-in-borderland-2020"
"/library/metadata/66/art/1705716261"
"/library/metadata/66/theme/1705716261"
The Media object is only included when type query is 4
or higher.
119534
"mkv"
11558112
25025
3840
2072
1.85
"dts"
6
"eac3"
"hevc"
"4k"
"24p"
"main 10"
false
0
, 1
1
false
"Adventure"
"United States of America"
"James Cameron"
"James Cameron"
"Working NL Subs"
The ID of the tag or actor.
294129
The filter used to find the actor or tag.
"actor=294129"
The thumbnail of the actor
"https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg"
The name of the tag or actor.
"Mike Smith"
Unique identifier for the tag.
"668e7e7b22bcad9064350c91"
The role of the actor or tag in the media.
"Self"
"/TV Shows/House"
The Guid object is only included in the response if the includeGuids
parameter is set to 1
.
Can be one of the following formats: imdb://tt13015952, tmdb://2434012, tvdb://7945991
"imdb://tt13015952"
"11333b"
"0a232d"
73958
"1f5066"
A URI or path to the rating image.
"themoviedb://image.rating"
The value of the rating.
3
The type of rating (e.g., audience, critic).
"audience"
"Episode 1"
coverPoster
, background
, snapshot
, clearLogo
"background"
"/library/metadata/45521/thumb/1644710589"
"Whale"
1
1682752242
"映画 ブラッククローバー 魔法帝の剣"
5222500
1
1
"/library/metadata/1/theme/1705636920"
14
0
1
"1"
"1"
The rating key of the parent item.
"66"
"plex://show/5d9c081b170e24001f2a7be4"
"UCP"
"/library/metadata/66"
"Caprica"
1
2010
"/library/metadata/66/thumb/1705716261"
"/library/metadata/66/theme/1705716261"
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$request = new Operations\GetSearchAllLibrariesRequest(
query: '<value>',
clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
searchTypes: [
Operations\SearchTypes::People,
],
);
$response = $sdk->library->getSearchAllLibraries(
request: $request
);
if ($response->object !== null) {
// handle response
}
{
"MediaContainer": {
"size": 123,
"SearchResult": [
{
"score": 123,
"Metadata": {
"ratingKey": "58683",
"key": "/library/metadata/58683",
"guid": "plex://movie/5d7768ba96b655001fdc0408",
"studio": "20th Century Studios",
"skipChildren": false,
"librarySectionID": 1,
"librarySectionTitle": "Movies",
"librarySectionKey": "/library/sections/1",
"type": "movie",
"title": "Avatar: The Way of Water",
"slug": "4-for-texas",
"contentRating": "PG-13",
"summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.",
"rating": 7.6,
"audienceRating": 9.2,
"year": 2022,
"seasonCount": 2022,
"tagline": "Return to Pandora.",
"flattenSeasons": "1",
"episodeSort": "0",
"enableCreditsMarkerGeneration": "-1",
"showOrdering": "absolute",
"thumb": "/library/metadata/58683/thumb/1703239236",
"art": "/library/metadata/58683/art/1703239236",
"banner": "/library/metadata/58683/banner/1703239236",
"duration": 11558112,
"originallyAvailableAt": "2022-12-14T00:00:00.000Z",
"addedAt": 1556281940,
"updatedAt": 1556281940,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "media",
"primaryExtraKey": "/library/metadata/58684",
"ratingImage": "rottentomatoes://image.rating.ripe",
"grandparentRatingKey": "66",
"grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4",
"grandparentKey": "/library/metadata/66",
"grandparentTitle": "Caprica",
"grandparentThumb": "/library/metadata/66/thumb/1705716261",
"parentSlug": "alice-in-borderland-2020",
"grandparentSlug": "alice-in-borderland-2020",
"grandparentArt": "/library/metadata/66/art/1705716261",
"grandparentTheme": "/library/metadata/66/theme/1705716261",
"Media": [
{
"id": 119534,
"duration": 11558112,
"bitrate": 25025,
"width": 3840,
"height": 2072,
"aspectRatio": 1.85,
"audioProfile": "dts",
"audioChannels": 6,
"audioCodec": "eac3",
"videoCodec": "hevc",
"videoResolution": "4k",
"container": "mkv",
"videoFrameRate": "24p",
"videoProfile": "main 10",
"hasVoiceActivity": false,
"optimizedForStreaming": 1,
"has64bitOffsets": false,
"Part": [
{
"id": 119542,
"key": "/library/parts/119542/1680457526/file.mkv",
"duration": 11558112,
"file": "/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv",
"size": 36158371307,
"container": "mkv",
"audioProfile": "dts",
"has64bitOffsets": false,
"optimizedForStreaming": false,
"videoProfile": "main 10",
"indexes": "sd",
"hasThumbnail": "1",
"Stream": [
{
"id": 272796,
"streamType": 1,
"default": true,
"selected": true,
"codec": "h264",
"index": 0,
"bitrate": 6273,
"colorPrimaries": "bt709",
"colorRange": "tv",
"colorSpace": "bt709",
"colorTrc": "bt709",
"bitDepth": 8,
"chromaLocation": "left",
"streamIdentifier": "2",
"chromaSubsampling": "4:2:0",
"codedHeight": 1088,
"codedWidth": 1920,
"frameRate": 29.97,
"hasScalingMatrix": false,
"hearingImpaired": false,
"closedCaptions": false,
"embeddedInVideo": "1",
"height": 1080,
"level": 40,
"profile": "main",
"refFrames": 4,
"scanType": "progressive",
"width": 1920,
"displayTitle": "1080p (H.264)",
"extendedDisplayTitle": "1080p (H.264)",
"channels": 2,
"language": "English",
"languageTag": "en",
"languageCode": "eng",
"audioChannelLayout": "stereo",
"samplingRate": 48000,
"title": "English",
"canAutoSync": false
}
]
}
]
}
],
"Genre": [
{
"tag": "Adventure"
}
],
"Country": [
{
"tag": "United States of America"
}
],
"Director": [
{
"tag": "James Cameron"
}
],
"Writer": [
{
"tag": "James Cameron"
}
],
"Collection": [
{
"tag": "Working NL Subs"
}
],
"Role": [
{
"id": 294129,
"filter": "actor=294129",
"thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg",
"tag": "Mike Smith",
"tagKey": "668e7e7b22bcad9064350c91",
"role": "Self"
}
],
"Location": [
{
"path": "/TV Shows/House"
}
],
"Guid": [
{
"id": "imdb://tt13015952"
}
],
"UltraBlurColors": {
"topLeft": "11333b",
"topRight": "0a232d",
"bottomRight": 73958,
"bottomLeft": "1f5066"
},
"Rating": [
{
"image": "themoviedb://image.rating",
"value": 3,
"type": "audience"
}
],
"Image": [
{
"alt": "Episode 1",
"type": "background",
"url": "/library/metadata/45521/thumb/1644710589"
}
],
"titleSort": "Whale",
"viewCount": 1,
"lastViewedAt": 1682752242,
"originalTitle": "映画 ブラッククローバー 魔法帝の剣",
"viewOffset": 5222500,
"skipCount": 1,
"index": 1,
"theme": "/library/metadata/1/theme/1705636920",
"leafCount": 14,
"viewedLeafCount": 0,
"childCount": 1,
"hasPremiumExtras": "1",
"hasPremiumPrimaryExtra": "1",
"parentRatingKey": "66",
"parentGuid": "plex://show/5d9c081b170e24001f2a7be4",
"parentStudio": "UCP",
"parentKey": "/library/metadata/66",
"parentTitle": "Caprica",
"parentIndex": 1,
"parentYear": 2010,
"parentThumb": "/library/metadata/66/thumb/1705716261",
"parentTheme": "/library/metadata/66/theme/1705716261"
}
}
]
}
}