Files
plex-docs/static/plex-api-spec-dereferenced.yaml
2023-04-10 13:38:45 +00:00

874 lines
30 KiB
YAML

openapi: 3.1.0
info:
title: Plex-API
summary: A Plex Media Server API Map
description: An Open API Spec for interacting with Plex.tv and Plex Servers
version: 0.0.3
contact:
name: Luke Hagar
email: Lukeslakemail@gmail.com
url: 'https://www.LukeHagar.com'
servers:
- url: '{Protocol}://{Local IP}:{Port}'
variables:
Protocol:
enum:
- http
- https
default: http
description: The protocol to use with your plex server
Local IP:
default: 10.10.10.47
description: The Local IP Address of your plex server
Port:
default: 32400
description: The port to access your plex server
security:
- PlexToken: []
components:
securitySchemes:
PlexToken:
type: apiKey
in: header
name: X-Plex-Token
paths:
/:
get:
tags:
- Server
summary: Server Capabilities
description: Server Capabilities
operationId: serverCapabilities
responses:
'200':
description: The Server Capabilities
content:
application/json:
schema:
type: object
properties:
MediaContainer:
type: object
properties:
size:
type: number
allowCameraUpload:
type: boolean
allowChannelAccess:
type: boolean
allowMediaDeletion:
type: boolean
allowSharing:
type: boolean
allowSync:
type: boolean
allowTuners:
type: boolean
backgroundProcessing:
type: boolean
certificate:
type: boolean
companionProxy:
type: boolean
countryCode:
type: string
diagnostics:
type: string
eventStream:
type: boolean
friendlyName:
type: string
hubSearch:
type: boolean
itemClusters:
type: boolean
livetv:
type: number
machineIdentifier:
type: string
mediaProviders:
type: boolean
multiuser:
type: boolean
musicAnalysis:
type: number
myPlex:
type: boolean
myPlexMappingState:
type: string
myPlexSigninState:
type: string
myPlexSubscription:
type: boolean
myPlexUsername:
type: string
offlineTranscode:
type: number
ownerFeatures:
type: string
photoAutoTag:
type: boolean
platform:
type: string
platformVersion:
type: string
pluginHost:
type: boolean
pushNotifications:
type: boolean
readOnlyLibraries:
type: boolean
streamingBrainABRVersion:
type: number
streamingBrainVersion:
type: number
sync:
type: boolean
transcoderActiveVideoSessions:
type: number
transcoderAudio:
type: boolean
transcoderLyrics:
type: boolean
transcoderPhoto:
type: boolean
transcoderSubtitles:
type: boolean
transcoderVideo:
type: boolean
transcoderVideoBitrates:
type: string
transcoderVideoQualities:
type: string
transcoderVideoResolutions:
type: string
updatedAt:
type: number
updater:
type: boolean
version:
type: string
voiceSearch:
type: boolean
Directory:
type: array
items:
type: object
properties:
count:
type: number
key:
type: string
title:
type: string
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/activities:
get:
tags:
- Activities
summary: Server Activities
description: Server Activities
operationId: serverActivities
responses:
'200':
description: The Server Activities
content:
application/json:
schema:
type: object
properties:
MediaContainer:
type: object
properties:
size:
type: number
Activity:
type: array
items:
type: object
properties:
uuid:
type: string
type:
type: string
cancellable:
type: boolean
userID:
type: number
title:
type: string
subtitle:
type: string
progress:
type: number
Context:
type: object
properties:
librarySectionID:
type: string
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/activities/{activityUUID}':
delete:
tags:
- Activities
summary: Cancel Server Activities
description: Cancel Server Activities
operationId: cancelServerActivities
parameters:
- name: activityUUID
description: The UUID of the activity to cancel.
in: path
schema:
type: string
example: 25b71ed5-0f9d-461c-baa7-d404e9e10d3e
required: true
responses:
'200':
description: The Server Activity was canceled
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/updater/status:
get:
tags:
- Updater
summary: Querying status of updates
description: Querying status of updates
operationId: queryingUpdateStatus
responses:
'200':
description: The Server Updates
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/updater/check:
put:
tags:
- Updater
summary: Checking for updates
description: Checking for updates
operationId: checkingforUpdates
parameters:
- name: download
description: Indicate that you want to start download any updates found.
required: false
in: query
schema:
enum:
- 0
- 1
example: 1
responses:
'200':
description: ''
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/updater/apply:
put:
tags:
- Updater
summary: Applying updates
description: |
Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
operationId: applyingUpdates
parameters:
- name: tonight
description: 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
required: false
in: query
schema:
enum:
- 0
- 1
example: 1
- name: skip
description: Indicate that the latest version should be marked as skipped. The <Release> entry for this version will have the `state` set to `skipped`.
required: false
in: query
schema:
enum:
- 0
- 1
example: 1
responses:
'200':
description: If the update process started correctly
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'500':
description: If the update process failed to start
/butler:
post:
tags:
- Butler
summary: Start all Butler tasks
description: |
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.
operationId: startAllButlerTasks
responses:
'200':
description: All tasks were started
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
delete:
tags:
- Butler
summary: Stop all Butler tasks
description: |
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
operationId: stopAllButlerTasks
responses:
'200':
description: All tasks were stopped
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/butler/{taskName}':
post:
tags:
- Butler
summary: Start a single Butler task
description: |
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.
operationId: startAButlerTasks
parameters:
- name: taskName
description: the name of the task to be started.
in: path
schema:
type: string
enum:
- BackupDatabase
- BuildGracenoteCollections
- CheckForUpdates
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GenerateAutoTags
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- OptimizeDatabase
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
required: true
responses:
'200':
description: The task was started successfully
'202':
description: The task was already running.
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
delete:
tags:
- Butler
summary: Stop a single Butler task
description: |
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.
operationId: stopAButlerTasks
parameters:
- name: taskName
description: The name of the task to be started.
in: path
schema:
type: string
enum:
- BackupDatabase
- BuildGracenoteCollections
- CheckForUpdates
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GenerateAutoTags
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- OptimizeDatabase
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
required: true
responses:
'200':
description: The task was stopped
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'404':
description: The task was not running
/log:
get:
tags:
- Log
summary: Logging a single line message.
description: |
This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
operationId: logaLine
parameters:
- name: level
description: |
An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
in: query
schema:
type: number
enum:
- 0
- 1
- 2
- 3
- 4
required: true
- name: message
description: The text of the message to write to the log.
in: query
schema:
type: string
example: ''
required: true
- name: source
description: a string indicating the source of the message.
in: query
schema:
type: string
example: ''
required: true
responses:
'200':
description: Log Line submitted successfully
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
post:
tags:
- Log
summary: Logging a multi-line message
description: |
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.
operationId: logMultipleLines
responses:
'200':
description: Multi-Line Log Message Posted successfully
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/log/networked:
get:
tags:
- Log
summary: Enabling Papertrail
description: |
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
operationId: enablePaperTrail
responses:
'200':
description: Papertrail enabled successfully
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'403':
description: the user was not signed in
/security/token:
get:
tags:
- Security
summary: Get a Transient Token.
description: |
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.
operationId: getTransientToken
parameters:
- name: type
description: '`delegation` - This is the only supported `type` parameter.'
in: query
schema:
type: string
enum:
- delegation
required: true
- name: scope
description: '`all` - This is the only supported `scope` parameter.'
in: query
schema:
type: string
enum:
- all
required: true
responses:
'200':
description: A Transient Token
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/security/resources:
get:
tags:
- Security
summary: Get Source Connection Information
description: |
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.
operationId: getConnectionInformation
parameters:
- name: source
description: The source identifier with an included prefix.
in: query
schema:
type: string
example:
- 'server://client-identifier'
- 'provider://provider-identifier'
required: true
responses:
'200':
description: Source Connection Information
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/library/sections/{sectionId}/{category}':
get:
tags:
- Library
summary: Get Library Items
description: |
This endpoint will return a list of library items filtered by the filter and type provided
operationId: getLibraryItems
parameters:
- name: sectionId
description: the Id of the library to query
in: path
schema:
type: number
required: true
- name: category
description: the category to retrieve from the library
in: path
schema:
type: string
enum:
- all
- latest
required: true
- name: type
description: item type
in: query
schema:
type: number
required: false
- name: filter
description: the filter parameter
in: query
schema:
type: string
required: false
responses:
'200':
description: The details of the library
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/library/sections:
get:
tags:
- Library
summary: Get All Libraries
description: |
This endpoint will return a list of libraries
operationId: getLibraries
responses:
'200':
description: The libraries available on the Server
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/hubs:
get:
tags:
- Hubs
summary: Get Global Hubs
description: ''
operationId: getGlobalHubs
parameters:
- name: count
description: The number of items to return with each hub.
in: query
schema:
type: number
required: false
- name: onlyTransient
description: '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).'
in: query
schema:
type: number
enum:
- 0
- 1
required: false
responses:
'200':
description: returns global hubs
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/hubs/sections/{sectionId}':
get:
tags:
- Hubs
summary: Get library specific hubs
description: |
This endpoint will return a list of library specific hubs
operationId: getLibraryHubs
parameters:
- name: sectionId
description: the Id of the library to query
in: path
schema:
type: number
required: true
- name: count
description: The number of items to return with each hub.
in: query
schema:
type: number
required: false
- name: onlyTransient
description: '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).'
in: query
schema:
type: number
enum:
- 0
- 1
required: false
responses:
'200':
description: The hubs specific to the library
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/playlists/all:
get:
tags:
- Playlists
summary: Get All Playlists
description: ''
operationId: getAllPlaylists
parameters:
- name: playlistType
description: limit to a type of playlist.
in: query
schema:
type: string
enum:
- audio
- video
- photo
required: false
- name: smart
description: type of playlists to return (default is all).
in: query
schema:
type: number
enum:
- 0
- 1
required: false
responses:
'200':
description: returns all playlists
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/playlists:
post:
tags:
- Playlists
summary: Create a Playlist
description: |
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.
operationId: createAPlaylist
parameters:
- name: title
description: name of the playlist
in: query
schema:
type: string
required: true
- name: type
description: type of playlist to create
in: query
schema:
type: string
enum:
- audio
- video
- photo
required: true
- name: smart
description: whether the playlist is smart or not
in: query
schema:
type: number
enum:
- 0
- 1
required: true
- name: uri
description: the content URI for the playlist
in: query
schema:
type: string
required: false
- name: playQueueID
description: the play queue to copy to a playlist
in: query
schema:
type: number
required: false
responses:
'200':
description: returns all playlists
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/playlists/{playlistID}':
get:
tags:
- Playlists
summary: Retrieve Playlist
description: |
This endpoint will return a playlist
operationId: getPlaylist
parameters:
- name: playlistID
description: the ID of the playlist
in: path
schema:
type: number
required: true
responses:
'200':
description: The playlist
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
delete:
tags:
- Playlists
summary: Delete a Playlist
description: |
This endpoint will delete a playlist
operationId: deletePlaylist
parameters:
- name: playlistID
description: the ID of the playlist
in: path
schema:
type: number
required: true
responses:
'200':
description: The playlist is deleted
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
put:
tags:
- Playlists
summary: Update a Playlist
description: |
This endpoint will delete a playlist
operationId: updatePlaylist
parameters:
- name: playlistID
description: the ID of the playlist
in: path
schema:
type: number
required: true
responses:
'200':
description: The playlist is deleted
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
'/playlists/{playlistID}/items':
get:
tags:
- Playlists
summary: Retrieve Playlist Contents
description: |
This endpoint will return the contents of a playlist
operationId: getPlaylistContent
parameters:
- name: playlistID
description: the ID of the playlist
in: path
schema:
type: number
required: true
- name: type
description: the metadata type of the item to return
in: query
schema:
type: number
required: true
responses:
'200':
description: The playlist contents
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
delete:
tags:
- Playlists
summary: Delete Playlist Contents
description: |
This endpoint will clear the contents of a playlist
operationId: clearPlaylistContent
parameters:
- name: playlistID
description: the ID of the playlist
in: path
schema:
type: number
required: true
responses:
'200':
description: The playlist contents are cleared
'401':
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
tags:
- name: Activities
description: |
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.
- name: Butler
description: |
Butler is the task manager of the Plex Media Server Ecosystem.
- name: Server
description: |
Operations against the Plex Media Server System.
- name: Updater
description: |
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.
- name: Log
description: |
Submit logs to the Log Handler for Plex Media Server
- name: Security
description: |
API Calls against Security for Plex Media Server
- name: Library
description: |
API Calls interacting with Plex Media Server Libraries
- name: Hubs
description: |
Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
- name: Playlists
description: |
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.