plex-docs.speakeasyapi.dev Open in urlscan Pro
2606:50c0:8002::153  Public Scan

URL: https://plex-docs.speakeasyapi.dev/
Submission: On August 27 via automatic, source certstream-suspicious — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

Python

Light

Dark

 * Guides

 * Client SDKs
   
   

 * Installation
   
   

 * Resources

 * Server
   
    * Get Server Capabilities
      
      
   
    * Get Server Preferences
      
      
   
    * Get Available Clients
      
      
   
    * Get Devices
      
      
   
    * Get Server Identity
      
      
   
    * Get My Plex Account
      
      
   
    * Get Resized Photo
      
      
   
    * Get Server List
      
      

 * Media
   
    * Mark Played
      
      
   
    * Mark Unplayed
      
      
   
    * Update Play Progress
      
      

 * Activities
   
    * Get Server Activities
      
      
   
    * Cancel Server Activities
      
      

 * Butler
   
    * Stop All Tasks
      
      
   
    * Get Butler Tasks
      
      
   
    * Start All Tasks
      
      
   
    * Stop Task
      
      
   
    * Start Task
      
      

 * Hubs
   
    * Get Global Hubs
      
      
   
    * Get Library Hubs
      
      

 * Search
   
    * Perform Search
      
      
   
    * Perform Voice Search
      
      
   
    * Get Search Results
      
      

 * Library
   
    * Get File Hash
      
      
   
    * Get Recently Added
      
      
   
    * Get Libraries
      
      
   
    * Delete Library
      
      
   
    * Get Library
      
      
   
    * Get Library Items
      
      
   
    * Refresh Library
      
      
   
    * Get Latest Library Items
      
      
   
    * Get Common Library Items
      
      
   
    * Get Metadata
      
      
   
    * Get Metadata Children
      
      
   
    * Get On Deck
      
      

 * Log
   
    * Log Line
      
      
   
    * Log Multi Line
      
      
   
    * Enable Paper Trail
      
      

 * Playlists
   
    * Create Playlist
      
      
   
    * Get Playlists
      
      
   
    * Delete Playlist
      
      
   
    * Get Playlist
      
       * S
         
         
   
    * Update Playlist
      
      
   
    * Clear Playlist Contents
      
      
   
    * Get Playlist Contents
      
      
   
    * Add Playlist Contents
      
      
   
    * Upload Playlist
      
      

 * Security
   
    * Get Transient Token
      
      
   
    * Get Source Connection Information
      
      

 * Sessions
   
    * Get Sessions
      
      
   
    * Get Session History
      
      
   
    * Get Transcode Sessions
      
      
   
    * Stop Transcode Session
      
      

 * Updater
   
    * Get Update Status
      
      
   
    * Check For Updates
      
      
   
    * Apply Updates
      
      

 * Video
   
    * Start Universal Transcode
      
      
   
    * Get Timeline
      
      

 * 



Index


API AND SDK REFERENCE

#


INSTALLATION

#
1
pip install git+<UNSET>.git



--------------------------------------------------------------------------------


SERVER

#

Operations against the Plex Media Server System.


AVAILABLE OPERATIONS

#
 * Get Server Capabilities - Server Capabilities
 * Get Server Preferences - Get Server Preferences
 * Get Available Clients - Get Available Clients
 * Get Devices - Get Devices
 * Get Server Identity - Get Server Identity
 * Get My Plex Account - Get MyPlex Account
 * Get Resized Photo - Get a Resized Photo
 * Get Server List - Get Server List

--------------------------------------------------------------------------------

SERVER


GET SERVER CAPABILITIES

#

Server Capabilities


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSERVERCAPABILITIESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETSERVERCAPABILITIESRESPONSEBODY]

The Server Capabilities

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.MEDIACONTAINER]

SHOW CHILD PROPERTIES


GetServerCapabilities.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_server_capabilities()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 5488.14,

4
"allowCameraUpload": false,

5
"allowChannelAccess": false,

6
"allowMediaDeletion": false,

7
"allowSharing": false,

8
"allowSync": false,

9
"allowTuners": false,

10
"backgroundProcessing": false,

11
"certificate": false,

12
"companionProxy": false,

13
"countryCode": "string",

14
"diagnostics": "string",

15
"eventStream": false,

16
"friendlyName": "string",

17
"hubSearch": false,

18
"itemClusters": false,

19
"livetv": 5928.45,

20
"machineIdentifier": "string",

21
"mediaProviders": false,

22
"multiuser": false,

23
"musicAnalysis": 7151.9,

24
"myPlex": false,

25
"myPlexMappingState": "string",

26
"myPlexSigninState": "string",

27
"myPlexSubscription": false,

28
"myPlexUsername": "string",

29
"offlineTranscode": 8442.66,

30
"ownerFeatures": "string",

31
"photoAutoTag": false,

32
"platform": "string",

33
"platformVersion": "string",

34
"pluginHost": false,

35
"pushNotifications": false,

36
"readOnlyLibraries": false,

37
"streamingBrainABRVersion": 6027.63,

38
"streamingBrainVersion": 8579.46,

39
"sync": false,

40
"transcoderActiveVideoSessions": 5448.83,

41
"transcoderAudio": false,

42
"transcoderLyrics": false,

43
"transcoderPhoto": false,

44
"transcoderSubtitles": false,

45
"transcoderVideo": false,

46
"transcoderVideoBitrates": "string",

47
"transcoderVideoQualities": "string",

48
"transcoderVideoResolutions": "string",

49
"updatedAt": 8472.52,

50
"updater": false,

51
"version": "string",

52
"voiceSearch": false,

53
"Directory": [

54
{

55
"count": 4236.55,

56
"key": "string",

57
"title": "string"

58
}

59
]

60
}

61
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET SERVER PREFERENCES

#

Get Server Preferences


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSERVERPREFERENCESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetServerPreferences.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_server_preferences()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET AVAILABLE CLIENTS

#

Get Available Clients


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETAVAILABLECLIENTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

CLASSES LIST[OPERATIONS.RESPONSEBODY]

Available Clients

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETAVAILABLECLIENTSMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetAvailableClients.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_available_clients()

9


10
if res.classes is not None:

11
# handle response

12
pass


Example Response

1
[

2
{

3
"MediaContainer": {

4
"size": 1,

5
"Server": [

6
{

7
"name": "iPad",

8
"host": "10.10.10.102",

9
"address": "10.10.10.102",

10
"port": 32500,

11
"machineIdentifier": "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05",

12
"version": "8.17",

13
"protocol": "plex",

14
"product": "Plex for iOS",

15
"deviceClass": "tablet",

16
"protocolVersion": 2,

17
"protocolCapabilities": "playback,playqueues,timeline,provider-playback"

18
}

19
]

20
}

21
}

22
]


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET DEVICES

#

Get Devices


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETDEVICESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETDEVICESRESPONSEBODY]

Devices

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETDEVICESMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetDevices.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_devices()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 151,

4
"identifier": "com.plexapp.system.devices",

5
"Device": [

6
{

7
"id": 1,

8
"name": "iPhone",

9
"platform": "iOS",

10
"clientIdentifier": "string",

11
"createdAt": 1654131230

12
}

13
]

14
}

15
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET SERVER IDENTITY

#

Get Server Identity


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSERVERIDENTITYRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETSERVERIDENTITYRESPONSEBODY]

The Transcode Sessions

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETSERVERIDENTITYMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetServerIdentity.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_server_identity()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 0,

4
"claimed": false,

5
"machineIdentifier": "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4",

6
"version": "1.31.3.6868-28fc46b27"

7
}

8
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET MY PLEX ACCOUNT

#

Returns MyPlex Account Information


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETMYPLEXACCOUNTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETMYPLEXACCOUNTRESPONSEBODY]

MyPlex Account

SHOW CHILD PROPERTIES

MY_PLEX OPTIONAL[OPERATIONS.MYPLEX]

SHOW CHILD PROPERTIES


GetMyPlexAccount.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_my_plex_account()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MyPlex": {

3
"authToken": "Z5v-PrNASDFpsaCi3CPK7",

4
"username": "example.email@mail.com",

5
"mappingState": "mapped",

6
"mappingError": "string",

7
"signInState": "ok",

8
"publicAddress": "140.20.68.140",

9
"publicPort": 32400,

10
"privateAddress": "10.10.10.47",

11
"privatePort": 32400,

12
"subscriptionFeatures":
"federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks",

13
"subscriptionActive": false,

14
"subscriptionState": "Active"

15
}

16
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET RESIZED PHOTO

#

Plex's Photo transcoder is used throughout the service to serve images at
specified sizes.


PARAMETERS

#
Python


REQUEST OPERATIONS.GETRESIZEDPHOTOREQUEST

The request object to use for the request.

SHOW CHILD PROPERTIES

WIDTH FLOAT

The width for the resized photo


Example: 110

--------------------------------------------------------------------------------

HEIGHT FLOAT

The height for the resized photo


Example: 165

--------------------------------------------------------------------------------

OPACITY INT

The opacity for the resized photo

--------------------------------------------------------------------------------

BLUR FLOAT

The width for the resized photo


Example: 0

--------------------------------------------------------------------------------

MIN_SIZE FLOAT

images are always scaled proportionally. A value of '1' in minSize will make the
smaller native dimension the dimension resized against.

--------------------------------------------------------------------------------

UPSCALE FLOAT

allow images to be resized beyond native dimensions.

--------------------------------------------------------------------------------

URL STR

path to image within Plex


Example: /library/metadata/49564/thumb/1654258204


RESPONSE

#
Python


OPERATIONS.GETRESIZEDPHOTORESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetResizedPhoto.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8
req = operations.GetResizedPhotoRequest(

9
width=110,

10
height=165,

11
opacity=548814,

12
blur=20,

13
min_size=7151.9,

14
upscale=8442.66,

15
url='/library/metadata/49564/thumb/1654258204',

16
)

17


18
res = s.server.get_resized_photo(req)

19


20
if res.status_code == 200:

21
# handle response

22
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SERVER


GET SERVER LIST

#

Get Server List


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSERVERLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETSERVERLISTRESPONSEBODY]

List of Servers

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETSERVERLISTMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetServerList.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.server.get_server_list()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 1,

4
"Server": [

5
{

6
"name": "Hera",

7
"host": "10.10.10.47",

8
"address": "10.10.10.47",

9
"port": 32400,

10
"machineIdentifier": "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4",

11
"version": "1.31.3.6868-28fc46b27"

12
}

13
]

14
}

15
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------


MEDIA

#

API Calls interacting with Plex Media Server Media


AVAILABLE OPERATIONS

#
 * Mark Played - Mark Media Played
 * Mark Unplayed - Mark Media Unplayed
 * Update Play Progress - Update Media Play Progress

--------------------------------------------------------------------------------

MEDIA


MARK PLAYED

#

This will mark the provided media key as Played.


PARAMETERS

#
Python


KEY FLOAT

The media key to mark as played


Example: 59398


RESPONSE

#
Python


OPERATIONS.MARKPLAYEDRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

MarkPlayed.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.media.mark_played(key=59398)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

MEDIA


MARK UNPLAYED

#

This will mark the provided media key as Unplayed.


PARAMETERS

#
Python


KEY FLOAT

The media key to mark as Unplayed


Example: 59398


RESPONSE

#
Python


OPERATIONS.MARKUNPLAYEDRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

MarkUnplayed.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.media.mark_unplayed(key=59398)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

MEDIA


UPDATE PLAY PROGRESS

#

This API command can be used to update the play progress of a media item.


PARAMETERS

#
Python


KEY STR

the media key

--------------------------------------------------------------------------------

TIME FLOAT

The time, in milliseconds, used to set the media playback progress.

--------------------------------------------------------------------------------

STATE STR

The playback state of the media item.


RESPONSE

#
Python


OPERATIONS.UPDATEPLAYPROGRESSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

UpdatePlayProgress.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.media.update_play_progress(key='string', time=6027.63, state='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


ACTIVITIES

#

Activities are awesome. They provide a way to monitor and control asynchronous
operations on the server. In order to receive real-time updates for activities,
a client would normally subscribe via either EventSource or Websocket endpoints.
Activities are associated with HTTP replies via a special X\-Plex\-Activity
header which contains the UUID of the activity. Activities are optional
cancellable. If cancellable, they may be cancelled via the DELETE endpoint.
Other details: - They can contain a progress (from 0 to 100) marking the percent
completion of the activity. - They must contain an type which is used by clients
to distinguish the specific activity. - They may contain a Context object with
attributes which associate the activity with various specific entities (items,
libraries, etc.) - The may contain a Response object which attributes which
represent the result of the asynchronous operation.


AVAILABLE OPERATIONS

#
 * Get Server Activities - Get Server Activities
 * Cancel Server Activities - Cancel Server Activities

--------------------------------------------------------------------------------

ACTIVITIES


GET SERVER ACTIVITIES

#

Get Server Activities


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSERVERACTIVITIESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETSERVERACTIVITIESRESPONSEBODY]

The Server Activities

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETSERVERACTIVITIESMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetServerActivities.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.activities.get_server_activities()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 6235.64,

4
"Activity": [

5
{

6
"uuid": "string",

7
"type": "string",

8
"cancellable": false,

9
"userID": 6458.94,

10
"title": "string",

11
"subtitle": "string",

12
"progress": 3843.82,

13
"Context": {

14
"librarySectionID": "string"

15
}

16
}

17
]

18
}

19
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

ACTIVITIES


CANCEL SERVER ACTIVITIES

#

Cancel Server Activities


PARAMETERS

#
Python


ACTIVITY_UUID STR

The UUID of the activity to cancel.


RESPONSE

#
Python


OPERATIONS.CANCELSERVERACTIVITIESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

CancelServerActivities.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.activities.cancel_server_activities(activity_uuid='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


BUTLER

#

Butler is the task manager of the Plex Media Server Ecosystem.


AVAILABLE OPERATIONS

#
 * Stop All Tasks - Stop all Butler tasks
 * Get Butler Tasks - Get Butler tasks
 * Start All Tasks - Start all Butler tasks
 * Stop Task - Stop a single Butler task
 * Start Task - Start a single Butler task

--------------------------------------------------------------------------------

BUTLER


STOP ALL TASKS

#

This endpoint will stop all currently running tasks and remove any scheduled
tasks from the queue.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.STOPALLTASKSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StopAllTasks.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.butler.stop_all_tasks()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

BUTLER


GET BUTLER TASKS

#

Returns a list of butler tasks


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETBUTLERTASKSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETBUTLERTASKSRESPONSEBODY]

All butler tasks

SHOW CHILD PROPERTIES

BUTLER_TASKS OPTIONAL[OPERATIONS.BUTLERTASKS]

SHOW CHILD PROPERTIES


GetButlerTasks.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.butler.get_butler_tasks()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"ButlerTasks": {

3
"ButlerTask": [

4
{

5
"name": "BackupDatabase",

6
"interval": 3,

7
"scheduleRandomized": false,

8
"enabled": false,

9
"title": "Backup Database",

10
"description": "Create a backup copy of the server's database in the configured
backup directory"

11
}

12
]

13
}

14
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

BUTLER


START ALL TASKS

#

This endpoint will attempt to start all Butler tasks that are enabled in the
settings. Butler tasks normally run automatically during a time window
configured on the server's Settings page but can be manually started using this
endpoint. Tasks will run with the following criteria:

 1. Any tasks not scheduled to run on the current day will be skipped.
 2. If a task is configured to run at a random time during the configured window
    and we are outside that window, the task will start immediately.
 3. If a task is configured to run at a random time during the configured window
    and we are within that window, the task will be scheduled at a random time
    within the window.
 4. If we are outside the configured window, the task will start immediately.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.STARTALLTASKSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StartAllTasks.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.butler.start_all_tasks()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

BUTLER


STOP TASK

#

This endpoint will stop a currently running task by name, or remove it from the
list of scheduled tasks if it exists. See the section above for a list of task
names for this endpoint.


PARAMETERS

#
Python


TASK_NAME OPERATIONS.TASKNAME

The name of the task to be started.

SHOW CHILD PROPERTIES

NameValueBACKUP_DATABASEBackupDatabaseBUILD_GRACENOTE_COLLECTIONSBuildGracenoteCollectionsCHECK_FOR_UPDATESCheckForUpdatesCLEAN_OLD_BUNDLESCleanOldBundlesCLEAN_OLD_CACHE_FILESCleanOldCacheFilesDEEP_MEDIA_ANALYSISDeepMediaAnalysisGENERATE_AUTO_TAGSGenerateAutoTagsGENERATE_CHAPTER_THUMBSGenerateChapterThumbsGENERATE_MEDIA_INDEX_FILESGenerateMediaIndexFilesOPTIMIZE_DATABASEOptimizeDatabaseREFRESH_LIBRARIESRefreshLibrariesREFRESH_LOCAL_MEDIARefreshLocalMediaREFRESH_PERIODIC_METADATARefreshPeriodicMetadataUPGRADE_MEDIA_ANALYSISUpgradeMediaAnalysis


RESPONSE

#
Python


OPERATIONS.STOPTASKRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StopTask.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res =
s.butler.stop_task(task_name=operations.TaskName.REFRESH_PERIODIC_METADATA)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

BUTLER


START TASK

#

This endpoint will attempt to start a single Butler task that is enabled in the
settings. Butler tasks normally run automatically during a time window
configured on the server's Settings page but can be manually started using this
endpoint. Tasks will run with the following criteria:

 1. Any tasks not scheduled to run on the current day will be skipped.
 2. If a task is configured to run at a random time during the configured window
    and we are outside that window, the task will start immediately.
 3. If a task is configured to run at a random time during the configured window
    and we are within that window, the task will be scheduled at a random time
    within the window.
 4. If we are outside the configured window, the task will start immediately.


PARAMETERS

#
Python


TASK_NAME OPERATIONS.PATHPARAMTASKNAME

the name of the task to be started.

SHOW CHILD PROPERTIES

NameValueBACKUP_DATABASEBackupDatabaseBUILD_GRACENOTE_COLLECTIONSBuildGracenoteCollectionsCHECK_FOR_UPDATESCheckForUpdatesCLEAN_OLD_BUNDLESCleanOldBundlesCLEAN_OLD_CACHE_FILESCleanOldCacheFilesDEEP_MEDIA_ANALYSISDeepMediaAnalysisGENERATE_AUTO_TAGSGenerateAutoTagsGENERATE_CHAPTER_THUMBSGenerateChapterThumbsGENERATE_MEDIA_INDEX_FILESGenerateMediaIndexFilesOPTIMIZE_DATABASEOptimizeDatabaseREFRESH_LIBRARIESRefreshLibrariesREFRESH_LOCAL_MEDIARefreshLocalMediaREFRESH_PERIODIC_METADATARefreshPeriodicMetadataUPGRADE_MEDIA_ANALYSISUpgradeMediaAnalysis


RESPONSE

#
Python


OPERATIONS.STARTTASKRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StartTask.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res =
s.butler.start_task(task_name=operations.PathParamTaskName.GENERATE_CHAPTER_THUMBS)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


HUBS

#

Hubs are a structured two-dimensional container for media, generally represented
by multiple horizontal rows.


AVAILABLE OPERATIONS

#
 * Get Global Hubs - Get Global Hubs
 * Get Library Hubs - Get library specific hubs

--------------------------------------------------------------------------------

HUBS


GET GLOBAL HUBS

#

Get Global Hubs filtered by the parameters provided.


PARAMETERS

#
Python


COUNT OPTIONAL[FLOAT]

The number of items to return with each hub.

--------------------------------------------------------------------------------

ONLY_TRANSIENT OPTIONAL[FLOAT]

Only return hubs which are "transient", meaning those which are prone to
changing after media playback or addition (e.g. On Deck, or Recently Added).


RESPONSE

#
Python


OPERATIONS.GETGLOBALHUBSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetGlobalHubs.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.hubs.get_global_hubs(count=8472.52, only_transient=4236.55)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

HUBS


GET LIBRARY HUBS

#

This endpoint will return a list of library specific hubs


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query

--------------------------------------------------------------------------------

COUNT OPTIONAL[FLOAT]

The number of items to return with each hub.

--------------------------------------------------------------------------------

ONLY_TRANSIENT OPTIONAL[FLOAT]

Only return hubs which are "transient", meaning those which are prone to
changing after media playback or addition (e.g. On Deck, or Recently Added).


RESPONSE

#
Python


OPERATIONS.GETLIBRARYHUBSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetLibraryHubs.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.hubs.get_library_hubs(section_id=6235.64, count=6458.94,
only_transient=3843.82)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


SEARCH

#

API Calls that perform search operations with Plex Media Server


AVAILABLE OPERATIONS

#
 * Perform Search - Perform a search
 * Perform Voice Search - Perform a voice search
 * Get Search Results - Get Search Results

--------------------------------------------------------------------------------

SEARCH


PERFORM SEARCH

#

This endpoint performs a search across all library sections, or a single
section, and returns matches as hubs, split up by type. It performs spell
checking, looks for partial matches, and orders the hubs based on quality of
results. In addition, based on matches, it will return other related matches
(e.g. for a genre match, it may return movies in that genre, or for an actor
match, movies with that actor).

In the response's items, the following extra attributes are returned to further
describe or disambiguate the result:

 * reason: The reason for the result, if not because of a direct search term
   match; can be either:
   * section: There are multiple identical results from different sections.
   * originalTitle: There was a search term match from the original title field
     (sometimes those can be very different or in a foreign language).
   * <hub identifier>: If the reason for the result is due to a result in
     another hub, the source hub identifier is returned. For example, if the
     search is for "dylan" then Bob Dylan may be returned as an artist result,
     an a few of his albums returned as album results with a reason code of
     artist (the identifier of that particular hub). Or if the search is for
     "arnold", there might be movie results returned with a reason of actor
 * reasonTitle: The string associated with the reason code. For a section
   reason, it'll be the section name; For a hub identifier, it'll be a string
   associated with the match (e.g. Arnold Schwarzenegger for movies which were
   returned because the search was for "arnold").
 * reasonID: The ID of the item associated with the reason for the result. This
   might be a section ID, a tag ID, an artist ID, or a show ID.

This request is intended to be very fast, and called as the user types.


PARAMETERS

#
Python


QUERY STR

The query term


Example: arnold

--------------------------------------------------------------------------------

SECTION_ID OPTIONAL[FLOAT]

This gives context to the search, and can result in re-ordering of search result
hubs

--------------------------------------------------------------------------------

LIMIT OPTIONAL[FLOAT]

The number of items to return per hub


Example: 5


RESPONSE

#
Python


OPERATIONS.PERFORMSEARCHRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

PerformSearch.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.search.perform_search(query='arnold', section_id=2975.34, limit=5)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SEARCH


PERFORM VOICE SEARCH

#

This endpoint performs a search specifically tailored towards voice or other
imprecise input which may work badly with the substring and spell-checking
heuristics used by the /hubs/search endpoint. It uses a Levenshtein distance
heuristic to search titles, and as such is much slower than the other search
endpoint. Whenever possible, clients should limit the search to the appropriate
type. Results, as well as their containing per-type hubs, contain a distance
attribute which can be used to judge result quality.


PARAMETERS

#
Python


QUERY STR

The query term


Example: dead+poop

--------------------------------------------------------------------------------

SECTION_ID OPTIONAL[FLOAT]

This gives context to the search, and can result in re-ordering of search result
hubs

--------------------------------------------------------------------------------

LIMIT OPTIONAL[FLOAT]

The number of items to return per hub


Example: 5


RESPONSE

#
Python


OPERATIONS.PERFORMVOICESEARCHRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

PerformVoiceSearch.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.search.perform_voice_search(query='dead+poop', section_id=8917.73,
limit=5)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SEARCH


GET SEARCH RESULTS

#

This will search the database for the string provided.


PARAMETERS

#
Python


QUERY STR

The search query string to use


Example: 110


RESPONSE

#
Python


OPERATIONS.GETSEARCHRESULTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETSEARCHRESULTSRESPONSEBODY]

Search Results

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETSEARCHRESULTSMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetSearchResults.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.search.get_search_results(query='110')

10


11
if res.object is not None:

12
# handle response

13
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 26,

4
"identifier": "com.plexapp.plugins.library",

5
"mediaTagPrefix": "/system/bundle/media/flags/",

6
"mediaTagVersion": 1680021154,

7
"Metadata": [

8
{

9
"allowSync": false,

10
"librarySectionID": 1,

11
"librarySectionTitle": "Movies",

12
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",

13
"personal": false,

14
"sourceTitle": "Hera",

15
"ratingKey": 10398,

16
"key": "/library/metadata/10398",

17
"guid": "plex://movie/5d7768284de0ee001fcc8f52",

18
"studio": "Paramount",

19
"type": "movie",

20
"title": "Mission: Impossible",

21
"contentRating": "PG-13",

22
"summary": "When Ethan Hunt the leader of a crack espionage team whose perilous
operation has gone awry with no explanation discovers that a mole has penetrated
the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name
Hunt now must ferret out the real double agent and in the process even the
score.",

23
"rating": 6.6,

24
"audienceRating": 7.1,

25
"year": 1996,

26
"tagline": "Expect the impossible.",

27
"thumb": "/library/metadata/10398/thumb/1679505055",

28
"art": "/library/metadata/10398/art/1679505055",

29
"duration": 6612628,

30
"originallyAvailableAt": "1996-05-22T00:00:00.000Z",

31
"addedAt": 1589234571,

32
"updatedAt": 1679505055,

33
"audienceRatingImage": "rottentomatoes://image.rating.upright",

34
"chapterSource": "media",

35
"primaryExtraKey": "/library/metadata/10501",

36
"ratingImage": "rottentomatoes://image.rating.ripe",

37
"Media": [

38
{

39
"id": 26610,

40
"duration": 6612628,

41
"bitrate": 4751,

42
"width": 1916,

43
"height": 796,

44
"aspectRatio": 2.35,

45
"audioChannels": 6,

46
"audioCodec": "aac",

47
"videoCodec": "hevc",

48
"videoResolution": 1080,

49
"container": "mkv",

50
"videoFrameRate": "24p",

51
"audioProfile": "lc",

52
"videoProfile": "main 10",

53
"Part": [

54
{

55
"id": 26610,

56
"key": "/library/parts/26610/1589234571/file.mkv",

57
"duration": 6612628,

58
"file": "/movies/Mission Impossible (1996)/Mission Impossible (1996)
Bluray-1080p.mkv",

59
"size": 3926903851,

60
"audioProfile": "lc",

61
"container": "mkv",

62
"videoProfile": "main 10"

63
}

64
]

65
}

66
],

67
"Genre": [

68
{

69
"tag": "Action"

70
}

71
],

72
"Director": [

73
{

74
"tag": "Brian De Palma"

75
}

76
],

77
"Writer": [

78
{

79
"tag": "David Koepp"

80
}

81
],

82
"Country": [

83
{

84
"tag": "United States of America"

85
}

86
],

87
"Role": [

88
{

89
"tag": "Tom Cruise"

90
}

91
]

92
}

93
],

94
"Provider": [

95
{

96
"key": "/system/search",

97
"title": "Local Network",

98
"type": "mixed"

99
}

100
]

101
}

102
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------


LIBRARY

#

API Calls interacting with Plex Media Server Libraries


AVAILABLE OPERATIONS

#
 * Get File Hash - Get Hash Value
 * Get Recently Added - Get Recently Added
 * Get Libraries - Get All Libraries
 * Delete Library - Delete Library Section
 * Get Library - Get Library Details
 * Get Library Items - Get Library Items
 * Refresh Library - Refresh Library
 * Get Latest Library Items - Get Latest Library Items
 * Get Common Library Items - Get Common Library Items
 * Get Metadata - Get Items Metadata
 * Get Metadata Children - Get Items Children
 * Get On Deck - Get On Deck

--------------------------------------------------------------------------------

LIBRARY


GET FILE HASH

#

This resource returns hash values for local files


PARAMETERS

#
Python


URL STR

This is the path to the local file, must be prefixed by file://


Example: file://C:\Image.png&type=13

--------------------------------------------------------------------------------

TYPE OPTIONAL[FLOAT]

Item type


RESPONSE

#
Python


OPERATIONS.GETFILEHASHRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetFileHash.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_file_hash(url='file://C:\Image.png&type=13', type=567.13)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET RECENTLY ADDED

#

This endpoint will return the recently added content.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETRECENTLYADDEDRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETRECENTLYADDEDRESPONSEBODY]

The recently added content

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETRECENTLYADDEDMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetRecentlyAdded.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.library.get_recently_added()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 50,

4
"allowSync": false,

5
"identifier": "com.plexapp.plugins.library",

6
"mediaTagPrefix": "/system/bundle/media/flags/",

7
"mediaTagVersion": 1680021154,

8
"mixedParents": false,

9
"Metadata": [

10
{

11
"allowSync": false,

12
"librarySectionID": 1,

13
"librarySectionTitle": "Movies",

14
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",

15
"ratingKey": 59398,

16
"key": "/library/metadata/59398",

17
"guid": "plex://movie/5e161a83bea6ac004126e148",

18
"studio": "Marvel Studios",

19
"type": "movie",

20
"title": "Ant-Man and the Wasp: Quantumania",

21
"contentRating": "PG-13",

22
"summary": "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne
explore the Quantum Realm where they interact with strange creatures and embark
on an adventure that goes beyond the limits of what they thought was possible.",

23
"rating": 4.7,

24
"audienceRating": 8.3,

25
"year": 2023,

26
"tagline": "Witness the beginning of a new dynasty.",

27
"thumb": "/library/metadata/59398/thumb/1681888010",

28
"art": "/library/metadata/59398/art/1681888010",

29
"duration": 7474422,

30
"originallyAvailableAt": "2023-02-15T00:00:00.000Z",

31
"addedAt": 1681803215,

32
"updatedAt": 1681888010,

33
"audienceRatingImage": "rottentomatoes://image.rating.upright",

34
"chapterSource": "media",

35
"primaryExtraKey": "/library/metadata/59399",

36
"ratingImage": "rottentomatoes://image.rating.rotten",

37
"Media": [

38
{

39
"id": 120345,

40
"duration": 7474422,

41
"bitrate": 3623,

42
"width": 1920,

43
"height": 804,

44
"aspectRatio": 2.35,

45
"audioChannels": 6,

46
"audioCodec": "ac3",

47
"videoCodec": "h264",

48
"videoResolution": 1080,

49
"container": "mp4",

50
"videoFrameRate": "24p",

51
"optimizedForStreaming": 0,

52
"has64bitOffsets": false,

53
"videoProfile": "high",

54
"Part": [

55
{

56
"id": 120353,

57
"key": "/library/parts/120353/1681803203/file.mp4",

58
"duration": 7474422,

59
"file": "/movies/Ant-Man and the Wasp Quantumania
(2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4",

60
"size": 3395307162,

61
"container": "mp4",

62
"has64bitOffsets": false,

63
"hasThumbnail": 1,

64
"optimizedForStreaming": false,

65
"videoProfile": "high"

66
}

67
]

68
}

69
],

70
"Genre": [

71
{

72
"tag": "Comedy"

73
}

74
],

75
"Director": [

76
{

77
"tag": "Peyton Reed"

78
}

79
],

80
"Writer": [

81
{

82
"tag": "Jeff Loveness"

83
}

84
],

85
"Country": [

86
{

87
"tag": "United States of America"

88
}

89
],

90
"Role": [

91
{

92
"tag": "Paul Rudd"

93
}

94
]

95
}

96
]

97
}

98
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET LIBRARIES

#

A library section (commonly referred to as just a library) is a collection of
media. Libraries are typed, and depending on their type provide either a flat or
a hierarchical view of the media. For example, a music library has an artist >
albums > tracks structure, whereas a movie library is flat.

Libraries have features beyond just being a collection of media; for starters,
they include information about supported types, filters and sorts. This allows a
client to provide a rich interface around the media (e.g. allow sorting movies
by release year).


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETLIBRARIESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetLibraries.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.library.get_libraries()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


DELETE LIBRARY

#

Delate a library using a specific section


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query


Example: 1000


RESPONSE

#
Python


OPERATIONS.DELETELIBRARYRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

DeleteLibrary.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.delete_library(section_id=1000)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET LIBRARY

#

Returns details for the library. This can be thought of as an interstitial
endpoint because it contains information about the library, rather than content
itself. These details are:

 * A list of Directory objects: These used to be used by clients to build a
   menuing system. There are four flavors of directory found here:
   * Primary: (e.g. all, On Deck) These are still used in some clients to
     provide "shortcuts" to subsets of media. However, with the exception of On
     Deck, all of them can be created by media queries, and the desire is to
     allow these to be customized by users.
   * Secondary: These are marked with secondary="1" and were used by old clients
     to provide nested menus allowing for primative (but structured) navigation.
   * Special: There is a By Folder entry which allows browsing the media by the
     underlying filesystem structure, and there's a completely obsolete entry
     marked search="1" which used to be used to allow clients to build search
     dialogs on the fly.
 * A list of Type objects: These represent the types of things found in this
   library, and for each one, a list of Filter and Sort objects. These can be
   used to build rich controls around a grid of media to allow filtering and
   organizing. Note that these filters and sorts are optional, and without them,
   the client won't render any filtering controls. The Type object contains:
   * key: This provides the root endpoint returning the actual media list for
     the type.
   * type: This is the metadata type for the type (if a standard Plex type).
   * title: The title for for the content of this type (e.g. "Movies").
 * Each Filter object contains a description of the filter. Note that it is not
   an exhaustive list of the full media query language, but an inportant subset
   useful for top-level API.
   * filter: This represents the filter name used for the filter, which can be
     used to construct complex media queries with.
   * filterType: This is either string, integer, or boolean, and describes the
     type of values used for the filter.
   * key: This provides the endpoint where the possible range of values for the
     filter can be retrieved (e.g. for a "Genre" filter, it returns a list of
     all the genres in the library). This will include a type argument that
     matches the metadata type of the Type element.
   * title: The title for the filter.
 * Each Sort object contains a description of the sort field.
   * defaultDirection: Can be either asc or desc, and specifies the default
     direction for the sort field (e.g. titles default to alphabetically
     ascending).
   * descKey and key: Contains the parameters passed to the sort=... media query
     for each direction of the sort.
   * title: The title of the field.


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query


Example: 1000

--------------------------------------------------------------------------------

INCLUDE_DETAILS OPTIONAL[FLOAT]

Whether or not to include details for a section (types, filters, and sorts).
Only exists for backwards compatibility, media providers other than the server
libraries have it on always.


RESPONSE

#
Python


OPERATIONS.GETLIBRARYRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetLibrary.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_library(section_id=1000, include_details=9636.63)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET LIBRARY ITEMS

#

This endpoint will return a list of library items filtered by the filter and
type provided


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query

--------------------------------------------------------------------------------

TYPE OPTIONAL[FLOAT]

item type

--------------------------------------------------------------------------------

FILTER OPTIONAL[STR]

the filter parameter


RESPONSE

#
Python


OPERATIONS.GETLIBRARYITEMSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetLibraryItems.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_library_items(section_id=2726.56, type=3834.41,
filter='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


REFRESH LIBRARY

#

This endpoint Refreshes the library.


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to refresh


RESPONSE

#
Python


OPERATIONS.REFRESHLIBRARYRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

RefreshLibrary.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.refresh_library(section_id=4776.65)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET LATEST LIBRARY ITEMS

#

This endpoint will return a list of the latest library items filtered by the
filter and type provided


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query

--------------------------------------------------------------------------------

TYPE FLOAT

item type

--------------------------------------------------------------------------------

FILTER OPTIONAL[STR]

the filter parameter


RESPONSE

#
Python


OPERATIONS.GETLATESTLIBRARYITEMSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetLatestLibraryItems.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_latest_library_items(section_id=7917.25, type=8121.69,
filter='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET COMMON LIBRARY ITEMS

#

Represents a "Common" item. It contains only the common attributes of the items
selected by the provided filter


PARAMETERS

#
Python


SECTION_ID FLOAT

the Id of the library to query

--------------------------------------------------------------------------------

TYPE FLOAT

item type

--------------------------------------------------------------------------------

FILTER OPTIONAL[STR]

the filter parameter


RESPONSE

#
Python


OPERATIONS.GETCOMMONLIBRARYITEMSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetCommonLibraryItems.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_common_library_items(section_id=5288.95, type=4799.77,
filter='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET METADATA

#

This endpoint will return the metadata of a library item specified with the
ratingKey.


PARAMETERS

#
Python


RATING_KEY FLOAT

the id of the library item to return the children of.


RESPONSE

#
Python


OPERATIONS.GETMETADATARESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetMetadata.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_metadata(rating_key=5680.45)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET METADATA CHILDREN

#

This endpoint will return the children of of a library item specified with the
ratingKey.


PARAMETERS

#
Python


RATING_KEY FLOAT

the id of the library item to return the children of.


RESPONSE

#
Python


OPERATIONS.GETMETADATACHILDRENRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetMetadataChildren.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.library.get_metadata_children(rating_key=3927.85)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LIBRARY


GET ON DECK

#

This endpoint will return the on deck content.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETONDECKRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETONDECKRESPONSEBODY]

The on Deck content

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETONDECKMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetOnDeck.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.library.get_on_deck()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 16,

4
"allowSync": false,

5
"identifier": "com.plexapp.plugins.library",

6
"mediaTagPrefix": "/system/bundle/media/flags/",

7
"mediaTagVersion": 1680021154,

8
"mixedParents": false,

9
"Metadata": [

10
{

11
"allowSync": false,

12
"librarySectionID": 2,

13
"librarySectionTitle": "TV Shows",

14
"librarySectionUUID": "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd",

15
"ratingKey": 49564,

16
"key": "/library/metadata/49564",

17
"parentRatingKey": 49557,

18
"grandparentRatingKey": 49556,

19
"guid": "plex://episode/5ea7d7402e7ab10042e74d4f",

20
"parentGuid": "plex://season/602e754d67f4c8002ce54b3d",

21
"grandparentGuid": "plex://show/5d9c090e705e7a001e6e94d8",

22
"type": "episode",

23
"title": "Circus",

24
"grandparentKey": "/library/metadata/49556",

25
"parentKey": "/library/metadata/49557",

26
"librarySectionKey": "/library/sections/2",

27
"grandparentTitle": "Bluey (2018)",

28
"parentTitle": "Season 2",

29
"contentRating": "TV-Y",

30
"summary": "Bluey is the ringmaster in a game of circus with her friends but
Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution
to keep everyone happy.",

31
"index": 33,

32
"parentIndex": 2,

33
"lastViewedAt": 1681908352,

34
"year": 2018,

35
"thumb": "/library/metadata/49564/thumb/1654258204",

36
"art": "/library/metadata/49556/art/1680939546",

37
"parentThumb": "/library/metadata/49557/thumb/1654258204",

38
"grandparentThumb": "/library/metadata/49556/thumb/1680939546",

39
"grandparentArt": "/library/metadata/49556/art/1680939546",

40
"grandparentTheme": "/library/metadata/49556/theme/1680939546",

41
"duration": 420080,

42
"originallyAvailableAt": "2020-10-31T00:00:00.000Z",

43
"addedAt": 1654258196,

44
"updatedAt": 1654258204,

45
"Media": [

46
{

47
"id": 80994,

48
"duration": 420080,

49
"bitrate": 1046,

50
"width": 1920,

51
"height": 1080,

52
"aspectRatio": 1.78,

53
"audioChannels": 2,

54
"audioCodec": "aac",

55
"videoCodec": "hevc",

56
"videoResolution": "1080",

57
"container": "mkv",

58
"videoFrameRate": "PAL",

59
"audioProfile": "lc",

60
"videoProfile": "main",

61
"Part": [

62
{

63
"id": 80994,

64
"key": "/library/parts/80994/1655007810/file.mkv",

65
"duration": 420080,

66
"file": "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv",

67
"size": 55148931,

68
"audioProfile": "lc",

69
"container": "mkv",

70
"videoProfile": "main",

71
"Stream": [

72
{

73
"id": 211234,

74
"streamType": 1,

75
"default": false,

76
"codec": "hevc",

77
"index": 0,

78
"bitrate": 918,

79
"language": "English",

80
"languageTag": "en",

81
"languageCode": "eng",

82
"bitDepth": 8,

83
"chromaLocation": "left",

84
"chromaSubsampling": "4:2:0",

85
"codedHeight": 1080,

86
"codedWidth": 1920,

87
"colorRange": "tv",

88
"frameRate": 25,

89
"height": 1080,

90
"level": 120,

91
"profile": "main",

92
"refFrames": 1,

93
"width": 1920,

94
"displayTitle": "1080p (HEVC Main)",

95
"extendedDisplayTitle": "1080p (HEVC Main)"

96
}

97
]

98
}

99
]

100
}

101
],

102
"Guids": [

103
{

104
"id": "imdb://tt13303712"

105
}

106
]

107
}

108
]

109
}

110
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------


LOG

#

Submit logs to the Log Handler for Plex Media Server


AVAILABLE OPERATIONS

#
 * Log Line - Logging a single line message.
 * Log Multi Line - Logging a multi-line message
 * Enable Paper Trail - Enabling Papertrail

--------------------------------------------------------------------------------

LOG


LOG LINE

#

This endpoint will write a single-line log message, including a level and source
to the main Plex Media Server log.


PARAMETERS

#
Python


LEVEL FLOAT

An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info 3: Debug
4: Verbose

--------------------------------------------------------------------------------

MESSAGE STR

The text of the message to write to the log.

--------------------------------------------------------------------------------

SOURCE STR

a string indicating the source of the message.


RESPONSE

#
Python


OPERATIONS.LOGLINERESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

LogLine.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.log.log_line(level=9255.97, message='string', source='string')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LOG


LOG MULTI LINE

#

This endpoint will write multiple lines to the main Plex Media Server log in a
single request. It takes a set of query strings as would normally sent to the
above GET endpoint as a linefeed-separated block of POST data. The parameters
for each query string match as above.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.LOGMULTILINERESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

LogMultiLine.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.log.log_multi_line()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

LOG


ENABLE PAPER TRAIL

#

This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail
networked logging site for a period of time.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.ENABLEPAPERTRAILRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

EnablePaperTrail.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.log.enable_paper_trail()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


PLAYLISTS

#

Playlists are ordered collections of media. They can be dumb (just a list of
media) or smart (based on a media query, such as "all albums from 2017"). They
can be organized in (optionally nesting) folders. Retrieving a playlist, or its
items, will trigger a refresh of its metadata. This may cause the duration and
number of items to change.


AVAILABLE OPERATIONS

#
 * Create Playlist - Create a Playlist
 * Get Playlists - Get All Playlists
 * Delete Playlist - Deletes a Playlist
 * Get Playlist - Retrieve Playlist
 * Update Playlist - Update a Playlist
 * Clear Playlist Contents - Delete Playlist Contents
 * Get Playlist Contents - Retrieve Playlist Contents
 * Add Playlist Contents - Adding to a Playlist
 * Upload Playlist - Upload Playlist

--------------------------------------------------------------------------------

PLAYLISTS


CREATE PLAYLIST

#

Create a new playlist. By default the playlist is blank. To create a playlist
along with a first item, pass:

 * uri - The content URI for what we're playing (e.g. library://...).
 * playQueueID - To create a playlist from an existing play queue.


PARAMETERS

#
Python


REQUEST OPERATIONS.CREATEPLAYLISTREQUEST

The request object to use for the request.

SHOW CHILD PROPERTIES

TITLE STR

name of the playlist

--------------------------------------------------------------------------------

TYPE OPERATIONS.TYPE

type of playlist to create

SHOW CHILD PROPERTIES



--------------------------------------------------------------------------------

SMART FLOAT

whether the playlist is smart or not

--------------------------------------------------------------------------------

URI OPTIONAL[STR]

the content URI for the playlist

--------------------------------------------------------------------------------

PLAY_QUEUE_ID OPTIONAL[FLOAT]

the play queue to copy to a playlist


RESPONSE

#
Python


OPERATIONS.CREATEPLAYLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

CreatePlaylist.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8
req = operations.CreatePlaylistRequest(

9
title='string',

10
type=operations.Type.PHOTO,

11
smart=710.36,

12
)

13


14
res = s.playlists.create_playlist(req)

15


16
if res.status_code == 200:

17
# handle response

18
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


GET PLAYLISTS

#

Get All Playlists given the specified filters.


PARAMETERS

#
Python


PLAYLIST_TYPE OPTIONAL[OPERATIONS.PLAYLISTTYPE]

limit to a type of playlist.

SHOW CHILD PROPERTIES

NameValueAUDIOaudioVIDEOvideoPHOTOphoto

--------------------------------------------------------------------------------

SMART OPTIONAL[FLOAT]

type of playlists to return (default is all).


RESPONSE

#
Python


OPERATIONS.GETPLAYLISTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetPlaylists.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.get_playlists(playlist_type=operations.PlaylistType.VIDEO,
smart=871.29)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


DELETE PLAYLIST

#

This endpoint will delete a playlist


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist


RESPONSE

#
Python


OPERATIONS.DELETEPLAYLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

DeletePlaylist.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.delete_playlist(playlist_id=6481.72)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


GET PLAYLIST

#

Gets detailed metadata for a playlist. A playlist for many purposes (rating,
editing metadata, tagging), can be treated like a regular metadata item: Smart
playlist details contain the content attribute. This is the content URI for the
generator. This can then be parsed by a client to provide smart playlist
editing.


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist


RESPONSE

#
Python


OPERATIONS.GETPLAYLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetPlaylist.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.get_playlist(playlist_id=202.18)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


UPDATE PLAYLIST

#

From PMS version 1.9.1 clients can also edit playlist metadata using this
endpoint as they would via PUT /library/metadata/\{playlistID\}


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist


RESPONSE

#
Python


OPERATIONS.UPDATEPLAYLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

UpdatePlaylist.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.update_playlist(playlist_id=3682.41)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


CLEAR PLAYLIST CONTENTS

#

Clears a playlist, only works with dumb playlists. Returns the playlist.


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist


RESPONSE

#
Python


OPERATIONS.CLEARPLAYLISTCONTENTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

ClearPlaylistContents.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.clear_playlist_contents(playlist_id=8326.2)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


GET PLAYLIST CONTENTS

#

Gets the contents of a playlist. Should be paged by clients via standard
mechanisms. By default leaves are returned (e.g. episodes, movies). In order to
return other types you can use the type parameter. For example, you could use
this to display a list of recently added albums vis a smart playlist. Note that
for dumb playlists, items have a playlistItemID attribute which is used for
deleting or moving items.


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist

--------------------------------------------------------------------------------

TYPE FLOAT

the metadata type of the item to return


RESPONSE

#
Python


OPERATIONS.GETPLAYLISTCONTENTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetPlaylistContents.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.get_playlist_contents(playlist_id=9571.56, type=7781.57)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


ADD PLAYLIST CONTENTS

#

Adds a generator to a playlist, same parameters as the POST above. With a dumb
playlist, this adds the specified items to the playlist. With a smart playlist,
passing a new uri parameter replaces the rules for the playlist. Returns the
playlist.


PARAMETERS

#
Python


PLAYLIST_ID FLOAT

the ID of the playlist

--------------------------------------------------------------------------------

URI STR

the content URI for the playlist


Example: library://..

--------------------------------------------------------------------------------

PLAY_QUEUE_ID FLOAT

the play queue to add to a playlist


Example: 123


RESPONSE

#
Python


OPERATIONS.ADDPLAYLISTCONTENTSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

AddPlaylistContents.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.add_playlist_contents(playlist_id=1403.5, uri='library://..',
play_queue_id=123)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

PLAYLISTS


UPLOAD PLAYLIST

#

Imports m3u playlists by passing a path on the server to scan for m3u-formatted
playlist files, or a path to a single playlist file.


PARAMETERS

#
Python


PATH STR

absolute path to a directory on the server where m3u files are stored, or the
absolute path to a playlist file on the server. If the path argument is a
directory, that path will be scanned for playlist files to be processed. Each
file in that directory creates a separate playlist, with a name based on the
filename of the file that created it. The GUID of each playlist is based on the
filename. If the path argument is a file, that file will be used to create a new
playlist, with the name based on the filename of the file that created it. The
GUID of each playlist is based on the filename.


Example: /home/barkley/playlist.m3u

--------------------------------------------------------------------------------

FORCE FLOAT

force overwriting of duplicate playlists. By default, a playlist file uploaded
with the same path will overwrite the existing playlist. The force argument is
used to disable overwriting. If the force argument is set to 0, a new playlist
will be created suffixed with the date and time that the duplicate was uploaded.


RESPONSE

#
Python


OPERATIONS.UPLOADPLAYLISTRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

UploadPlaylist.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.playlists.upload_playlist(path='/home/barkley/playlist.m3u',
force=8700.13)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


SECURITY

#

API Calls against Security for Plex Media Server


AVAILABLE OPERATIONS

#
 * Get Transient Token - Get a Transient Token.
 * Get Source Connection Information - Get Source Connection Information

--------------------------------------------------------------------------------

SECURITY


GET TRANSIENT TOKEN

#

This endpoint provides the caller with a temporary token with the same access
level as the caller's token. These tokens are valid for up to 48 hours and are
destroyed if the server instance is restarted.


PARAMETERS

#
Python


TYPE OPERATIONS.QUERYPARAMTYPE

delegation - This is the only supported type parameter.

SHOW CHILD PROPERTIES

NameValueDELEGATIONdelegation

--------------------------------------------------------------------------------

SCOPE OPERATIONS.SCOPE

all - This is the only supported scope parameter.

SHOW CHILD PROPERTIES

NameValueALLall


RESPONSE

#
Python


OPERATIONS.GETTRANSIENTTOKENRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetTransientToken.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.security.get_transient_token(type=operations.QueryParamType.DELEGATION,
scope=operations.Scope.ALL)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SECURITY


GET SOURCE CONNECTION INFORMATION

#

If a caller requires connection details and a transient token for a source that
is known to the server, for example a cloud media provider or shared PMS, then
this endpoint can be called. This endpoint is only accessible with either an
admin token or a valid transient token generated from an admin token. Note:
requires Plex Media Server >= 1.15.4.


PARAMETERS

#
Python


SOURCE STR

The source identifier with an included prefix.


Example: server://client-identifier


RESPONSE

#
Python


OPERATIONS.GETSOURCECONNECTIONINFORMATIONRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetSourceConnectionInformation.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res =
s.security.get_source_connection_information(source='provider://provider-identifier')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


SESSIONS

#

API Calls that perform search operations with Plex Media Server Sessions


AVAILABLE OPERATIONS

#
 * Get Sessions - Get Active Sessions
 * Get Session History - Get Session History
 * Get Transcode Sessions - Get Transcode Sessions
 * Stop Transcode Session - Stop a Transcode Session

--------------------------------------------------------------------------------

SESSIONS


GET SESSIONS

#

This will retrieve the "Now Playing" Information of the PMS.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSESSIONSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetSessions.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.sessions.get_sessions()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SESSIONS


GET SESSION HISTORY

#

This will Retrieve a listing of all history views.


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETSESSIONHISTORYRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetSessionHistory.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.sessions.get_session_history()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

SESSIONS


GET TRANSCODE SESSIONS

#

Get Transcode Sessions


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETTRANSCODESESSIONSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

--------------------------------------------------------------------------------

OBJECT OPTIONAL[OPERATIONS.GETTRANSCODESESSIONSRESPONSEBODY]

The Transcode Sessions

SHOW CHILD PROPERTIES

MEDIA_CONTAINER OPTIONAL[OPERATIONS.GETTRANSCODESESSIONSMEDIACONTAINER]

SHOW CHILD PROPERTIES


GetTranscodeSessions.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.sessions.get_transcode_sessions()

9


10
if res.object is not None:

11
# handle response

12
pass


Example Response

1
{

2
"MediaContainer": {

3
"size": 1,

4
"TranscodeSession": [

5
{

6
"key": "zz7llzqlx8w9vnrsbnwhbmep",

7
"throttled": false,

8
"complete": false,

9
"progress": 0.4000000059604645,

10
"size": -22,

11
"speed": 22.399999618530273,

12
"error": false,

13
"duration": 2561768,

14
"context": "streaming",

15
"sourceVideoCodec": "h264",

16
"sourceAudioCodec": "ac3",

17
"videoDecision": "transcode",

18
"audioDecision": "transcode",

19
"protocol": "http",

20
"container": "mkv",

21
"videoCodec": "h264",

22
"audioCodec": "opus",

23
"audioChannels": 2,

24
"transcodeHwRequested": false,

25
"timeStamp": 1681869535.7764285,

26
"maxOffsetAvailable": 861.778,

27
"minOffsetAvailable": 0

28
}

29
]

30
}

31
}


Status 200
Content-Type application/json

--------------------------------------------------------------------------------

SESSIONS


STOP TRANSCODE SESSION

#

Stop a Transcode Session


PARAMETERS

#
Python


SESSION_KEY STR

the Key of the transcode session to stop


Example: zz7llzqlx8w9vnrsbnwhbmep


RESPONSE

#
Python


OPERATIONS.STOPTRANSCODESESSIONRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StopTranscodeSession.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.sessions.stop_transcode_session(session_key='zz7llzqlx8w9vnrsbnwhbmep')

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


UPDATER

#

This describes the API for searching and applying updates to the Plex Media
Server. Updates to the status can be observed via the Event API.


AVAILABLE OPERATIONS

#
 * Get Update Status - Querying status of updates
 * Check For Updates - Checking for updates
 * Apply Updates - Apply Updates

--------------------------------------------------------------------------------

UPDATER


GET UPDATE STATUS

#

Querying status of updates


PARAMETERS

#
Python




RESPONSE

#
Python


OPERATIONS.GETUPDATESTATUSRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetUpdateStatus.py

1
import plex

2


3
s = plex.Plex(

4
access_token="",

5
)

6


7


8
res = s.updater.get_update_status()

9


10
if res.status_code == 200:

11
# handle response

12
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

UPDATER


CHECK FOR UPDATES

#

Checking for updates


PARAMETERS

#
Python


DOWNLOAD OPTIONAL[OPERATIONS.DOWNLOAD]

Indicate that you want to start download any updates found.

SHOW CHILD PROPERTIES

NameValueZERO0ONE1


RESPONSE

#
Python


OPERATIONS.CHECKFORUPDATESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

CheckForUpdates.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.updater.check_for_updates(download=operations.Download.ONE)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

UPDATER


APPLY UPDATES

#

Note that these two parameters are effectively mutually exclusive. The tonight
parameter takes precedence and skip will be ignored if tonight is also passed


PARAMETERS

#
Python


TONIGHT OPTIONAL[OPERATIONS.TONIGHT]

Indicate that you want the update to run during the next Butler execution.
Omitting this or setting it to false indicates that the update should install

SHOW CHILD PROPERTIES

NameValueZERO0ONE1

--------------------------------------------------------------------------------

SKIP OPTIONAL[OPERATIONS.SKIP]

Indicate that the latest version should be marked as skipped. The <Release>
entry for this version will have the state set to skipped.

SHOW CHILD PROPERTIES

NameValueZERO0ONE1


RESPONSE

#
Python


OPERATIONS.APPLYUPDATESRESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

ApplyUpdates.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8


9
res = s.updater.apply_updates(tonight=operations.Tonight.ZERO,
skip=operations.Skip.ONE)

10


11
if res.status_code == 200:

12
# handle response

13
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------


VIDEO

#

API Calls that perform operations with Plex Media Server Videos


AVAILABLE OPERATIONS

#
 * Start Universal Transcode - Start Universal Transcode
 * Get Timeline - Get the timeline for a media item

--------------------------------------------------------------------------------

VIDEO


START UNIVERSAL TRANSCODE

#

Begin a Universal Transcode Session


PARAMETERS

#
Python


REQUEST OPERATIONS.STARTUNIVERSALTRANSCODEREQUEST

The request object to use for the request.

SHOW CHILD PROPERTIES

HAS_MDE FLOAT

Whether the media item has MDE

--------------------------------------------------------------------------------

PATH STR

The path to the media item to transcode

--------------------------------------------------------------------------------

MEDIA_INDEX FLOAT

The index of the media item to transcode

--------------------------------------------------------------------------------

PART_INDEX FLOAT

The index of the part to transcode

--------------------------------------------------------------------------------

PROTOCOL STR

The protocol to use for the transcode session

--------------------------------------------------------------------------------

FAST_SEEK OPTIONAL[FLOAT]

Whether to use fast seek or not

--------------------------------------------------------------------------------

DIRECT_PLAY OPTIONAL[FLOAT]

Whether to use direct play or not

--------------------------------------------------------------------------------

DIRECT_STREAM OPTIONAL[FLOAT]

Whether to use direct stream or not

--------------------------------------------------------------------------------

SUBTITLE_SIZE OPTIONAL[FLOAT]

The size of the subtitles

--------------------------------------------------------------------------------

SUBTITES OPTIONAL[STR]

The subtitles

--------------------------------------------------------------------------------

AUDIO_BOOST OPTIONAL[FLOAT]

The audio boost

--------------------------------------------------------------------------------

LOCATION OPTIONAL[STR]

The location of the transcode session

--------------------------------------------------------------------------------

MEDIA_BUFFER_SIZE OPTIONAL[FLOAT]

The size of the media buffer

--------------------------------------------------------------------------------

SESSION OPTIONAL[STR]

The session ID

--------------------------------------------------------------------------------

ADD_DEBUG_OVERLAY OPTIONAL[FLOAT]

Whether to add a debug overlay or not

--------------------------------------------------------------------------------

AUTO_ADJUST_QUALITY OPTIONAL[FLOAT]

Whether to auto adjust quality or not


RESPONSE

#
Python


OPERATIONS.STARTUNIVERSALTRANSCODERESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

StartUniversalTranscode.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8
req = operations.StartUniversalTranscodeRequest(

9
has_mde=8009.11,

10
path='/private',

11
media_index=5204.78,

12
part_index=7805.29,

13
protocol='string',

14
)

15


16
res = s.video.start_universal_transcode(req)

17


18
if res.status_code == 200:

19
# handle response

20
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json

--------------------------------------------------------------------------------

VIDEO


GET TIMELINE

#

Get the timeline for a media item


PARAMETERS

#
Python


REQUEST OPERATIONS.GETTIMELINEREQUEST

The request object to use for the request.

SHOW CHILD PROPERTIES

RATING_KEY FLOAT

The rating key of the media item

--------------------------------------------------------------------------------

KEY STR

The key of the media item to get the timeline for

--------------------------------------------------------------------------------

STATE OPERATIONS.STATE

The state of the media item

SHOW CHILD PROPERTIES



--------------------------------------------------------------------------------

HAS_MDE FLOAT

Whether the media item has MDE

--------------------------------------------------------------------------------

TIME FLOAT

The time of the media item

--------------------------------------------------------------------------------

DURATION FLOAT

The duration of the media item

--------------------------------------------------------------------------------

CONTEXT STR

The context of the media item

--------------------------------------------------------------------------------

PLAY_QUEUE_ITEM_ID FLOAT

The play queue item ID of the media item

--------------------------------------------------------------------------------

PLAY_BACK_TIME FLOAT

The playback time of the media item

--------------------------------------------------------------------------------

ROW FLOAT

The row of the media item


RESPONSE

#
Python


OPERATIONS.GETTIMELINERESPONSE

HIDE CHILD PROPERTIES

CONTENT_TYPE STR

HTTP response content type for this operation

--------------------------------------------------------------------------------

STATUS_CODE INT

HTTP response status code for this operation

--------------------------------------------------------------------------------

RAW_RESPONSE REQUESTS.RESPONSE

Raw HTTP response; suitable for custom response parsing

GetTimeline.py

1
import plex

2
from plex.models import operations

3


4
s = plex.Plex(

5
access_token="",

6
)

7


8
req = operations.GetTimelineRequest(

9
rating_key=6788.8,

10
key='<key>',

11
state=operations.State.PLAYING,

12
has_mde=7206.33,

13
time=6399.21,

14
duration=5820.2,

15
context='string',

16
play_queue_item_id=1433.53,

17
play_back_time=5373.73,

18
row=9446.69,

19
)

20


21
res = s.video.get_timeline(req)

22


23
if res.status_code == 200:

24
# handle response

25
pass


Example Response

1
{

2
"errors": [

3
{

4
"code": 1001,

5
"message": "User could not be authenticated",

6
"status": 401

7
}

8
]

9
}


Status 401
Content-Type application/json


Built by Speakeasy