Index

API and SDK reference

Installation


_10
pip install git+<UNSET>.git


Server

Operations against the Plex Media Server System.

Available Operations


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
GetServerCapabilities.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_server_capabilities()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_61
{
_61
"MediaContainer": {
_61
"size": 5488.14,
_61
"allowCameraUpload": false,
_61
"allowChannelAccess": false,
_61
"allowMediaDeletion": false,
_61
"allowSharing": false,
_61
"allowSync": false,
_61
"allowTuners": false,
_61
"backgroundProcessing": false,
_61
"certificate": false,
_61
"companionProxy": false,
_61
"countryCode": "string",
_61
"diagnostics": "string",
_61
"eventStream": false,
_61
"friendlyName": "string",
_61
"hubSearch": false,
_61
"itemClusters": false,
_61
"livetv": 5928.45,
_61
"machineIdentifier": "string",
_61
"mediaProviders": false,
_61
"multiuser": false,
_61
"musicAnalysis": 7151.9,
_61
"myPlex": false,
_61
"myPlexMappingState": "string",
_61
"myPlexSigninState": "string",
_61
"myPlexSubscription": false,
_61
"myPlexUsername": "string",
_61
"offlineTranscode": 8442.66,
_61
"ownerFeatures": "string",
_61
"photoAutoTag": false,
_61
"platform": "string",
_61
"platformVersion": "string",
_61
"pluginHost": false,
_61
"pushNotifications": false,
_61
"readOnlyLibraries": false,
_61
"streamingBrainABRVersion": 6027.63,
_61
"streamingBrainVersion": 8579.46,
_61
"sync": false,
_61
"transcoderActiveVideoSessions": 5448.83,
_61
"transcoderAudio": false,
_61
"transcoderLyrics": false,
_61
"transcoderPhoto": false,
_61
"transcoderSubtitles": false,
_61
"transcoderVideo": false,
_61
"transcoderVideoBitrates": "string",
_61
"transcoderVideoQualities": "string",
_61
"transcoderVideoResolutions": "string",
_61
"updatedAt": 8472.52,
_61
"updater": false,
_61
"version": "string",
_61
"voiceSearch": false,
_61
"Directory": [
_61
{
_61
"count": 4236.55,
_61
"key": "string",
_61
"title": "string"
_61
}
_61
]
_61
}
_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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_server_preferences()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetAvailableClients.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_available_clients()
_12
_12
if res.classes is not None:
_12
# handle response
_12
pass

Example Response

_22
[
_22
{
_22
"MediaContainer": {
_22
"size": 1,
_22
"Server": [
_22
{
_22
"name": "iPad",
_22
"host": "10.10.10.102",
_22
"address": "10.10.10.102",
_22
"port": 32500,
_22
"machineIdentifier": "A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05",
_22
"version": "8.17",
_22
"protocol": "plex",
_22
"product": "Plex for iOS",
_22
"deviceClass": "tablet",
_22
"protocolVersion": 2,
_22
"protocolCapabilities": "playback,playqueues,timeline,provider-playback"
_22
}
_22
]
_22
}
_22
}
_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
GetDevices.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_devices()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_15
{
_15
"MediaContainer": {
_15
"size": 151,
_15
"identifier": "com.plexapp.system.devices",
_15
"Device": [
_15
{
_15
"id": 1,
_15
"name": "iPhone",
_15
"platform": "iOS",
_15
"clientIdentifier": "string",
_15
"createdAt": 1654131230
_15
}
_15
]
_15
}
_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
GetServerIdentity.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_server_identity()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"MediaContainer": {
_10
"size": 0,
_10
"claimed": false,
_10
"machineIdentifier": "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4",
_10
"version": "1.31.3.6868-28fc46b27"
_10
}
_10
}

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
GetMyPlexAccount.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_my_plex_account()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_16
{
_16
"MyPlex": {
_16
"authToken": "Z5v-PrNASDFpsaCi3CPK7",
_16
"username": "example.email@mail.com",
_16
"mappingState": "mapped",
_16
"mappingError": "string",
_16
"signInState": "ok",
_16
"publicAddress": "140.20.68.140",
_16
"publicPort": 32400,
_16
"privateAddress": "10.10.10.47",
_16
"privatePort": 32400,
_16
"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",
_16
"subscriptionActive": false,
_16
"subscriptionState": "Active"
_16
}
_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

_22
import plex
_22
from plex.models import operations
_22
_22
s = plex.Plex(
_22
access_token="",
_22
)
_22
_22
req = operations.GetResizedPhotoRequest(
_22
width=110,
_22
height=165,
_22
opacity=548814,
_22
blur=20,
_22
min_size=7151.9,
_22
upscale=8442.66,
_22
url='/library/metadata/49564/thumb/1654258204',
_22
)
_22
_22
res = s.server.get_resized_photo(req)
_22
_22
if res.status_code == 200:
_22
# handle response
_22
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetServerList.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.server.get_server_list()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_15
{
_15
"MediaContainer": {
_15
"size": 1,
_15
"Server": [
_15
{
_15
"name": "Hera",
_15
"host": "10.10.10.47",
_15
"address": "10.10.10.47",
_15
"port": 32400,
_15
"machineIdentifier": "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4",
_15
"version": "1.31.3.6868-28fc46b27"
_15
}
_15
]
_15
}
_15
}

Status 200
Content-Type application/json

Media

API Calls interacting with Plex Media Server Media

Available Operations


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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.media.mark_played(key=59398)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.media.mark_unplayed(key=59398)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.media.update_play_progress(key='string', time=6027.63, state='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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


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
GetServerActivities.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.activities.get_server_activities()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_19
{
_19
"MediaContainer": {
_19
"size": 6235.64,
_19
"Activity": [
_19
{
_19
"uuid": "string",
_19
"type": "string",
_19
"cancellable": false,
_19
"userID": 6458.94,
_19
"title": "string",
_19
"subtitle": "string",
_19
"progress": 3843.82,
_19
"Context": {
_19
"librarySectionID": "string"
_19
}
_19
}
_19
]
_19
}
_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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.activities.cancel_server_activities(activity_uuid='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Butler

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

Available Operations


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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.butler.stop_all_tasks()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetButlerTasks.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.butler.get_butler_tasks()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_14
{
_14
"ButlerTasks": {
_14
"ButlerTask": [
_14
{
_14
"name": "BackupDatabase",
_14
"interval": 3,
_14
"scheduleRandomized": false,
_14
"enabled": false,
_14
"title": "Backup Database",
_14
"description": "Create a backup copy of the server's database in the configured backup directory"
_14
}
_14
]
_14
}
_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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.butler.start_all_tasks()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
NameValue
BACKUP_DATABASEBackupDatabase
BUILD_GRACENOTE_COLLECTIONSBuildGracenoteCollections
CHECK_FOR_UPDATESCheckForUpdates
CLEAN_OLD_BUNDLESCleanOldBundles
CLEAN_OLD_CACHE_FILESCleanOldCacheFiles
DEEP_MEDIA_ANALYSISDeepMediaAnalysis
GENERATE_AUTO_TAGSGenerateAutoTags
GENERATE_CHAPTER_THUMBSGenerateChapterThumbs
GENERATE_MEDIA_INDEX_FILESGenerateMediaIndexFiles
OPTIMIZE_DATABASEOptimizeDatabase
REFRESH_LIBRARIESRefreshLibraries
REFRESH_LOCAL_MEDIARefreshLocalMedia
REFRESH_PERIODIC_METADATARefreshPeriodicMetadata
UPGRADE_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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.butler.stop_task(task_name=operations.TaskName.REFRESH_PERIODIC_METADATA)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
NameValue
BACKUP_DATABASEBackupDatabase
BUILD_GRACENOTE_COLLECTIONSBuildGracenoteCollections
CHECK_FOR_UPDATESCheckForUpdates
CLEAN_OLD_BUNDLESCleanOldBundles
CLEAN_OLD_CACHE_FILESCleanOldCacheFiles
DEEP_MEDIA_ANALYSISDeepMediaAnalysis
GENERATE_AUTO_TAGSGenerateAutoTags
GENERATE_CHAPTER_THUMBSGenerateChapterThumbs
GENERATE_MEDIA_INDEX_FILESGenerateMediaIndexFiles
OPTIMIZE_DATABASEOptimizeDatabase
REFRESH_LIBRARIESRefreshLibraries
REFRESH_LOCAL_MEDIARefreshLocalMedia
REFRESH_PERIODIC_METADATARefreshPeriodicMetadata
UPGRADE_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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.butler.start_task(task_name=operations.PathParamTaskName.GENERATE_CHAPTER_THUMBS)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Hubs

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

Available Operations


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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.hubs.get_global_hubs(count=8472.52, only_transient=4236.55)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.hubs.get_library_hubs(section_id=6235.64, count=6458.94, only_transient=3843.82)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Search

API Calls that perform search operations with Plex Media Server

Available Operations


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.

Python

The query term


Example: arnold


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


The number of items to return per hub


Example: 5

Python
Hide child properties

HTTP response content type for this operation


HTTP response status code for this operation


Raw HTTP response; suitable for custom response parsing

PerformSearch.py

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.search.perform_search(query='arnold', section_id=2975.34, limit=5)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

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.

Python

The query term


Example: dead+poop


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


The number of items to return per hub


Example: 5

Python
Hide child properties

HTTP response content type for this operation


HTTP response status code for this operation


Raw HTTP response; suitable for custom response parsing

PerformVoiceSearch.py

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.search.perform_voice_search(query='dead+poop', section_id=8917.73, limit=5)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetSearchResults.py

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.search.get_search_results(query='110')
_13
_13
if res.object is not None:
_13
# handle response
_13
pass

Example Response

_102
{
_102
"MediaContainer": {
_102
"size": 26,
_102
"identifier": "com.plexapp.plugins.library",
_102
"mediaTagPrefix": "/system/bundle/media/flags/",
_102
"mediaTagVersion": 1680021154,
_102
"Metadata": [
_102
{
_102
"allowSync": false,
_102
"librarySectionID": 1,
_102
"librarySectionTitle": "Movies",
_102
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
_102
"personal": false,
_102
"sourceTitle": "Hera",
_102
"ratingKey": 10398,
_102
"key": "/library/metadata/10398",
_102
"guid": "plex://movie/5d7768284de0ee001fcc8f52",
_102
"studio": "Paramount",
_102
"type": "movie",
_102
"title": "Mission: Impossible",
_102
"contentRating": "PG-13",
_102
"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.",
_102
"rating": 6.6,
_102
"audienceRating": 7.1,
_102
"year": 1996,
_102
"tagline": "Expect the impossible.",
_102
"thumb": "/library/metadata/10398/thumb/1679505055",
_102
"art": "/library/metadata/10398/art/1679505055",
_102
"duration": 6612628,
_102
"originallyAvailableAt": "1996-05-22T00:00:00.000Z",
_102
"addedAt": 1589234571,
_102
"updatedAt": 1679505055,
_102
"audienceRatingImage": "rottentomatoes://image.rating.upright",
_102
"chapterSource": "media",
_102
"primaryExtraKey": "/library/metadata/10501",
_102
"ratingImage": "rottentomatoes://image.rating.ripe",
_102
"Media": [
_102
{
_102
"id": 26610,
_102
"duration": 6612628,
_102
"bitrate": 4751,
_102
"width": 1916,
_102
"height": 796,
_102
"aspectRatio": 2.35,
_102
"audioChannels": 6,
_102
"audioCodec": "aac",
_102
"videoCodec": "hevc",
_102
"videoResolution": 1080,
_102
"container": "mkv",
_102
"videoFrameRate": "24p",
_102
"audioProfile": "lc",
_102
"videoProfile": "main 10",
_102
"Part": [
_102
{
_102
"id": 26610,
_102
"key": "/library/parts/26610/1589234571/file.mkv",
_102
"duration": 6612628,
_102
"file": "/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv",
_102
"size": 3926903851,
_102
"audioProfile": "lc",
_102
"container": "mkv",
_102
"videoProfile": "main 10"
_102
}
_102
]
_102
}
_102
],
_102
"Genre": [
_102
{
_102
"tag": "Action"
_102
}
_102
],
_102
"Director": [
_102
{
_102
"tag": "Brian De Palma"
_102
}
_102
],
_102
"Writer": [
_102
{
_102
"tag": "David Koepp"
_102
}
_102
],
_102
"Country": [
_102
{
_102
"tag": "United States of America"
_102
}
_102
],
_102
"Role": [
_102
{
_102
"tag": "Tom Cruise"
_102
}
_102
]
_102
}
_102
],
_102
"Provider": [
_102
{
_102
"key": "/system/search",
_102
"title": "Local Network",
_102
"type": "mixed"
_102
}
_102
]
_102
}
_102
}

Status 200
Content-Type application/json

Library

API Calls interacting with Plex Media Server Libraries

Available Operations


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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_file_hash(url='file://C:\Image.png&type=13', type=567.13)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetRecentlyAdded.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.library.get_recently_added()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_98
{
_98
"MediaContainer": {
_98
"size": 50,
_98
"allowSync": false,
_98
"identifier": "com.plexapp.plugins.library",
_98
"mediaTagPrefix": "/system/bundle/media/flags/",
_98
"mediaTagVersion": 1680021154,
_98
"mixedParents": false,
_98
"Metadata": [
_98
{
_98
"allowSync": false,
_98
"librarySectionID": 1,
_98
"librarySectionTitle": "Movies",
_98
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
_98
"ratingKey": 59398,
_98
"key": "/library/metadata/59398",
_98
"guid": "plex://movie/5e161a83bea6ac004126e148",
_98
"studio": "Marvel Studios",
_98
"type": "movie",
_98
"title": "Ant-Man and the Wasp: Quantumania",
_98
"contentRating": "PG-13",
_98
"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.",
_98
"rating": 4.7,
_98
"audienceRating": 8.3,
_98
"year": 2023,
_98
"tagline": "Witness the beginning of a new dynasty.",
_98
"thumb": "/library/metadata/59398/thumb/1681888010",
_98
"art": "/library/metadata/59398/art/1681888010",
_98
"duration": 7474422,
_98
"originallyAvailableAt": "2023-02-15T00:00:00.000Z",
_98
"addedAt": 1681803215,
_98
"updatedAt": 1681888010,
_98
"audienceRatingImage": "rottentomatoes://image.rating.upright",
_98
"chapterSource": "media",
_98
"primaryExtraKey": "/library/metadata/59399",
_98
"ratingImage": "rottentomatoes://image.rating.rotten",
_98
"Media": [
_98
{
_98
"id": 120345,
_98
"duration": 7474422,
_98
"bitrate": 3623,
_98
"width": 1920,
_98
"height": 804,
_98
"aspectRatio": 2.35,
_98
"audioChannels": 6,
_98
"audioCodec": "ac3",
_98
"videoCodec": "h264",
_98
"videoResolution": 1080,
_98
"container": "mp4",
_98
"videoFrameRate": "24p",
_98
"optimizedForStreaming": 0,
_98
"has64bitOffsets": false,
_98
"videoProfile": "high",
_98
"Part": [
_98
{
_98
"id": 120353,
_98
"key": "/library/parts/120353/1681803203/file.mp4",
_98
"duration": 7474422,
_98
"file": "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4",
_98
"size": 3395307162,
_98
"container": "mp4",
_98
"has64bitOffsets": false,
_98
"hasThumbnail": 1,
_98
"optimizedForStreaming": false,
_98
"videoProfile": "high"
_98
}
_98
]
_98
}
_98
],
_98
"Genre": [
_98
{
_98
"tag": "Comedy"
_98
}
_98
],
_98
"Director": [
_98
{
_98
"tag": "Peyton Reed"
_98
}
_98
],
_98
"Writer": [
_98
{
_98
"tag": "Jeff Loveness"
_98
}
_98
],
_98
"Country": [
_98
{
_98
"tag": "United States of America"
_98
}
_98
],
_98
"Role": [
_98
{
_98
"tag": "Paul Rudd"
_98
}
_98
]
_98
}
_98
]
_98
}
_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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.library.get_libraries()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.delete_library(section_id=1000)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_library(section_id=1000, include_details=9636.63)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_library_items(section_id=2726.56, type=3834.41, filter='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.refresh_library(section_id=4776.65)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_latest_library_items(section_id=7917.25, type=8121.69, filter='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_common_library_items(section_id=5288.95, type=4799.77, filter='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_metadata(rating_key=5680.45)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.library.get_metadata_children(rating_key=3927.85)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetOnDeck.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.library.get_on_deck()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_110
{
_110
"MediaContainer": {
_110
"size": 16,
_110
"allowSync": false,
_110
"identifier": "com.plexapp.plugins.library",
_110
"mediaTagPrefix": "/system/bundle/media/flags/",
_110
"mediaTagVersion": 1680021154,
_110
"mixedParents": false,
_110
"Metadata": [
_110
{
_110
"allowSync": false,
_110
"librarySectionID": 2,
_110
"librarySectionTitle": "TV Shows",
_110
"librarySectionUUID": "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd",
_110
"ratingKey": 49564,
_110
"key": "/library/metadata/49564",
_110
"parentRatingKey": 49557,
_110
"grandparentRatingKey": 49556,
_110
"guid": "plex://episode/5ea7d7402e7ab10042e74d4f",
_110
"parentGuid": "plex://season/602e754d67f4c8002ce54b3d",
_110
"grandparentGuid": "plex://show/5d9c090e705e7a001e6e94d8",
_110
"type": "episode",
_110
"title": "Circus",
_110
"grandparentKey": "/library/metadata/49556",
_110
"parentKey": "/library/metadata/49557",
_110
"librarySectionKey": "/library/sections/2",
_110
"grandparentTitle": "Bluey (2018)",
_110
"parentTitle": "Season 2",
_110
"contentRating": "TV-Y",
_110
"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.",
_110
"index": 33,
_110
"parentIndex": 2,
_110
"lastViewedAt": 1681908352,
_110
"year": 2018,
_110
"thumb": "/library/metadata/49564/thumb/1654258204",
_110
"art": "/library/metadata/49556/art/1680939546",
_110
"parentThumb": "/library/metadata/49557/thumb/1654258204",
_110
"grandparentThumb": "/library/metadata/49556/thumb/1680939546",
_110
"grandparentArt": "/library/metadata/49556/art/1680939546",
_110
"grandparentTheme": "/library/metadata/49556/theme/1680939546",
_110
"duration": 420080,
_110
"originallyAvailableAt": "2020-10-31T00:00:00.000Z",
_110
"addedAt": 1654258196,
_110
"updatedAt": 1654258204,
_110
"Media": [
_110
{
_110
"id": 80994,
_110
"duration": 420080,
_110
"bitrate": 1046,
_110
"width": 1920,
_110
"height": 1080,
_110
"aspectRatio": 1.78,
_110
"audioChannels": 2,
_110
"audioCodec": "aac",
_110
"videoCodec": "hevc",
_110
"videoResolution": "1080",
_110
"container": "mkv",
_110
"videoFrameRate": "PAL",
_110
"audioProfile": "lc",
_110
"videoProfile": "main",
_110
"Part": [
_110
{
_110
"id": 80994,
_110
"key": "/library/parts/80994/1655007810/file.mkv",
_110
"duration": 420080,
_110
"file": "/tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv",
_110
"size": 55148931,
_110
"audioProfile": "lc",
_110
"container": "mkv",
_110
"videoProfile": "main",
_110
"Stream": [
_110
{
_110
"id": 211234,
_110
"streamType": 1,
_110
"default": false,
_110
"codec": "hevc",
_110
"index": 0,
_110
"bitrate": 918,
_110
"language": "English",
_110
"languageTag": "en",
_110
"languageCode": "eng",
_110
"bitDepth": 8,
_110
"chromaLocation": "left",
_110
"chromaSubsampling": "4:2:0",
_110
"codedHeight": 1080,
_110
"codedWidth": 1920,
_110
"colorRange": "tv",
_110
"frameRate": 25,
_110
"height": 1080,
_110
"level": 120,
_110
"profile": "main",
_110
"refFrames": 1,
_110
"width": 1920,
_110
"displayTitle": "1080p (HEVC Main)",
_110
"extendedDisplayTitle": "1080p (HEVC Main)"
_110
}
_110
]
_110
}
_110
]
_110
}
_110
],
_110
"Guids": [
_110
{
_110
"id": "imdb://tt13303712"
_110
}
_110
]
_110
}
_110
]
_110
}
_110
}

Status 200
Content-Type application/json

Log

Submit logs to the Log Handler for Plex Media Server

Available Operations


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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.log.log_line(level=9255.97, message='string', source='string')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.log.log_multi_line()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.log.enable_paper_trail()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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


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

_18
import plex
_18
from plex.models import operations
_18
_18
s = plex.Plex(
_18
access_token="",
_18
)
_18
_18
req = operations.CreatePlaylistRequest(
_18
title='string',
_18
type=operations.Type.PHOTO,
_18
smart=710.36,
_18
)
_18
_18
res = s.playlists.create_playlist(req)
_18
_18
if res.status_code == 200:
_18
# handle response
_18
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
NameValue
AUDIOaudio
VIDEOvideo
PHOTOphoto

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.get_playlists(playlist_type=operations.PlaylistType.VIDEO, smart=871.29)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.delete_playlist(playlist_id=6481.72)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.get_playlist(playlist_id=202.18)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.update_playlist(playlist_id=3682.41)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.clear_playlist_contents(playlist_id=8326.2)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.get_playlist_contents(playlist_id=9571.56, type=7781.57)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.add_playlist_contents(playlist_id=1403.5, uri='library://..', play_queue_id=123)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.playlists.upload_playlist(path='/home/barkley/playlist.m3u', force=8700.13)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Security

API Calls against Security for Plex Media Server

Available Operations


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
NameValue
DELEGATIONdelegation

scope operations.Scope

all - This is the only supported scope parameter.

Show child properties
NameValue
ALLall

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.security.get_transient_token(type=operations.QueryParamType.DELEGATION, scope=operations.Scope.ALL)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.security.get_source_connection_information(source='provider://provider-identifier')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Sessions

API Calls that perform search operations with Plex Media Server Sessions

Available Operations


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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.sessions.get_sessions()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.sessions.get_session_history()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
GetTranscodeSessions.py

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.sessions.get_transcode_sessions()
_12
_12
if res.object is not None:
_12
# handle response
_12
pass

Example Response

_31
{
_31
"MediaContainer": {
_31
"size": 1,
_31
"TranscodeSession": [
_31
{
_31
"key": "zz7llzqlx8w9vnrsbnwhbmep",
_31
"throttled": false,
_31
"complete": false,
_31
"progress": 0.4000000059604645,
_31
"size": -22,
_31
"speed": 22.399999618530273,
_31
"error": false,
_31
"duration": 2561768,
_31
"context": "streaming",
_31
"sourceVideoCodec": "h264",
_31
"sourceAudioCodec": "ac3",
_31
"videoDecision": "transcode",
_31
"audioDecision": "transcode",
_31
"protocol": "http",
_31
"container": "mkv",
_31
"videoCodec": "h264",
_31
"audioCodec": "opus",
_31
"audioChannels": 2,
_31
"transcodeHwRequested": false,
_31
"timeStamp": 1681869535.7764285,
_31
"maxOffsetAvailable": 861.778,
_31
"minOffsetAvailable": 0
_31
}
_31
]
_31
}
_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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.sessions.stop_transcode_session(session_key='zz7llzqlx8w9vnrsbnwhbmep')
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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


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

_12
import plex
_12
_12
s = plex.Plex(
_12
access_token="",
_12
)
_12
_12
_12
res = s.updater.get_update_status()
_12
_12
if res.status_code == 200:
_12
# handle response
_12
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
NameValue
ZERO0
ONE1

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.updater.check_for_updates(download=operations.Download.ONE)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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
NameValue
ZERO0
ONE1

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
NameValue
ZERO0
ONE1

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

_13
import plex
_13
from plex.models import operations
_13
_13
s = plex.Plex(
_13
access_token="",
_13
)
_13
_13
_13
res = s.updater.apply_updates(tonight=operations.Tonight.ZERO, skip=operations.Skip.ONE)
_13
_13
if res.status_code == 200:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json

Video

API Calls that perform operations with Plex Media Server Videos

Available Operations


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

_20
import plex
_20
from plex.models import operations
_20
_20
s = plex.Plex(
_20
access_token="",
_20
)
_20
_20
req = operations.StartUniversalTranscodeRequest(
_20
has_mde=8009.11,
_20
path='/private',
_20
media_index=5204.78,
_20
part_index=7805.29,
_20
protocol='string',
_20
)
_20
_20
res = s.video.start_universal_transcode(req)
_20
_20
if res.status_code == 200:
_20
# handle response
_20
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

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

_25
import plex
_25
from plex.models import operations
_25
_25
s = plex.Plex(
_25
access_token="",
_25
)
_25
_25
req = operations.GetTimelineRequest(
_25
rating_key=6788.8,
_25
key='<key>',
_25
state=operations.State.PLAYING,
_25
has_mde=7206.33,
_25
time=6399.21,
_25
duration=5820.2,
_25
context='string',
_25
play_queue_item_id=1433.53,
_25
play_back_time=5373.73,
_25
row=9446.69,
_25
)
_25
_25
res = s.video.get_timeline(req)
_25
_25
if res.status_code == 200:
_25
# handle response
_25
pass

Example Response

_10
{
_10
"errors": [
_10
{
_10
"code": 1001,
_10
"message": "User could not be authenticated",
_10
"status": 401
_10
}
_10
]
_10
}

Status 401
Content-Type application/json