Plex Media Server (1.1.1 )

Download OpenAPI specification:

License: Apache 2.0

API Info

Content Types

The API supports responses in both XML and JSON, and clients can request one or the other using the standard Accept HTTP header. The default is XML, so JSON will only be returned if it's explicitly requested (Accept: application/json). New applications should use JSON.

Throughout the docs, it's common for a examples to be given in JSON only since the JSON response would be preferred for new applications.

Headers

PMS accept a variety of custom headers that follow the pattern X-Plex-{name}. The full set of headers isn't enumerated here since some may only apply to certain endpoints, but common headers that can be included on all requests include:

Header Description Sample
X-Plex-Client-Identifier An opaque identifier unique to the client abc123
X-Plex-Token An authentication token, obtained from plex.tv XXXXXXXXXXXX
X-Plex-Product The name of the client product Plex for Roku
X-Plex-Version The version of the client application 2.4.1
X-Plex-Platform The platform of the client Roku
X-Plex-Platform-Version The version of the platform 4.3 build 1057
X-Plex-Device A relatively friendly name for the client device Roku 3
X-Plex-Model A potentially less friendly identifier for the device model 4200X
X-Plex-Device-Vendor The device vendor Roku
X-Plex-Device-Name A friendly name for the client Living Room TV
X-Plex-Marketplace The marketplace on which the client application is distributed googlePlay

X-Plex-Client-Identifier is typically required, as is X-Plex-Token for authentication.

There's no standard way to send non-ASCII values as HTTP headers. We attempt to recognize and parse UTF-8 and ISO-8859-1. If you're sending something that may include non-ASCII characters (often X-Plex-Device-Name), use UTF-8 if possible.

These are referred to as headers throughout documentation, but all X-Plex- headers can also be sent as query string arguments.

Auth

Most endpoints require token based authentication, and the token is expected to be sent in the X-Plex-Token header. Tokens are obtained from plex.tv. See the Authenticating with Plex section.

Paths and Keys

Many parts of the API reference things that can be fetched by their key. These keys follow a sort of relative URL resolution pattern. Some examples will help clarify.

  • For a request to /library/sections that includes an item with a key of home in the response, that item can be fetched at /library/sections/home.
  • For a request to /library/sections/home that includes an item with a key of /library/metadata/deadbeef in the response, that item can be fetched at /library/metadata/deadbeef.

We say this follows a "sort of" relative URL resolution pattern because all requests are treated as though they have a trailing slash.

/library/sections/ + home => /library/sections/home
/library/sections + home => /library/sections/home
/library/sections + /library/sections/home => /library/sections/home

Just like URL resolution, keys may contain absolute URLs as well, especially absolute https://... URLs or custom view://... URLs. In these cases the key resolved by simply using it, the parent is irrelevant.

Also note that the features described in this API can generally be present at a different paths. The /media/providers path defines where all features can be found. Note that a PMS can contain multiple providers which will be enumerated here. For simplicity, these docs use the most common, default paths. But when we say that /library/sections/{id} is part of the API, what we really mean is that a endpoint exists which is composed of the key for the content feature and the key for the library section.

Finally, it's worth noting that many paths can potentially be discovered by walking API responses and fetching keys, but paths that aren't documented here aren't part of the API contract, they just happen to exist for a particular provider. For example, a particular content directory might include a directory with key={baseLibraryPath}/genre. That's not an official part of the API that's guaranteed to exist for every content directory, it's just a key that happened to exist within that content directory.

Types

Many elements throughout the API have a type attribute. These types are meant to give helpful information, such as whether something is a movie library or a TV show library. Some API elements rely on a type number so both are provided below

List of Metadata Types

Type Name Type Number
movie 1
show 2
season 3
episode 4
trailer 5
person 7
artist 8
album 9
track 10
clip 12
photo 13
photoalbum 14
playlist 15
playlistfolder 16
collection 18

When an element has both type and key attributes, the type describes what will be returned when fetching that key. Some types will return a list of other elements. That list may have a Meta element describing the specific types within the list. Consider the following examples:

[
  {
    "key": "/foo",
    "type": "movie",
    "title": "A Movie"
  },
  {
    "key": "/bar",
    "type": "collection",
    "title": "My Favorite Movies"
  },
  {
    "key": "/baz",
    "type": "show",
    "title": "A Show"
  }
]

In each case, the type describes what will be returned when fetching the key. One exception is the /children key for parents like shows and seasons. It will return a list of children even though the type describes the parent.

Some elements may also include an optional subtype attribute. The subtype is meant to be a refinement of the type, not a completely different type. One test is trying to explain the type in natural language. type="clip" subtype="news" passes the test that "This is a clip, a news clip specifically." Another test is considering the client UI. A client should be functional if it ignores the subtype, and optimized if it respects it. If type="track" subtype="podcast", a client can successfully play the podcast in an audio player based purely on the type, but it may tweak the display or which advanced playback controls are visible based on the subtype.

List of Metadata Subtypes

  • podcast
  • webshow
  • news
  • photo

Collection Subtypes

  • movie
  • show
  • artist
  • album

Extras Subtypes

  • trailer
  • deletedScene
  • interview
  • musicVideo
  • behindTheScenes
  • sceneOrSample
  • liveMusicVideo
  • lyricMusicVideo
  • concert
  • featurette
  • short
  • other

Sources

Source URIs and attributes make it possible to uniquely reference content outside the local server context without requiring a fixed url. This might be desirable when showing related albums from a friend's shared media server, building a universal play queue, or returning aggregated hubs that span multiple providers. Source components are immutable and act as pointers to a single item or directory in the Plex ecosystem.

A source URI from a media server uses the server scheme while a cloud provider uses the provider scheme.

server://{SERVER_ID}/{PROVIDER_ID}/{PATH}
provider://{PROVIDER_ID}/{PATH}

As a single regular expression, that's:

/^(server|provider):\/\/([a-fA-F0-9-]+)?\/?([^/]+)([^\?]+)\??(.*)?/

The server id is the server's machineIdentifier. The provider id is the provider's identifier. The rest of the path represents the path of the content at the provider and may include additional query parameters like X-Plex- headers or media query syntax for sorts and filters.

Some examples may be helpful:

server://546684a3d18ac5c39037360ec9ce900b7af9cc36/com.plexapp.plugins.library/library/metadata/2814936
provider://tv.plex.provider.podcasts/library/sections/audio/all

The source attribute has the same structure as the source URI, but omits the path.

{SOURCE_TYPE}://{SOURCE_ID}/{PROVIDER_ID?}
/^(server|provider):\/\/([a-fA-F0-9-]+)?\/?([^/]+)$/
source="server://546684a3d18ac5c39037360ec9ce900b7af9cc36/com.plexapp.plugins.library"
source="provider://tv.plex.provider.podcasts"

Source attributes can be used as a base and combined with key or other root-relative path components to construct unique source URIs.

Pagination

Many endpoints that return a list of items support pagination. Additionally some endpoints will force pagination and limit number of elements returned if the client attempts to request all items. To request a specific subset of data, add two headers to specify the starting offset and the number of desired items.

  • X-Plex-Container-Start - The desired starting offset
  • X-Plex-Container-Size - The desired number of items

Both headers should be sent in order to request paginated content. Note that it's possible to request a size of 0 on supported endpoints in order to learn the total size without actually getting any content.

The response must be checked to see if the response is in fact paginated. The response might not be paginated at all, or it might include a different number of items than what was requested. A paginated response will include the headers:

  • X-Plex-Container-Start - The offset of the first returned item
  • X-Plex-Container-Total-Size - The total size of the collection (optional but typically present)

The response body will also typically include pagination info. If the response is a MediaContainer, then it will have offset and size attributes representing the start index and the number of items in the current response along with an optional totalSize attribute for the total number of elements in the collection.

HTTP/1.1 200 OK
X-Plex-Container-Start: 2
X-Plex-Container-Total-Size: 5
Content-Type: application/xml

{
  "MediaContainer": {
    "size": 3,
    "totalSize": 5,
    "offset": 2,
    "Metadata" : []
  }
}

Rather than requesting a page starting at an index, it is also possible in some lists to request a page centered on a specific item in the list.

  • X-Plex-Container-Focus-Key - The key of an item to center on
  • X-Plex-Container-Size - The desired number of items

The requested size is respected regardless of the position of the focus item in the list. If the item is at the start of the list and 10 items are requested, 9 items in the response will be after the item. If the item is in the middle of the list and 10 items are requested, 4 items will be before the item and 5 items will be after.

Endpoints that support rich media queries also have a limit parameter that interacts with pagination. Sending limit in a query string limits the desired number of items, much like the X-Plex-Container-Size header. There are two major differences:

  1. When using limit, the total size of the collection is not returned. The minimum of the limit and the actual total size will be returned as the total size.
  2. The request may be more efficient when using limit, since the total size doesn't have to be known.

If the total size of the collection isn't needed, use limit, since the request may be more efficient.

Note that limit and X-Plex-Container-Size aren't mutually exclusive. You can page within the results that are bounded by the limit. If you want a total of 1000 items from a collection of many thousands of items, but you want to page through them 20 at a time, you'd use limit=1000&X-Plex-Container-Size=20&X-Plex-Container-Start=0.

API Versioning

PMS has never used API versioning before the creation of this document. The first published API is considered 1.0 with the API prior to publication considered 0.0. A client species its version via the X-Plex-Pms-Api-Version header on requests. If no header is provided, the version 0.0 is assumed.

API Changes

  • 1.0.0 (Supported in PMS >= 1.41.9)

  • Added /downloadQueue endpoints.

  • Public release of API.

  • The includeFields parameter has been renamed to includeOptionalFields. The includeFields parameter now means "include only these fields" where in the past it meant "please add these fields you wouldn't normally include." This was changed to be consistent with the cloud provider API.

  • 1.1.0 (Supported in PMS >= 1.42.0)

    • Added ability to filter '/media/providers/metadata' endpoint by metadata types (PM-3702)
    • Changed types in /playlists/{playlistId}/items to array of integers.
    • Document the /photo/:/transcode endpoints
    • Fixed serialization of MetadataType objects for '/media/providers/metadata' calls.
  • 1.1.1 (Supported in PMS >= 1.42.2)

    • Added 'metadataAgentProviderGroupId' query param to create and edit library section (PM-3577)
    • Fixed Add library section method type.

Response Customization

Many endpoints allow the data that is included in the response to be tailored to exactly what the client wants. This is possible by either specifying things that should be excluded or the set of things that should be included. PMS's ability to include/exclude elements and fields is currently limited but expanding so this should be used with care.

Attributes can be customized by using a query string arg of either excludeFields or includeFields. This single parameter should be a comma-separated list of attribute names. For example, a request with excludeFields=summary,tagline is asking for the summary and title attributes to be left off any metadata items while the includeFields parameter indicated that only the specified fields should be included.

Child elements can be customized by using a query string arg of either excludeElements or includeElements. This single parameter should be a comma-separated list of element names. For example, a request with excludeElements=Media is asking for the Media elements to be omitted while the includeElements parameter indicated that only the specified elements should be included.

In addition to the above are the parameters includeOptionalFields and includeOptionalElements. These indicate that the fields/elements which are not normally included should be included in this request. One example is includeOptionalElements=musicAnalysis on metadata will include the musicAnalysis parameter which can be large and typically not needed by a client.

Trimming the response to only include what a client will actually use can result in much better performance, especially in large collections. Increasingly these are being used to select which data is fetched from the database. So if a client knows it will only ever use a few parameters from a request, it should specify those with includeFields.

Note that these inclusions/exclusions are treated as requests, not guarantees. Some endpoints will disregard them completely, and others may ignore them for specific items and insist on returning data that the client didn't necessarily ask for.

Media Providers

Media providers are general purpose entities which supply media to Plex clients. Their API describes the Plex Media Server API, via a set of features on the "root" endpoint of the provider. Media provider can be hosted by a media server or in the cloud, linked to a specific Plex account. This section explains media providers generally, and then provides the specific server-hosted APIs around media providers.

Client Guide to Media Providers

The philosophy behind media providers in general is to allow a common API between cloud servers and PMS, since the APIs are nearly identical to a normal PMS. The general guidelines are:

  • Consume /media/providers instead of /library/sections

    The new providers endpoint give you a list of all providers exported by a server and their features. Remember that the library itself is considered a (very rich) provider! This change will also require changing the client to not hardwire paths on the server, but rather read them from the feature keys directly (e.g. scrobble and rating endpoints).

  • Gate management functionality on the manage feature

    Server libraries allow management (e.g. media deletion). The correct way to gate this functionality is via the manage feature.

  • Make sure key construction is correct for things like genre lists

    For example, /library/sections/x/genre returns a relative key for each genre, but there's nothing which says that the key can't be an absolute URL. This is why servers pass back fastKey separately so as to not break clients which don't do key construction correctly. Media providers do not pass back fastKey, but assume clients will be doing correct key construction.

  • Don't call /library/sections/X/filters|sorts

    You can get all that information (and more) in a single call by hitting /library/sections/X?includeDetails=1. Media providers include the extra information by default.

  • Respect the Type keys in /library/sections/x

    The top-level type pivots have their own keys, which should be used over the old "just append /all to the path and add the type" approach. Not only is this more flexible, it also allows for "virtual" pivots, like music videos inside a music library.

  • Look for the skipChildren/skipParent attributes for shows

    Because of things like Podcasts, single-season shows can now be made to skip seasons. This is indicated by a skipChildren attribute on the show, or a skipParent attribute on an episode. If this is set on a show, the client should use /grandchildren instead of /children in the show's key.

Features

The list of supported features, along with the API endpoints each feature represents is shown in the following list. Note that each feature can define a custom endpoint URL, so it doesn't have to match the server API exactly.

  • search: This feature implies that it supports search via the provided key.

  • metadata: This feature implies that it supports metadata endpoint. For example, if the key were /library/metadata then the endpoints /library/metadata/X, /library/metadata/X/children and /library/metadata/X/grandchildren would be supported. This endpoint family allows browsing a hierarchical tree of media (e.g. show to episodes, or artist to tracks).

  • content: This feature implies that the provider exposes a content catalog, in the form of libraries to browse (grid of content), or discover (via hubs). Each entry in the content feature can contain:

    • hubKey: This implies it supports a discovery endpoint with hubs.
    • key: This implies it supports a content catalog.
    • icon: Optional, specifies the icon used for a content directory.

    Each content feature can contain one or both of these keys, depending on the structure. More details on the various combinations are provided below.

  • match: The match feature is used to match a piece of media to the provider's content catalog via a set of hints. As a specific example, you might pass in a title hint of "Attack of the 50 Foot Woman" and a year hint of 1958 for the movie type. The provider would then use all the hints to attempt to match to entries in its catalog.

  • manage: The manage feature implies a whole host of endpoints around changing data inside a library (e.g. editing fields, customizing artwork, etc.). This feature is generally only available on an actual server and generally only to the admin.

  • timeline: The timeline feature implies that the provider wants to receive timeline (playback notifications) requests from a client at the endpoint defined by key. The feature may additionally specify the scrobbleKey and unscrobbleKey attributes, which represent the endpoints which allow marking a piece of media played or unplayed.

  • rate: This feature implies the provider supports the endpoint which allows rating content.

  • playqueue: This feature implies the provider supports the play queue family of endpoints. The flavor attribute further specifies the subset; the only supported flavor is currently full.

  • playlist: This feature implies the provider supports the playlist family of endpoints. If readonly is set, that means that the provider only allows listing and playing playlists (via play queue API), not actually creating or editing them.

  • subscribe: This provider allows media subscriptions to be created. If the flavor is record then media can be recorded from this library (such as DVR). If the flavor is download then the user is allowed to download from this library.

  • promoted: This feature allows the provider to supply an endpoint that will return a collection of "promoted" hubs that many clients show on a user's home screen.

  • continuewatching: This feature allows the provider to supply an endpoint that will return a hub for merging into a global Continue Watching hub.

  • collection: This feature implies the provider supports the collection family of endpoints.

  • actions

    • removeFromContinueWatching - Action to remove an item from continue watching
  • imagetranscoder - This feature implies the provider supports the image transcoder endpoints used to scale images for clients where memory and processor is at a premium

  • queryParser - This feature implies the provider supports the media queries language below

  • grid - This feature implies the provider supports displaying metadata in a grid over time (such as live TV)

Home discovery and browsable libraries

Shown in the example in /media/providers, in this media provider the first content directory is an item with only hubKey, meaning it only providers discovery hubs. This is the set of hubs covering the whole library which contains continue watching, recently added, recommendations, etc. It's essentially "landing page" for the provider.

The subsequent directories also have a browse key, which means they provide a list view of the content with options for filtering and sorting. EPG providers may have only the key and no hubKey.

Minimal provider

There's no requirement to provide the content feature, given that there are two other ways to access content within a provider: search and match. The former can contribute to global search, whereas the latter is used for things like the DVR engine; once media subscriptions are set up, they look for matching content using the match feature, and examined using the metadata feature.

Deeper Hierarchies

If you examine an app like Spotify, you'll see many of the concepts here apply to their content hierarchy. Their content screens are either grids or hubs. But one notable difference is that the content hierarchy runs a bit deeper than the examples we've examined thus far. For example, one of the top-level selections is "Genres & Moods". Diving into one of the genres leads to a discovery area with different hubs for popular playlists, artists, and albums from the genre. Selecting a mood leads to a grid with popular playlists for the mood. In order to support this sort of hierarchy, we need an extension to the regular library, which is a content directory. This allows us to nest content, without losing any of the power and features—for example, the grid with popular playlists could list filters and sorts specific for that grid. This is power you simply don't have with the old channel architecture.

Extensions to regular libraries

This section examines extensions to plain libraries which content providers can use, and which clients need to be aware of.

  • Nested content directories: In regular libraries, there are fixed types of directories (e.g. shows, or music albums). In content providers, we want to have the ability to display other types of things (e.g. stations, or moods, or genres) as first-class things in a grid or discovery layout. Here's an example of what a nested content directory looks like. Given the type of content, the client knows that this directory should be treated like a content directory feature entry.

    {
      "Directory":[
        {
          "key":"foo",
          "hubKey":"foo2",
          "type":"content",
          "aspectRatio":"1:1",
          "title":"Genres and Moods"
        }
      ]
    }
    
  • Aspect ratio hint: Because the entities listed in content directories can be arbitrary, it's important to tell the client some information about how they should be displayed. The thumb attribute contains no information about aspect ratio, so clients make assumptions based upon known types (e.g. movies are 2:3, episode thumbs are 16:9, etc.). This attributes allows the provider to specify exactly the aspect ratio of the thing being displayed.

Media Queries

Media queries are a querystring-based filtering language used to select subsets of media. The language is rich, and can express complex expressions for media selection, as well as sorting and grouping.

Fields

Queries reference fields, which can be of a few types:

  • integer: numbers
  • boolean: true/false
  • tag: integers representing tag IDs.
  • string: strings
  • date: epoch seconds
  • language: string in ISO639-2b format.

These fields are detailed in Field elements in the section description endpoint (e.g. /library/sections/X?includeDetails=1).

Operators

Given that media queries are expressible using querystrings, the operator syntax might look a bit quirky, because a) they have to include the = character, and b) characters to the left of the equal sign usually have to be URI encoded.

Operators are defined per type:

  • integer: = (equals), != (not equals), >>= (greater than), <<= (less than), <= (less than or equals), >= (greater than or equals)
  • boolean: =0 (false) and =1 (true)
  • tag: = (is) and != (is not)
  • string: = (contains), != (does not contain), == (equals), !== (does not equal), <= (begins with), >= (ends with)
  • date: = (equals), != (not equals), >>= (after), <<= (before)
  • language: = (equals), != (not equals)

Relative Values and Units

For some types, values can be specified as relative. For dates, epoch seconds can be specified as relative to “now” as follows: +N (in N seconds from now and -N (N seconds ago).

In addition, the following unit suffixes can be used on date values:

  • m: minutes
  • h: hours
  • d: days
  • w: weeks
  • mon: months
  • y: years

For example, >>=-3y means “within the last 3 years”.

Field Scoping

Some media is organized hierarchically (e.g. shows), and in those cases, many fields are common to different elements in the hierarchy (e.g. show title vs episode title). The following rules are used to resolve field references.

  • A type parameter must be included to specify the result type.
  • Any non-qualified field is defaulted to refer to the result type.
  • In order to refer to other levels of the hierarchy, use the scoping operator, e.g. show.title or episode.year. A query may be comprised of multiple fields from different levels of the hierarchy.
  • the sourceType parameter may be used to change the default level to which fields refer. For example, type=4&sourceType=2&title==24 means “all episodes where the show title is 24”.

Sorting

The sort parameter is used to indicate an ordering on results. Typically, the sort value is a field (including optional scoping). The : character is used to indicate additional features of the sort, and the , character is used to include multiple fields to the sort.

For example, sort=title,index means “sort first by title ascending, then by index”. Sort features are:

  • desc: indicates a descending sort.
  • nullsLast: indicates that null values are sorted last.

Sort features may be mixed and matched, e.g. sort=title,index:desc.

Grouping

The group parameter is used to group results by a field, similar to the SQL feature group by. For example, when listing popular tracks, we use the query type=10&sort=ratingCount:desc&group=title, because we don't want multiple tracks with the same name (e.g. same track on different albums) showing up.

Limits

The limit parameter is used to limit the number of results returned. Because it's implemented on top of the SQL limit operator, it currently only operates at the level of the type returned. In other words, type=10&limit=100 will return at most 100 tracks, but you can't select tracks from a limit of 10 albums.

Boolean Operators

Given the nature of querystrings, it makes a lot of sense to interpret the & character as a boolean AND operator. For example rating=10&index=5 means “rating is 10 AND index is 5”.

We leverage the , operator to signify the boolean OR operator. SO rating=1,2,3 means “rating is 1 OR 2 OR 3. Given standard precedence rules, rating=1,2,3&index=5 is parsed as (rating = 1 or rating = 2 or rating = 3) and index = 5).

Complex Expressions

There's only so many expressions you can form using vanilla querystring-to-boolean mapping (essentially, “ANDs of ORs”). In order to fully represent complex boolean expressions, there are a few synthetic additions:

  • push=1 and pop=1: These are the equivalent of opening and closing parenthesis.
  • or=1: These is an explicit OR operator.

As an example: push=1&index=1&or=1&rating=2&pop=1&duration=10 parses into (index = 1 OR rating = 2) AND duration = 10. This could not be expressed by the simplified syntax above.

Happy query building!

Profile Augmentations

The universal transcode endpoint supports the following header or query string parameter: X-Plex-Client-Profile-Extra.

The value of this parameter is url-encoded. When url-decoded, it consists of a string expressed in the following (poor man's) BNF grammar:

<ProfileExtension> ::= <Directive> "+" <Directive>*
<Directive> :: = <Verb> <Arguments>
<Verb> ::= "add-direct-play-profile" | "add-limitation" | "add-transcode-target-codec" | "append-transcode-target-codec" | "add-transcode-target" | "add-settings"
<Arguments> ::= "(" (<Name> "=" <Value>) "&")*
<Name> ::= <Text>
<Value> ::= <Text>

add-direct-play-profile

This directive augments the set of Direct Play profiles in the client profile. The following parameters are required:

  • type = "videoProfile" | "musicProfile" | "photoProfile" | "subtitleProfile"
  • container = * or a comma-separated list of containers
  • videoCodec = * or a comma-separated list of video codecs
  • audioCodec = * or a comma-separated list of audio codecs
  • subtitleCodec = * or a comma-separated list of subtitle formats

* means to use all existing matching values in the profile. At least one of the videoCodec, audioCodec and subtitleCodec parameters must not be *.

add-direct-play-profile example

To add ac3 as a video audio codec for mp4 and mov containers:

add-direct-play-profile(type=videoProfile&container=mp4,mov&videoCodec=*&audioCodec=ac3&subtitleCodec=*)

add-limitation

This directive adds a scoped limitation to the profile. The following parameters are required:

  • scope = "videoContainer" | "musicContainer" | "photoContainer" | "videoCodec" | "videoAudioCodec" | "musicCodec" | "subtitleCodec" | "transcodeTarget"
  • scopeName = the name of the relevant container or codec
  • type = "match" | "notMatch" | "upperBound" | "lowerBound"
  • name = the name of the limitation

The following parameters are optional:

  • isRequired = true|false (default is false)
  • allStreams = true|false (default is false)
  • replace = true|false (default is false)

If the replace parameter is true, the limitation will replace any similarly scoped limitations (i.e. identical scope and scopeName. If false, the new limitation will simply add itself to the list of limitations.

Exactly one of the following three parameters is required:

  • value = the value of the limitation
  • substring = the substring of the limitation
  • regex = the regex of the limitation

The transcodeTarget scope exists to attach a limitation to a transcode target. This allows clients to tell the MDE to select a specific transcode target for a context/protocol pair, based on specific information about the media itself. When multiple transcode targets match, the first one in the profile will be selected.

add-limitation examples

To add a limitation on ac3 audio tracks in video media specifying a maximum of 6 channels:

add-limitation(scope=videoAudioCodec&scopeName=ac3&type=upperBound&name=audio.channels&value=6)

To add a limitation on ac3 audio tracks in video media specifying a maximum bitrate:

add-limitation(scope=videoAudioCodec&scopeName=ac3&type=upperBound&name=audio.bitrate&value=160)

To add a limitation on h264 video specifying a maximum level:

add-limitation(scope=videoCodec&scopeName=h264&type=upperBound&name=video.level&value=40&isRequired=true)

To add a limitation to a transcode target:

add-limitation(scope=transcodeTarget&scopeName=MyTranscodeProfile&type=upperBound&name=audio.channels&value=2)

add-transcode-target-codec

This directive adds additional codecs to the beginning of the audioCodec and/or subtitleCodec lists for the specified transcode target. The following parameters are required:

  • type = "videoProfile" | "musicProfile" | "photoProfile" | "subtitleProfile"

Either id or context and protocol are required:

  • id = a transcode target identifier
  • context = a transcode context ("streaming" | "static")
  • protocol = a protocol ("hls" | "http" | "slss" ... )

At least one of the following parameters are also required:

  • videoCodec = a comma-separated list of videoCodecs, which are added to the set of video codecs on the target.
  • audioCodec = a comma-separated list of audioCodecs, which are added to the set of audio codecs on the target.
  • subtitleCodec = a comma-separated list of audioCodecs, which are added to the set of subtitle codecs on the target.

add-transcode-target-codec example

To add ac3 as an additional transcode target option to a HTTP Live Streaming target:

add-transcode-target-codec(type=videoProfile&context=streaming&protocol=hls&audioCodec=ac3)

append-transcode-target-codec

This directive appends additional codecs to the end of the audioCodec and/or subtitleCodec lists for the specified transcode target. The parameters are the same as for add-transcode-target-codec.

append-transcode-target-codec(type=videoProfile&context=streaming&protocol=hls&audioCodec=dca)

add-transcode-target

This directive adds a new transcode target. If a transcode target matching the type/context/profile already exists in the profile, then this directive is ignored. The following parameters are required:

  • type = "videoProfile" | "musicProfile" | "photoProfile" | "subtitleProfile"
  • context = a transcode context ("streaming" | "static")
  • protocol = a protocol ("hls" | "http" | "slss" ... )
  • container = a container

The following parameters are optional:

  • id = a transcode target identifier
  • replace = true|false (default is false)

If the replace parameter is true, the transcode target will replace any similarly scoped transcode target (i.e. identical type, context and protocol. If false, the augmentation will fail if there is an existing transcode target.

The following parameters are required, depending on the type:

  • videoCodec = a video codec (required for video) or a comma-separated list of video codecs
  • audioCodec = an audio codec (required for music and video) or a comma-separated list of audio codecs
  • subtitleCodec = an subtitle codec (required for subtitles and optional for video) or a comma-separated list of subtitle codecs

add-transcode-target examples

add-transcode-target(type=videoProfile&context=streaming&protocol=http&container=mkv&videoCodec=h264&audioCodec=aac,ac3&subtitleCodec=srt)
add-transcode-target(type=musicProfile&context=streaming&protocol=http&container=flac&audioCodec=flac)
add-transcode-target(type=subtitleProfile&context=all&protocol=http&container=webvtt&subtitleCodec=webvtt)

add-settings

This directive overrides global settings for the profile. The parameters are name/value pairs matching existing client profile settings.

add-settings(DirectPlayStreamSelection=false&RandomAccessDataModel=limited)

Authenticating with Plex

Plex supports two authentication methods:

Plex now supports JSON Web Token (JWT) authentication that provides better security, shorter token lifespans, and improved protection against potential security breaches.

Why JWT Authentication?

The new JWT system addresses security concerns by:

  • Short-lived tokens: Tokens expire after 7 days
  • Public-key cryptography: Uses modern cryptographic standards (ED25519) for enhanced security
  • Better clock synchronization: Built-in timestamp validation helps devices stay in sync

How JWT Authentication Works

The new system uses a public-key authentication model where each device uploads a public key (JWK) and then requests short-lived JWT tokens. Here's the flow:

1. Device Key Registration First, your device needs to register its public key with Plex.tv:

POST https://clients.plex.tv/api/v2/auth/jwk
Headers:
  X-Plex-Client-Identifier: your-device-identifier
  X-Plex-Token: your-existing-token

Body:
{
  "jwk": {
    "kty": "OKP",
    "crv": "Ed25519",
    "x": "your-public-key-data",
    "use": "sig",
    "alg": "EdDSA"
  }
}

2. Token Refresh Process Once registered, your device can refresh its token every 7 days using this three-step process:

Step 1: Get a Nonce

GET https://clients.plex.tv/api/v2/auth/nonce
Headers:
  X-Plex-Client-Identifier: your-device-identifier

This returns a unique nonce valid for 5 minutes:

{
  "nonce": "7c415b56-8f48-488a-98ab-847ef4460442"
}

Step 2: Create a Device JWT Your device creates a JWT containing:

  • The nonce from step 1
  • Required scope permissions (see Scope Details below)
  • Audience set to plex.tv
  • Issuer set to your client_identifier
  • Signed with your device's private key

Scope Details: The scope field in your device JWT should contain comma-separated values for the user data you need included in the JWT:

  • username - Access to the user's username
  • email - Access to the user's email address
  • friendly_name - Access to the user's friendly name
  • restricted - Access to the user's restricted status
  • anonymous - Access to the user's anonymous status
  • joinedAt - Access to the user's account creation timestamp

Example Device JWT Payload:

{
  "nonce": "7c415b56-8f48-488a-98ab-847ef4460442",
  "scope": "username,email,friendly_name",
  "aud": "plex.tv",
  "iss": "your-client-identifier",
  "iat": 1705785603,
  "exp": 1705789203
}

Step 3: Exchange for Plex Token

POST https://clients.plex.tv/api/v2/auth/token
Headers:
  X-Plex-Client-Identifier: your-device-identifier

Body:
{
  "jwt": "your-device-signed-jwt"
}

This returns a new Plex.tv JWT valid for 7 days:

{
  "auth_token": "eyJraWQiOiJYeVRRN21seXFtVmhJcEo0U1pDZGltdXo3ZjdEYXU1Ym9MLXU2MG5JeEdJIiwidHlwIjoiSldUIiwiYWxnIjoiRWREU0EifQ..."
}

Using Your JWT Token Once you have a JWT token, use it exactly like the old tokens in the X-Plex-Token header:

GET https://clients.plex.tv/api/v2/library/sections
Headers:
  X-Plex-Token: your-jwt-token

JWT Authentication Benefits

Security Features:

  • Token Rotation: Automatic expiration every 7 days
  • Individual Revocation: Each device can be individually disabled
  • Cryptographic Verification: Uses industry-standard ED25519 signatures
  • Nonce Protection: Prevents replay attacks

Developer Experience:

  • Familiar Interface: Same X-Plex-Token header usage
  • Automatic Clock Sync: Built-in timestamp validation
  • Clear Error Codes: Specific error responses for different failure modes
  • Rate Limiting: Built-in protection against abuse

Error Handling

The JWT system provides clear error responses with specific HTTP status codes:

  • 498 Token Expired: Your JWT has expired and needs refresh
  • 422 Signature Verification Failed: Invalid device signature or JWT structure
  • 422 Thumbprint Already Taken: JWK already registered by another device
  • 400 Bad Request: Invalid request format or missing required fields
  • 429 Too Many Requests: Rate limit exceeded (nonce requests are rate-limited)

Migration Guide

For New Applications:

  1. Generate an ED25519 key pair for your device
  2. Register your public key using POST https://clients.plex.tv/api/v2/auth/jwk
  3. Implement the token refresh flow
  4. Use the returned JWT in your X-Plex-Token header

For Existing Applications:

  1. Continue using your current token for now
  2. Implement JWT authentication alongside existing auth
  3. Test the new system thoroughly
  4. Switch over when ready

Traditional Token Authentication (Legacy)

You're developing an app that needs access to a user's Plex account. To do this, you'll need to get access to the user's Access Token. This document details how to check whether an Access Token is valid, and how to obtain a new one.

High-level Steps

  1. Choose a unique app name, like "My Cool App"
  2. Check storage for your app's Client Identifier; generate and store one if none is present.
  3. Check storage for the user's Access Token; if present, verify its validity and carry on.
  4. If an Access Token is missing or invalid, generate a PIN, and store its id.
  5. Construct an Auth App url and send the user's browser there to authenticate.
  6. After authentication, check the PIN's id to obtain and store the user's Access Token.

Detailed Steps

  1. Choose a unique app name

    The app name you choose will be visible in the user's Authorized Devices view. The name you choose should be different from any existing Plex products.

  2. Generate a Client Identifier

    The Client Identifier identifies the specific instance of your app. A random string or UUID is sufficient here. There are no hard requirements for Client Identifier length or format, but once one is generated the client should store and re-use this identifier for subsequent requests.

  3. Verify stored Access Token validity

    You can check whether a user's stored Access Token is valid by requesting user info from the plex.tv API and examining the HTTP status code of the response.

    $ curl -X GET https://plex.tv/api/v2/user \
      -H 'Accept: application/json' \
      -H 'X-Plex-Product: My Cool App' \
      -H 'X-Plex-Client-Identifier: <clientIdentifier>' \
      -H 'X-Plex-Token: <userToken>'
    
    HTTP Status Code
    200 Access Token is valid
    401 Access Token is invalid

    If an Access Token is invalid, it should be discarded, and new one should be obtained through the authentication process.

    If plex.tv cannot be reached, or if you receive any other status code it indicates an error state, but does not indicate an invalid Access Token.

  4. Generate a PIN

    To sign a user in, the app must create a time-limited PIN. The user is then led through a process to "claim" the PIN, associating it with their account and granting the app access to the user's plex.tv account.

    $ curl -X POST https://plex.tv/api/v2/pins?strong=true \
      -H 'Accept: application/json' \
      -H 'X-Plex-Product: My Cool App' \
      -H 'X-Plex-Client-Identifier: <clientIdentifier>'
    

    Note: the strong=true header provides a longer length pin which will have a longer lifetime. This is useful in cases where the user is not expected to type in the pin themselves. If not specified, a shorter pin is created but will have a much shorter lifetime.

    The response will be a JSON payload; the two important properties are id and code. Store the id locally, and use the code to construct the Auth App url.

    {
      "id": 564964751,
      "code": "8lzjqnq8lye02n52jq3fqxf8e",}
    
  5. Checking the PIN

    There are two primary ways apps interact with the Auth App and the PIN-claiming process; Forwarding and Polling.

    Forwarding is used by web-based apps. A user visits your app in their web browser, leaves your app to authenticate with Plex, and returns to your app via a forwardUrl your app provides.

    Polling is used by native apps running outside of a web browser. A user indicates their intention to sign-in from within your app, and your app opens a web browser pointing to the Auth App where the user completes sign-in. Your app will periodically poll on the generated PIN until it is claimed, or it expires.

  6. Construct the Auth App url

    The user will authenticate with the plex.tv Auth App through their web browser.

    If you're using the Forwarding flow, the user will be returned to your app after authenticating where you'll be able to check the created PIN to determine the user's Access Token. The forwardUrl to which the user will be returned can carry the PIN id which needs to be checked on their return to the app.

    Auth App urls are encoded as parameters to the url fragment. Practically, this means that your Auth App url will be prefixed with https://app.plex.tv/auth#?; the #? at the end indicates the beginning of the url fragment, and that the content of the fragment afterwards is encoded as url parameter key-values pairs.

    Append these parameters to construct the final URL.

    Parameter
    clientID Your client identifier
    code The code from the generated PIN
    forwardUrl The url to which the user will be returned after authenticating.
    context%5Bdevice%5D%5Bproduct%5D The name of your App; ex "My Cool App"

    Example

    https://app.plex.tv/auth#?clientID=<clientIdentifier>&code=<pinCode>&context%5Bdevice%5D%5Bproduct%5D=My%20Cool%20Plex%20App&forwardUrl=https%3A%2F%2Fmy-cool-plex-app.com
    

    You can use the qs module to encode all necessary parameters, including the nested context parameter.

    const authAppUrl =
      'https://app.plex.tv/auth#?' +
      require('qs').stringify({
        clientID: '<clientIdentifier>',
        code: '<pinCode>',
        forwardUrl: 'https://my-cool-plex-app.com',
        context: {
          device: {
            product: 'My Cool App',
          },
        },
      });
    
  7. Send user's browser to constructed Auth App url

    Once the Auth App URL has been constructed, send the user's browser there to authenticate.

  8. Check PIN

    If you're using the Polling flow, your app should periodically (once per second) check the PIN id to determine when the user has signed-in.

    If you're using the Forwarding flow, check the stored PIN id from the PIN creation step. If the PIN has been claimed, the authToken field in the response will contain the user's Access Token you need to make API calls on behalf of the user. If authentication failed, the authToken field will remain null.

    $ curl -X GET 'https://plex.tv/api/v2/pins/<pinID>' \
      -H 'Accept: application/json' \
      -H 'X-Plex-Client-Identifier: <clientIdentifier>'
    

Talking to PMS

Once you have a token to talk to plex.tv, you will need to obtain a different set of tokens used to talk to PMS instances.

$ curl https://clients.plex.tv/api/v2/resources?includeHttps=1&includeRelay=1&includeIPv6=1 \
  -H 'Accept: application/json' \
  -H 'X-Plex-Product: My Cool App' \
  -H 'X-Plex-Client-Identifier: <clientIdentifier>' \
  -H 'X-Plex-Token: <userToken>'

The response will be a JSON document which will contain available PMS instances, the accessToken used in communication with this PMS, and the list of connection URLs where the PMS may be contacted. Connections labeled as local should be preferred over those that are not, and relay should only be used as a last resort as bandwidth on relay connections is limited.

General

General endpoints for basic PMS operation not specific to any media provider

Get PMS info

Information about this PMS setup and configuration

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get PMS identity

Get details about this PMS's identity

Authorizations:
None

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

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.

Authorizations:
user_token
query Parameters
source
required
string

The source identifier with an included prefix.

refresh
integer
Enum: 0 1

Force refresh

Responses

Response samples

Content type
application/json

An example of a resource for a remote server

{}

Get Transient Tokens

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. Note: This endpoint responds to all HTTP verbs but POST in preferred

Authorizations:
user_token
query Parameters
type
required
string
Value: "delegation"

The value delegation is the only supported type parameter.

scope
required
string
Value: "all"

The value all is the only supported scope parameter.

Responses

Response samples

Content type
application/json

An example of a transient token

{
  • "MediaContainer": {
    }
}

Library

Library endpoints which are outside of the Media Provider API. Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc).

Get all items in library

Request all metadata items according to a query.

Authorizations:
user_token
query Parameters
mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete library caches

Delete the hub caches so they are recomputed on next request

Authorizations:
user_token

Responses

Response samples

Content type
text/html

Clean bundles

Clean out any now unused bundles. Bundles can become unused when media is deleted

Authorizations:
user_token

Responses

Response samples

Content type
text/html

Ingest a transient item

This endpoint takes a file path specified in the url parameter, matches it using the scanner's match mechanism, downloads rich metadata, and then ingests the item as a transient item (without a library section). In the case where the file represents an episode, the entire tree (show, season, and episode) is added as transient items. At this time, movies and episodes are the only supported types, which are gleaned automatically from the file path. Note that any of the parameters passed to the metadata details endpoint (e.g. includeExtras=1) work here.

Authorizations:
user_token
query Parameters
url
string <url>
Example: url=file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv

The file of the file to ingest.

virtualFilePath
string
Example: virtualFilePath=/Avatar.mkv

A virtual path to use when the url is opaque.

computeHashes
integer
Enum: 0 1
Example: computeHashes=1

Whether or not to compute Plex and OpenSubtitle hashes for the file. Defaults to 0.

ingestNonMatches
integer
Enum: 0 1
Example: ingestNonMatches=1

Whether or not non matching media should be stored. Defaults to 0.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get library matches

The matches endpoint is used to match content external to the library with content inside the library. This is done by passing a series of semantic "hints" about the content (its type, name, or release year). Each type (e.g. movie) has a canonical set of minimal required hints. This ability to match content is useful in a variety of scenarios. For example, in the DVR, the EPG uses the endpoint to match recording rules against airing content. And in the cloud, the UMP uses the endpoint to match up a piece of media with rich metadata. The endpoint response can including multiple matches, if there is ambiguity, each one containing a score from 0 to 100. For somewhat historical reasons, anything over 85 is considered a positive match (we prefer false negatives over false positives in general for matching). The guid hint is somewhat special, in that it generally represents a unique identity for a piece of media (e.g. the IMDB ttXXX) identifier, in contrast with other hints which can be much more ambiguous (e.g. a title of Jane Eyre, which could refer to the 1943 or the 2011 version). Episodes require either a season/episode pair, or an air date (or both). Either the path must be sent, or the show title

Authorizations:
user_token
query Parameters
type
required
integer

The metadata type to match against

includeFullMetadata
integer
Enum: 0 1

Whether or not to include full metadata on a positive match. When set, and the best match exceeds a score threshold of 85, metadata as rich as possible is sent back.

includeAncestorMetadata
integer
Enum: 0 1

Whether or not to include metadata for the item's ancestor (e.g. show and season data for an episode).

includeAlternateMetadataSources
integer
Enum: 0 1

Whether or not to return all sources for each metadata field, which results in a different structure being passed back.

guid
string

Used for movies, shows, artists, albums, and tracks. Allowed for various URI schemes, to be defined.

title
string

Used for movies, shows, artists, and albums. Required if path is not specified.

year
integer

Used for movies shows, and albums. Optional.

path
string

Used for movies, episodes, and tracks. The full path to the media file, used for "cloud-scanning" an item.

grandparentTitle
string

Used for episodes and tracks. The title of the show/artist. Required if path isn't passed.

grandparentYear
integer

Used for episodes. The year of the show.

parentIndex
integer

Used for episodes and tracks. The season/album number.

index
integer

Used for episodes and tracks. The episode/tracks number in the season/album.

originallyAvailableAt
string

Used for episodes. In the format YYYY-MM-DD.

parentTitle
string

Used for albums and tracks. The artist name for albums or the album name for tracks.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a chapter image

Get a single chapter image for a piece of media

Authorizations:
user_token
path Parameters
mediaId
required
integer

The id of the media item

chapter
required
integer

The index of the chapter

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

Edit a metadata item

Edit metadata items setting fields

Authorizations:
user_token
path Parameters
ids
required
Array of strings
query Parameters
args
object
Examples:
  • title=A New Title&sortTitle=New Title -

The new values for the metadata item

Responses

Response samples

Content type
text/html

Delete a metadata item

Delete a single metadata item from the library, deleting media as well

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
proxy
integer
Enum: 0 1

Whether proxy items, such as media optimized versions, should also be deleted. Defaults to false.

Responses

Response samples

Content type
text/html

Ad-detect an item

Start the detection of ads in a metadata item

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
text/html

Get the leaves of an item

Get the leaves for a metadata item such as the episodes in a show

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Analyze an item

Start the analysis of a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
thumbOffset
number

Set the offset to be used for thumbnails

artOffset
number

Set the offset to be used for artwork

Responses

Response samples

Content type
text/html

Generate thumbs of chapters for an item

Start the chapter thumb generation for an item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
force
integer
Enum: 0 1

Responses

Response samples

Content type
text/html

Credit detect a metadata item

Start credit detection on a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
force
integer
Enum: 0 1
manual
integer
Enum: 0 1

Responses

Response samples

Content type
text/html

Get an item's extras

Get the extras for a metadata item

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add to an item's extras

Add an extra to a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
extraType
integer

The metadata type of the extra

url
required
string

The URL of the extra

title
required
string

The title of the extra

Responses

Response samples

Content type
text/html

Get a file from a metadata or media bundle

Get a bundle file for a metadata or media item. This is either an image or a mp3 (for a show's theme)

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
url
string

The bundle url, typically starting with metadata:// or media://

Responses

Start BIF generation of an item

Start the indexing (BIF generation) of an item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
force
integer
Enum: 0 1

Responses

Response samples

Content type
text/html

Intro detect an item

Start the detection of intros in a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
force
integer
Enum: 0 1

Indicate whether detection should be re-run

threshold
number

The threshold for determining if content is an intro or not

Responses

Response samples

Content type
text/html

Create a marker

Create a marker for this user on the metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
type
required
integer

The type of marker to edit/create

startTimeOffset
required
integer

The start time of the marker

endTimeOffset
integer

The end time of the marker

attributes
object
Example: attributes[title]=My favorite spot

The attributes to assign to this marker

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a marker

Delete a marker for this user on the metadata item

Authorizations:
user_token
path Parameters
ids
required
string
marker
required
string

Responses

Response samples

Content type
text/html

Edit a marker

Edit a marker for this user on the metadata item

Authorizations:
user_token
path Parameters
ids
required
string
marker
required
string

The id of the marker to edit

query Parameters
type
required
integer

The type of marker to edit/create

startTimeOffset
required
integer

The start time of the marker

endTimeOffset
integer

The end time of the marker

attributes
object
Example: attributes[title]=My favorite spot

The attributes to assign to this marker

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Match a metadata item

Match a metadata item to a guid

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
guid
string
name
string
year
integer

Responses

Response samples

Content type
text/html

Get metadata matches for an item

Get the list of metadata matches for a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
title
string
parentTitle
string
agent
string
language
string
year
integer
manual
integer
Enum: 0 1

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a media item

Delete a single media from a metadata item in the library

Authorizations:
user_token
path Parameters
ids
required
string
mediaItem
required
string
query Parameters
proxy
integer
Enum: 0 1

Whether proxy items, such as media optimized versions, should also be deleted. Defaults to false.

Responses

Response samples

Content type
text/html

Merge a metadata item

Merge a metadata item with other items

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
ids
Array of strings
Examples:
  • ids=5,6 -

Responses

Response samples

Content type
text/html

Get nearest tracks to metadata item

Get the nearest tracks, sonically, to the provided track

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
excludeParentID
integer
excludeGrandparentID
integer
limit
integer
maxDistance
number

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set metadata preferences

Set the preferences on a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
args
object
Examples:
  • pref1=value1&pref2=value2 -

Responses

Response samples

Content type
text/html

Refresh a metadata item

Refresh a metadata item from the agent

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
agent
string
markUpdated
integer
Enum: 0 1

Responses

Response samples

Content type
text/html

Get related items

Get a hub of related items to a metadata item

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get similar items

Get a list of similar items to a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
count
integer

The maximum number of similar items; defaults to 200

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Split a metadata item

Split a metadata item into multiple items

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
text/html

Add subtitles

Add a subtitle to a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
title
string
language
string
mediaItemID
integer
url
string

The URL of the subtitle. If not provided, the contents of the subtitle must be in the post body

format
string
forced
integer
Enum: 0 1
hearingImpaired
integer
Enum: 0 1

Responses

Response samples

Content type
text/html

Get metadata items as a tree

Get a tree of metadata items, such as the seasons/episodes of a show

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Unmatch a metadata item

Unmatch a metadata item to info fetched from the agent

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
text/html

Get metadata top users

Get the list of users which have played this item starting with the most

Authorizations:
user_token
path Parameters
ids
required
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Detect voice activity

Start the detection of voice in a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
query Parameters
force
integer
Enum: 0 1

Indicate whether detection should be re-run

manual
integer
Enum: 0 1

Indicate whether detection is manually run

Responses

Response samples

Content type
text/html

Set an item's artwork, theme, etc

Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user

Authorizations:
user_token
path Parameters
ids
required
string
element
required
string
Enum: "thumb" "art" "clearLogo" "banner" "poster" "theme"
query Parameters
url
string

The url of the new asset. If not provided, the binary of the asset must be provided in the post body.

Responses

Response samples

Content type
text/html

Set an item's artwork, theme, etc

Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user

Authorizations:
user_token
path Parameters
ids
required
string
element
required
string
Enum: "thumb" "art" "clearLogo" "banner" "poster" "theme"
query Parameters
url
string

The url of the new asset.

Responses

Response samples

Content type
text/html

Get an item's artwork, theme, etc

Get the artwork, thumb, element for a metadata item

Authorizations:
user_token
path Parameters
ids
required
string
element
required
string
Enum: "thumb" "art" "clearLogo" "banner" "poster" "theme"
timestamp
required
integer

A timestamp on the element used for cache management in the client

Responses

Get augmentation status

Get augmentation status and potentially wait for completion

Authorizations:
user_token
path Parameters
augmentationId
required
string

The id of the augmentation

query Parameters
wait
integer
Enum: 0 1

Wait for augmentation completion before returning

Responses

Response samples

Content type
text/html

Optimize the Database

Initiate optimize on the database.

Authorizations:
user_token
query Parameters
async
integer
Enum: 0 1

If set, don't wait for completion but return an activity

Responses

Response samples

Content type
text/html

Set stream selection

Set which streams (audio/subtitle) are selected by this user

Authorizations:
user_token
path Parameters
partId
required
integer

The id of the part to select streams on

query Parameters
audioStreamID
integer

The id of the audio stream to select in this part

subtitleStreamID
integer

The id of the subtitle stream to select in this part. Specify 0 to select no subtitle

allParts
integer
Enum: 0 1

Perform the same for all parts of this media selecting similar streams in each

Responses

Response samples

Content type
text/html

Get BIF index for a part

Get BIF index for a part by index type

Authorizations:
user_token
path Parameters
partId
required
integer

The part id who's index is to be fetched

index
required
string
Value: "sd"

The type of index to grab.

query Parameters
interval
integer

The interval between images to return in ms.

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

Get an image from part BIF

Extract an image from the BIF for a part at a particular offset

Authorizations:
user_token
path Parameters
partId
required
integer

The part id who's index is to be fetched

index
required
string
Value: "sd"

The type of index to grab.

offset
required
integer

The offset to seek in ms.

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

Get a media part

Get a media part for streaming or download.

  • streaming: This is the default scenario. Bandwidth usage on this endpoint will be guaranteed (on the server's end) to be at least the bandwidth reservation given in the decision. If no decision exists, an ad-hoc decision will be created if sufficient bandwidth exists. Clients should not rely on ad-hoc decisions being made as this may be removed in the future.
  • download: Indicated if the query parameter indicates this is a download. Bandwidth will be prioritized behind playbacks and will get a fair share of what remains.
Authorizations:
user_token
path Parameters
partId
required
integer

The part id who's index is to be fetched

changestamp
required
integer

The changestamp of the part; used for busting potential caches. Provided in the key for the part

filename
required
string

A generic filename used for a client media stack which relies on the extension in the request. Provided in the key for the part

query Parameters
download
integer
Enum: 0 1

Whether this is a file download

Responses

Response samples

Content type
text/html
<html><head><title>Forbidden</title></head><body><h1>403 Forbidden</h1></body></html>

Get person details

Get details for a single actor.

Authorizations:
user_token
path Parameters
required
integer or string

Either the PMS tag id of the person or tagKey of the actor. Note the tagKey is the hex portion of the plex guid for the actor

Responses

Response samples

Content type
application/json
{}

Get media for a person

Get all the media for a single actor.

Authorizations:
user_token
path Parameters
required
integer or string

Either the PMS tag id of the person or tagKey of the actor. Note the tagKey is the hex portion of the plex guid for the actor

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get random artwork

Get random artwork across sections. This is commonly used for a screensaver.

This retrieves 100 random artwork paths in the specified sections and returns them. Restrictions are put in place to not return artwork for items the user is not allowed to access. Artwork will be for Movies, Shows, and Artists only.

Authorizations:
user_token
query Parameters
sections
Array of integers
Example: sections=5,6

The sections for which to fetch artwork.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get library sections (main Media Provider Only)

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).

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add a library section

Add a new library section to the server

Authorizations:
user_token
query Parameters
name
required
string

The name of the new section

type
required
integer

The type of library section

scanner
string

The scanner this section should use

agent
required
string

The agent this section should use for metadata

metadataAgentProviderGroupId
string

The agent group id for this section

language
required
string

The language of this section

locations
Array of strings
Example: locations=O:\fatboy\Media\Ripped\Music&locations=O:\fatboy\Media\My Music

The locations on disk to add to this section

prefs
object
Example: prefs[hidden]=0&prefs[collectionMode]=2

The preferences for this section

relative
integer
Enum: 0 1

If set, paths are relative to Media Upload path

importFromiTunes
integer
Enum: 0 1

If set, import media from iTunes.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Stop refresh

Stop all refreshes across all sections

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get section prefs

Get a section's preferences for a metadata type

Authorizations:
user_token
query Parameters
type
required
integer

The metadata type

agent
string

The metadata agent in use

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Refresh all sections

Tell PMS to refresh all section metadata

Authorizations:
user_token
query Parameters
force
boolean

Force refresh of metadata

Responses

Response samples

Content type
text/html

Get a library section by id

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. It often contains a list of Directory metadata objects: These used to be used by clients to build a menuing system.

Authorizations:
user_token
path Parameters
sectionId
required
string

The section identifier

query Parameters
includeDetails
integer
Enum: 0 1

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.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a library section

Delete a library section by id

Authorizations:
user_token
path Parameters
sectionId
required
string

The section identifier

query Parameters
async
integer
Enum: 0 1

If set, response will return an activity with the actual deletion process. Otherwise request will return when deletion is complete

Responses

Response samples

Content type
text/html

Edit a library section

Edit a library section by id setting parameters

Authorizations:
user_token
path Parameters
sectionId
required
string

The section identifier

query Parameters
name
string

The name of the new section

scanner
string

The scanner this section should use

agent
required
string

The agent this section should use for metadata

metadataAgentProviderGroupId
string

The agent group id for this section

language
string

The language of this section

locations
Array of strings
Example: locations=O:\fatboy\Media\Ripped\Music&locations=O:\fatboy\Media\My Music

The locations on disk to add to this section

prefs
object
Example: prefs[hidden]=0&prefs[collectionMode]=2

The preferences for this section

Responses

Response samples

Content type
text/html

Set the fields of the filtered items

This endpoint takes an large possible set of values. Here are some examples.

  • Parameters, extra documentation

    • artist.title.value
      • When used with track, both artist.title.value and album.title.value need to be specified
    • title.value usage
      • Summary
        • Tracks always rename and never merge
        • Albums and Artists
          • if single item and item without title does not exist, it is renamed.
          • if single item and item with title does exist they are merged.
          • if multiple they are always merged.
      • Tracks
        • Works as expected will update the track's title
        • Single track: /library/sections/{id}/all?type=10&id=42&title.value=NewName
        • Multiple tracks: /library/sections/{id}/all?type=10&id=42,43,44&title.value=NewName
        • All tracks: /library/sections/{id}/all?type=10&title.value=NewName
      • Albums
        • Functionality changes depending on the existence of an album with the same title
        • Album exists
          • Single album: /library/sections/{id}/all?type=9&id=42&title.value=Album 2
            • Album with id 42 is merged into album titled "Album 2"
          • Multiple/All albums: /library/sections/{id}/all?type=9&title.value=Moo Album
            • All albums are merged into the existing album titled "Moo Album"
        • Album does not exist
          • Single album: /library/sections/{id}/all?type=9&id=42&title.value=NewAlbumTitle
            • Album with id 42 has title modified to "NewAlbumTitle"
          • Multiple/All albums: /library/sections/{id}/all?type=9&title.value=NewAlbumTitle
            • All albums are merged into a new album with title="NewAlbumTitle"
      • Artists
        • Functionaly changes depending on the existence of an artist with the same title.
        • Artist exists
          • Single artist: /library/sections/{id}/all?type=8&id=42&title.value=Artist 2
            • Artist with id 42 is merged into existing artist titled "Artist 2"
          • Multiple/All artists: /library/sections/{id}/all?type=8&title.value=Artist 3
            • All artists are merged into the existing artist titled "Artist 3"
        • Artist does not exist
          • Single artist: /library/sections/{id}/all?type=8&id=42&title.value=NewArtistTitle
            • Artist with id 42 has title modified to "NewArtistTitle"
          • Multiple/All artists: /library/sections/{id}/all?type=8&title.value=NewArtistTitle
            • All artists are merged into a new artist with title="NewArtistTitle"
  • Notes

    • Technically square brackets are not allowed in an URI except the Internet Protocol Literal Address
    • RFC3513: A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax.
    • Escaped square brackets are allowed, but don't render well
Authorizations:
user_token
path Parameters
sectionId
required
string

The id of the section

query Parameters
type
string
filters
string

The filters to apply to determine which items should be modified

field.value
string

Set the specified field to a new value

field.locked
integer
Enum: 0 1

Set the specified field to locked (or unlocked if set to 0)

title.value
string

This field is treated specially by albums or artists and may be used for implicit reparenting.

artist.title.value
string

Reparents set of Tracks or Albums - used with album.title.* in the case of tracks

artist.title.id
string

Reparents set of Tracks or Albums - used with album.title.* in the case of tracks

album.title.value
string

Reparents set of Tracks - Must be used in conjunction with artist.title.value or id

album.title.id
string

Reparents set of Tracks - Must be used in conjunction with artist.title.value or id

tagtype[idx].tag.tag
string

Creates tag and associates it with each item in the set. - [idx] links this and the next parameters together

tagtype[idx].tagging.object
string

Here object may be text/thumb/art/theme - Optionally used in conjunction with tag.tag, to update association info across the set.

tagtype[].tag.tag-
string

Remove comma separated tags from the set of items

tagtype[].tag
string

Remove associations of this type (e.g. genre) from the set of items

Responses

Response samples

Content type
text/html

Analyze a section

Start analysis of all items in a section. If BIF generation is enabled, this will also be started on this section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
text/html

Get autocompletions for search

The field to autocomplete on is specified by the {field}.query parameter. For example genre.query or title.query. Returns a set of items from the filtered items whose {field} starts with {field}.query. In the results, a {field}.queryRange will be present to express the range of the match

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
type
integer

Item type

field.query
string

The "field" stands in for any field, the value is a partial string for matching

mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Get collections in a section

Get all collections in a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a collection

Delete a library collection from the PMS

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

collectionId
required
integer

Collection Id

Responses

Response samples

Content type
text/html

Get common fields for items

Represents a "Common" item. It contains only the common attributes of the items selected by the provided filter Fields which are not common will be expressed in the mixedFields field

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
type
integer

Item type

mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Get a section composite image

Get a composite image of images in this section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

updatedAt
required
integer

The update time of the image. Used for busting cache.

query Parameters
mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

object
Examples:
  • rows=2&cols=2&width=512&height=512&border=0&type=-1&format=jpg&crop=center&repeat=true&media=thumb&backgroundColor=0 - The default parameters if none are provided
  • height=256&width=256 - Get a composite image in a smaller size

Responses

Response samples

Content type
text/html

Empty section trash

Empty trash in the section, permanently deleting media/metadata for missing media

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
text/html

Get section filters

Get common filters on a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get list of first characters

Get list of first characters in this section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
type
integer

The metadata type to filter on

sort
integer

The metadata type to filter on

mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json

A small movie section

{
  • "MediaContainer": {
    }
}

Delete section indexes

Delete all the indexes in a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
text/html

Delete section intro markers

Delete all the intro markers in a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
text/html

Get section prefs

Get the prefs for a section by id and potentially overriding the agent

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
agent
string

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section prefs

Set the prefs for a section by id

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
prefs
required
object
Example: hidden=0&enableCinemaTrailers=1

Responses

Response samples

Content type
text/html

Refresh section

Start a refresh of this section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
force
integer
Enum: 0 1

Whether the update of metadata and items should be performed even if modification dates indicate the items have not change

path
string

Restrict refresh to the specified path

Responses

Response samples

Content type
text/html

Cancel section refresh

Cancel the refresh of a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
text/html

Get a section sorts

Get the sort mechanisms available in a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a stream

Get a stream (such a a sidecar subtitle stream)

Authorizations:
user_token
path Parameters
streamId
required
integer

The id of the stream

ext
required
string

The extension of the stream. Required to fetch the sub portion of idx/sub subtitles

query Parameters
encoding
string

The requested encoding for the subtitle (only used for text subtitles)

format
string

The requested format for the subtitle to convert the subtitles to (only used for text subtitles)

autoAdjustSubtitle
integer
Enum: 0 1

Whether the server should attempt to automatically adjust the subtitle timestamps to match the media

Responses

Response samples

Content type
text/html
<html><head><title>Forbidden</title></head><body><h1>403 Forbidden</h1></body></html>

Set a stream offset

Set a stream offset in ms. This may not be respected by all clients

Authorizations:
user_token
path Parameters
streamId
required
integer

The id of the stream

ext
required
string

This is not a part of this endpoint but documented here to satisfy OpenAPI

query Parameters
offset
integer

The offest in ms

Responses

Response samples

Content type
text/html
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>

Delete a stream

Delete a stream. Only applies to downloaded subtitle streams or a sidecar subtitle when media deletion is enabled.

Authorizations:
user_token
path Parameters
streamId
required
integer

The id of the stream

ext
required
string

This is not a part of this endpoint but documented here to satisfy OpenAPI

Responses

Response samples

Content type
text/html

Get loudness about a stream

The the loudness of a stream in db, one number per line, one entry per 100ms

Authorizations:
user_token
path Parameters
streamId
required
integer

The id of the stream

query Parameters
subsample
integer

Subsample result down to return only the provided number of samples

Responses

Response samples

Content type
text/plain
-40.0
-40.0
-40.0
-36.9
-25.3
-22.9
-21.5
-20.6

Get loudness about a stream in json

The the loudness of a stream in db, one entry per 100ms

Authorizations:
user_token
path Parameters
streamId
required
integer

The id of the stream

query Parameters
subsample
integer

Subsample result down to return only the provided number of samples

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get all library tags of a type

Get all library tags of a type

Authorizations:
user_token
query Parameters
type
integer

The type of tags to fetch

Responses

Response samples

Content type
application/json
{}

Library: Playlists

Endpoints for manipulating playlists.

Create a Playlist

Create a new playlist. By default the playlist is blank.

Authorizations:
user_token
query Parameters
uri
string

The content URI for what we're playing (e.g. library://...).

playQueueID
integer

To create a playlist from an existing play queue.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Delete a Playlist

Deletes a playlist by provided id

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

Responses

Response samples

Content type
text/html

Editing a Playlist

Edits a playlist in the same manner as editing metadata

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

Responses

Response samples

Content type
text/html

Clearing a playlist

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

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Adding to a Playlist

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.

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

query Parameters
uri
string

The content URI for the playlist.

playQueueID
integer

The play queue to add to a playlist.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Get a playlist generator

Get a playlist's generator. Only used for optimized versions

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

generatorId
required
integer

The generator item ID to delete.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a Generator

Deletes an item from a playlist. Only works with dumb playlists.

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

generatorId
required
integer

The generator item ID to delete.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Modify a Generator

Modify a playlist generator. Only used for optimizer

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

generatorId
required
integer

The generator item ID to modify.

query Parameters
object
Example: Item[type]=42&Item[title]=Jack-Jack Attack&Item[target]=&Item[targetTagID]=1&Item[locationID]=-1&Item[Location]=[object Object]&Item[Policy]=[object Object]

Note: OpenAPI cannot properly render this query parameter example (See GHI). It should be rendered as:

Item[type]=42&Item[title]=Jack-Jack Attack&Item[target]=&Item[targetTagID]=1&Item[locationID]=-1&Item[Location][uri]=library://82503060-0d68-4603-b594-8b071d54819e/item//library/metadata/146&Item[Policy][scope]=all&Item[Policy][value]=&Item[Policy][unwatched]=0

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Get a playlist generator's items

Get a playlist generator's items

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

generatorId
required
integer

The generator item ID to delete.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Reprocess a generator

Make a generator reprocess (refresh)

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

generatorId
required
integer

The generator item ID to act on

metadataId
required
integer

The metadata item ID to act on

action
required
string
Enum: "reprocess" "disable" "enable"

The action to perform for this item on this optimizer queue

Responses

Response samples

Content type
text/html

Moving items in a playlist

Moves an item in a playlist. Only works with dumb playlists.

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

playlistItemId
required
integer

The playlist item ID to move.

query Parameters
after
integer

The playlist item ID to insert the new item after. If not provided, item is moved to beginning of playlist

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Get a playlist's generators

Get all the generators in a playlist

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Upload

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.

Authorizations:
user_token
query Parameters
path
string
Example: path=/home/barkley/playlist.m3u

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.

force
integer
Enum: 0 1

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.

Responses

Response samples

Content type
text/html

Library: Collections

Endpoints for manipulating collections. In addition to these endpoints, /library/collections/:collectionId/X will be rerouted to /library/metadata/:collectionId/X and respond to those endpoints as well.

Add items to a collection

Add items to a collection by uri

Authorizations:
user_token
path Parameters
collectionId
required
integer

The collection id

query Parameters
uri
required
string

The URI describing the items to add to this collection

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete an item from a collection

Delete an item from a collection

Authorizations:
user_token
path Parameters
collectionId
required
integer

The collection id

itemId
required
integer

The item to delete

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Reorder an item in the collection

Reorder items in a collection with one item after another

Authorizations:
user_token
path Parameters
collectionId
required
integer

The collection id

itemId
required
integer

The item to move

query Parameters
after
integer

The item to move this item after. If not provided, this item will be moved to the beginning

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Status

The status endpoints give you information about current playbacks, play history, and even terminating sessions.

List Sessions

List all current playbacks on this server

Authorizations:
user_token

Responses

Response samples

Content type
application/json

A playback session

{
  • "MediaContainer": {
    }
}

Get background tasks

Get the list of all background tasks

Authorizations:
user_token

Responses

Response samples

Content type
application/json

An example of the media optimizer running

{
  • "MediaContainer": {
    }
}

List Playback History

List all playback history (Admin can see all users, others can only see their own). Pagination should be used on this endpoint. Additionally this endpoint supports includeFields, excludeFields, includeElements, and excludeElements parameters.

Authorizations:
user_token
query Parameters
accountID
integer

The account id to restrict view history

viewedAt
integer

The time period to restrict history (typically of the form viewedAt>=12456789)

librarySectionID
integer

The library section id to restrict view history

metadataItemID
integer

The metadata item to restrict view history (can provide the id for a show to see all of that show's view history). Note this is translated to metadata_items.id, parents.id, or grandparents.id internally depending on the metadata type.

sort
Array of strings
Example: sort=viewedAt:desc,accountID

The field on which to sort. Multiple orderings can be specified separated by , and the direction specified following a : (desc or asc; asc is assumed if not provided). Note metadataItemID may not be used here.

Responses

Response samples

Content type
application/json

OK

{
  • "MediaContainer": {
    }
}

Get Single History Item

Get a single history item by id

Authorizations:
user_token
path Parameters
historyId
required
integer

The id of the history item (the historyKey from above)

Responses

Response samples

Content type
application/json

OK

{
  • "MediaContainer": {
    }
}

Delete Single History Item

Delete a single history item by id

Authorizations:
user_token
path Parameters
historyId
required
integer

The id of the history item (the historyKey from above)

Responses

Response samples

Content type
application/json

OK

{
  • "MediaContainer": {
    }
}

Terminate a session

Terminate a playback session kicking off the user

Authorizations:
user_token
query Parameters
sessionId
required
string
Example: sessionId=cdefghijklmnopqrstuvwxyz

The session id (found in the Session element in /status/sessions)

reason
string
Example: reason=Stop Playing

The reason to give to the user (typically displayed in the client)

Responses

Response samples

Content type
text/html

Activities

Activities 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.

Get all activities

List all activities on the server. Admins can see all activities but other users can only see their own

Authorizations:
user_token

Responses

Response samples

Content type
application/json

Activity of updating EPG and detecting credits

{
  • "MediaContainer": {
    }
}

Cancel a running activity

Cancel a running activity. Admins can cancel all activities but other users can only cancel their own

Authorizations:
user_token
path Parameters
activityId
required
string
Example: d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e

The UUID of the activity to cancel.

Responses

Response samples

Content type
text/html

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.

Querying status of updates

Get the status of updating the server

Authorizations:
user_token

Responses

Response samples

Content type
application/json

An example of update status

{
  • "MediaContainer": {
    }
}

Checking for updates

Perform an update check and potentially download

Authorizations:
user_token
query Parameters
download
integer
Enum: 0 1

Indicate that you want to start download any updates found.

Responses

Response samples

Content type
text/html

Applying updates

Apply any downloaded updates. Note that the two parameters tonight and skip are effectively mutually exclusive. The tonight parameter takes precedence and skip will be ignored if tonight is also passed.

Authorizations:
user_token
query Parameters
tonight
integer
Enum: 0 1

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 immediately.

skip
integer
Enum: 0 1

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

Responses

Response samples

Content type
text/html

Butler

The butler is responsible for running periodic tasks. Some tasks run daily, others every few days, and some weekly. These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.

Get all Butler tasks

Get the list of butler tasks and their scheduling

Authorizations:
user_token

Responses

Response samples

Content type
application/json

Example tasks

{
  • "ButlerTasks": {
    }
}

Start all Butler 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.
Authorizations:
user_token

Responses

Response samples

Content type
text/html

Stop all Butler tasks

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

Authorizations:
user_token

Responses

Response samples

Content type
text/html

Start a single Butler task

This endpoint will attempt to start a specific Butler task by name.

Authorizations:
user_token
path Parameters
task
required
string
Enum: "AutomaticUpdates" "BackupDatabase" "ButlerTaskGenerateAdMarkers" "ButlerTaskGenerateCreditsMarkers" "ButlerTaskGenerateIntroMarkers" "ButlerTaskGenerateVoiceActivity" "CleanOldBundles" "CleanOldCacheFiles" "DeepMediaAnalysis" "GarbageCollectBlobs" "GarbageCollectLibraryMedia" "GenerateBlurHashes" "GenerateChapterThumbs" "GenerateMediaIndexFiles" "LoudnessAnalysis" "MusicAnalysis" "OptimizeDatabase" "RefreshEpgGuides" "RefreshLibraries" "RefreshLocalMedia" "RefreshPeriodicMetadata" "UpgradeMediaAnalysis"

The task name

Responses

Response samples

Content type
text/html

Stop a single Butler task

This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists

Authorizations:
user_token
path Parameters
task
required
string
Enum: "AutomaticUpdates" "BackupDatabase" "ButlerTaskGenerateAdMarkers" "ButlerTaskGenerateCreditsMarkers" "ButlerTaskGenerateIntroMarkers" "ButlerTaskGenerateVoiceActivity" "CleanOldBundles" "CleanOldCacheFiles" "DeepMediaAnalysis" "GarbageCollectBlobs" "GarbageCollectLibraryMedia" "GenerateBlurHashes" "GenerateChapterThumbs" "GenerateMediaIndexFiles" "LoudnessAnalysis" "MusicAnalysis" "OptimizeDatabase" "RefreshEpgGuides" "RefreshLibraries" "RefreshLocalMedia" "RefreshPeriodicMetadata" "UpgradeMediaAnalysis"

The task name

Responses

Response samples

Content type
text/html

Events

The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.

Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.

Connect to Eventsource

Connect to the event source to get a stream of events

Authorizations:
user_token
query Parameters
filter
Array of strings

By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the filters parameter. For example:

  • filters=-log: All event types except logs (the default).
  • filters=foo,bar: Only the foo and bar event types.
  • filters=: All events types.
  • filters=-foo,bar: All event types except foo and bar.

Responses

Connect to WebSocket

Connect to the web socket to get a stream of events

Authorizations:
user_token
query Parameters
filter
Array of strings

By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the filters parameter. For example:

  • filters=-log: All event types except logs (the default).
  • filters=foo,bar: Only the foo and bar event types.
  • filters=: All events types.
  • filters=-foo,bar: All event types except foo and bar.

Responses

Log

Logging mechanism to allow clients to log to the server

Logging a single-line message to the Plex Media Server log

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

Note: This endpoint responds to all HTTP verbs except POST but PUT is preferred

Authorizations:
user_token
query Parameters
level
integer
Enum: 0 1 2 3 4

An integer log level to write to the PMS log with.

  • 0: Error
  • 1: Warning
  • 2: Info
  • 3: Debug
  • 4: Verbose
message
string

The text of the message to write to the log.

source
string

A string indicating the source of the message.

Responses

Response samples

Content type
text/html

Logging a multi-line message to the Plex Media Server log

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 PUT endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.

Authorizations:
user_token
Request Body schema: text/plain

Line separated list of log items

Schema not provided

Responses

Request samples

Content type
text/plain
level=3&source=diskless%20client&Things%20are%20OK%20right%20now
level=0&source=diskless%20client&We%20have%20a%20problem

Response samples

Content type
text/html

Enabling Papertrail

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

Note: This endpoint responds to all HTTP verbs but POST is preferred

Authorizations:
user_token
query Parameters
minutes
integer

The number of minutes logging should be sent to Papertrail

Responses

Response samples

Content type
text/html

Preferences

Get all preferences

Get the list of all preferences

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set preferences

Set a set of preferences in query parameters

Authorizations:
user_token
query Parameters
prefs
required
object
Example: FriendlyName=My Server&sendCrashReports=1&ScheduledLibraryUpdateInterval=3600

Responses

Response samples

Content type
text/html

Get a preferences

Get a single preference and value

Authorizations:
user_token
query Parameters
id
string

The preference to fetch

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Download Queue

Get or create a download queue

Available: 0.2.0

Get or create a download queue for this client by its client id and for this user as identified by the token

Authorizations:
user_token

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Get a download queue

Available: 0.2.0

Get a download queue by its id

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Add to download queue

Available: 0.2.0

Add items to the download queue

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

query Parameters
keys
required
Array of strings
Example: keys=/library/metadata/3,/library/metadata/6

Keys to add

advancedSubtitles
string
Enum: "burn" "text" "unknown"
Example: advancedSubtitles=burn

Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost

audioBoost
integer >= 1
Example: audioBoost=50

Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)

audioChannelCount
integer [ 1 .. 8 ]
Example: audioChannelCount=5

Target video number of audio channels.

autoAdjustQuality
integer
Enum: 0 1
Example: autoAdjustQuality=1

Indicates the client supports ABR.

autoAdjustSubtitle
integer
Enum: 0 1
Example: autoAdjustSubtitle=1

Indicates if the server should adjust subtitles based on Voice Activity Data.

directPlay
integer
Enum: 0 1
Example: directPlay=1

Indicates the client supports direct playing the indicated content.

directStream
integer
Enum: 0 1
Example: directStream=1

Indicates the client supports direct streaming the video of the indicated content.

directStreamAudio
integer
Enum: 0 1
Example: directStreamAudio=1

Indicates the client supports direct streaming the audio of the indicated content.

disableResolutionRotation
integer
Enum: 0 1
Example: disableResolutionRotation=1

Indicates if resolution should be adjusted for orientation.

hasMDE
integer
Enum: 0 1
Example: hasMDE=1

Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1

location
string
Enum: "lan" "wan" "cellular"
Example: location=wan

Network type of the client, can be used to help determine target bitrate.

mediaBufferSize
integer
Example: mediaBufferSize=102400

Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.

mediaIndex
integer

Index of the media to transcode. -1 or not specified indicates let the server choose.

musicBitrate
integer >= 0
Example: musicBitrate=5000

Target bitrate for audio only files (in kbps, used to transcode).

offset
number
Example: offset=90.5

Offset from the start of the media (in seconds).

partIndex
integer

Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode

path
string
Example: path=/library/metadata/151671

Internal PMS path of the media to transcode.

peakBitrate
integer >= 0
Example: peakBitrate=12000

Maximum bitrate (in kbps) to use in ABR.

photoResolution
string^\d[x:]\d$
Example: photoResolution=1080x1080

Target photo resolution.

protocol
string
Enum: "http" "hls" "dash"
Example: protocol=dash

Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)

secondsPerSegment
integer
Example: secondsPerSegment=5

Number of seconds to include in each transcoded segment

subtitleSize
integer >= 1
Example: subtitleSize=50

Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)

subtitles
string
Enum: "auto" "burn" "none" "sidecar" "embedded" "segmented" "unknown"
Example: subtitles=Burn

Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream

videoBitrate
integer >= 0
Example: videoBitrate=12000

Target video bitrate (in kbps).

videoQuality
integer [ 0 .. 99 ]
Example: videoQuality=50

Target photo quality.

videoResolution
string^\d[x:]\d$
Example: videoResolution=1080x1080

Target maximum video resolution.

header Parameters
X-Plex-Client-Identifier
required
string

Unique per client.

X-Plex-Client-Profile-Extra
string
Example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264,hevc&audioCodec=aac&protocol=dash)
X-Plex-Client-Profile-Name
string
Example: generic

Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.

X-Plex-Device
string
Example: Windows

Device the client is running on

X-Plex-Model
string
Example: standalone

Model of the device the client is running on

X-Plex-Platform
string
Example: Chrome

Client Platform

X-Plex-Platform-Version
string
Example: 135

Client Platform Version

X-Plex-Session-Identifier
string

Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Grab download queue media

Available: 0.2.0

Grab the media for a download queue item

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

itemId
required
integer
Example: 32

The item ids

Responses

Grab download queue item decision

Available: 0.2.0

Grab the decision for a download queue item

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

itemId
required
integer
Example: 32

The item ids

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get download queue items

Available: 0.2.0

Get items from a download queue

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Get download queue items

Available: 0.2.0

Get items from a download queue

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

itemId
required
Array of integers
Example: 32,345,23

The item ids

Responses

Response samples

Content type
application/json
Example
{
  • "MediaContainer": {
    }
}

Delete download queue items

delete items from a download queue

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

itemId
required
Array of integers
Example: 32,345,23

The item id

Responses

Response samples

Content type
text/html

Restart processing of items from the decision

Available: 0.2.0

Reprocess download queue items with previous decision parameters

Authorizations:
user_token
path Parameters
queueId
required
integer

The queue id

itemId
required
Array of integers
Example: 32,345,23

The item ids

Responses

Response samples

Content type
text/html

UltraBlur

Service provided to compute UltraBlur colors and images.

Get UltraBlur Colors

Retrieves the four colors extracted from an image for clients to use to generate an ultrablur image.

Authorizations:
user_token
query Parameters
url
string
Example: url=/library/metadata/217745/art/1718931408

Url for image which requires color extraction. Can be relative PMS library path or absolute url.

Responses

Response samples

Content type
application/json

Colors extracted from provided image url.

{
  • "MediaContainer": {
    }
}

Get UltraBlur Image

Retrieves a server-side generated UltraBlur image based on the provided color inputs. Clients should always call this via the photo transcoder endpoint.

Authorizations:
user_token
query Parameters
topLeft
string
Example: topLeft=3f280a

The base color (hex) for the top left quadrant.

topRight
string
Example: topRight=6b4713

The base color (hex) for the top right quadrant.

bottomRight
string
Example: bottomRight=0f2a43

The base color (hex) for the bottom right quadrant.

bottomLeft
string
Example: bottomLeft=1c425d

The base color (hex) for the bottom left quadrant.

width
integer [ 320 .. 3840 ]
Example: width=1920

Width in pixels for the image.

height
integer [ 240 .. 2160 ]
Example: height=1080

Height in pixels for the image.

noise
integer
Enum: 0 1
Example: noise=1

Whether to add noise to the ouput image. Noise can reduce color banding with the gradients. Image sizes with noise will be larger.

Responses

Response samples

Content type
text/html
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>

Transcoder

Transcode an image

Transcode an image, possibly changing format or size

Authorizations:
user_token
query Parameters
url
string
Example: url=/library/metadata/265/thumb/1715112705

The source URL for the image to transcode. Note, if this URL requires a token such as X-Plex-Token, it should be given as a query parameter to this url.

format
string
Enum: "jpg" "jpeg" "png" "ppm"

The output format for the image; defaults to jpg

width
integer

The desired width of the output image

height
integer

The desired height of the output image

quality
integer [ -1 .. 127 ]

The desired quality of the output. -1 means the highest quality. Defaults to -1

background
string
Example: background=#ff5522

The background color to apply before painting the image. Only really applicable if image has transparency. Defaults to none

upscale
integer
Enum: 0 1

Indicates if image should be upscaled to the desired width/height. Defaults to false

minSize
integer
Enum: 0 1

Indicates if image should be scaled to fit the smaller dimension. By default (false) the image is scaled to fit within the width/height specified but if this parameter is true, it will allow overflowing one dimension to fit the other. Essentially it is making the width/height minimum sizes of the image or sizing the image to fill the entire width/height even if it overflows one dimension.

rotate
integer
Enum: 0 1

Obey the rotation values specified in EXIF data. Defaults to true.

blur
integer

Apply a blur to the image, Defaults to 0 (none)

saturation
integer [ 0 .. 100 ]

Scale the image saturation by the specified percentage. Defaults to 100

opacity
integer [ 0 .. 100 ]

Render the image at the specified opacity percentage. Defaults to 100

chromaSubsampling
integer
Enum: 0 1 2 3

Use the specified chroma subsambling.

  • 0: 411
  • 1: 420
  • 2: 422
  • 3: 444 Defaults to 3 (444)
blendColor
string
Example: blendColor=#ff5522

The color to blend with the image. Defaults to none

Responses

Response samples

Content type
text/html
<html><head><title>Bad Request</title></head><body><h1>400 Bad Request</h1></body></html>

Make a decision on media playback

Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.

Authorizations:
user_token
path Parameters
transcodeType
required
string
Enum: "video" "music" "audio" "subtitles"

Type of transcode media

query Parameters
transcodeSessionId
string

Transcode session UUID

advancedSubtitles
string
Enum: "burn" "text" "unknown"
Example: advancedSubtitles=burn

Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost

audioBoost
integer >= 1
Example: audioBoost=50

Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)

audioChannelCount
integer [ 1 .. 8 ]
Example: audioChannelCount=5

Target video number of audio channels.

autoAdjustQuality
integer
Enum: 0 1
Example: autoAdjustQuality=1

Indicates the client supports ABR.

autoAdjustSubtitle
integer
Enum: 0 1
Example: autoAdjustSubtitle=1

Indicates if the server should adjust subtitles based on Voice Activity Data.

directPlay
integer
Enum: 0 1
Example: directPlay=1

Indicates the client supports direct playing the indicated content.

directStream
integer
Enum: 0 1
Example: directStream=1

Indicates the client supports direct streaming the video of the indicated content.

directStreamAudio
integer
Enum: 0 1
Example: directStreamAudio=1

Indicates the client supports direct streaming the audio of the indicated content.

disableResolutionRotation
integer
Enum: 0 1
Example: disableResolutionRotation=1

Indicates if resolution should be adjusted for orientation.

hasMDE
integer
Enum: 0 1
Example: hasMDE=1

Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1

location
string
Enum: "lan" "wan" "cellular"
Example: location=wan

Network type of the client, can be used to help determine target bitrate.

mediaBufferSize
integer
Example: mediaBufferSize=102400

Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.

mediaIndex
integer

Index of the media to transcode. -1 or not specified indicates let the server choose.

musicBitrate
integer >= 0
Example: musicBitrate=5000

Target bitrate for audio only files (in kbps, used to transcode).

offset
number
Example: offset=90.5

Offset from the start of the media (in seconds).

partIndex
integer

Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode

path
string
Example: path=/library/metadata/151671

Internal PMS path of the media to transcode.

peakBitrate
integer >= 0
Example: peakBitrate=12000

Maximum bitrate (in kbps) to use in ABR.

photoResolution
string^\d[x:]\d$
Example: photoResolution=1080x1080

Target photo resolution.

protocol
string
Enum: "http" "hls" "dash"
Example: protocol=dash

Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)

secondsPerSegment
integer
Example: secondsPerSegment=5

Number of seconds to include in each transcoded segment

subtitleSize
integer >= 1
Example: subtitleSize=50

Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)

subtitles
string
Enum: "auto" "burn" "none" "sidecar" "embedded" "segmented" "unknown"
Example: subtitles=Burn

Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream

videoBitrate
integer >= 0
Example: videoBitrate=12000

Target video bitrate (in kbps).

videoQuality
integer [ 0 .. 99 ]
Example: videoQuality=50

Target photo quality.

videoResolution
string^\d[x:]\d$
Example: videoResolution=1080x1080

Target maximum video resolution.

header Parameters
X-Plex-Client-Identifier
required
string

Unique per client.

X-Plex-Client-Profile-Extra
string
Example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264,hevc&audioCodec=aac&protocol=dash)
X-Plex-Client-Profile-Name
string
Example: generic

Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.

X-Plex-Device
string
Example: Windows

Device the client is running on

X-Plex-Model
string
Example: standalone

Model of the device the client is running on

X-Plex-Platform
string
Example: Chrome

Client Platform

X-Plex-Platform-Version
string
Example: 135

Client Platform Version

X-Plex-Session-Identifier
string

Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Manually trigger a transcoder fallback

Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw

Authorizations:
user_token
path Parameters
transcodeType
required
string
Enum: "video" "music" "audio" "subtitles"

Type of transcode media

query Parameters
transcodeSessionId
string

Transcode session UUID

Responses

Response samples

Content type
text/html

Start A Transcoding Session

Starts the transcoder and returns the corresponding streaming resource document.

Authorizations:
user_token
path Parameters
transcodeType
required
string
Enum: "video" "music" "audio" "subtitles"

Type of transcode media

query Parameters
transcodeSessionId
string

Transcode session UUID

advancedSubtitles
string
Enum: "burn" "text" "unknown"
Example: advancedSubtitles=burn

Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost

audioBoost
integer >= 1
Example: audioBoost=50

Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)

audioChannelCount
integer [ 1 .. 8 ]
Example: audioChannelCount=5

Target video number of audio channels.

autoAdjustQuality
integer
Enum: 0 1
Example: autoAdjustQuality=1

Indicates the client supports ABR.

autoAdjustSubtitle
integer
Enum: 0 1
Example: autoAdjustSubtitle=1

Indicates if the server should adjust subtitles based on Voice Activity Data.

directPlay
integer
Enum: 0 1
Example: directPlay=1

Indicates the client supports direct playing the indicated content.

directStream
integer
Enum: 0 1
Example: directStream=1

Indicates the client supports direct streaming the video of the indicated content.

directStreamAudio
integer
Enum: 0 1
Example: directStreamAudio=1

Indicates the client supports direct streaming the audio of the indicated content.

disableResolutionRotation
integer
Enum: 0 1
Example: disableResolutionRotation=1

Indicates if resolution should be adjusted for orientation.

hasMDE
integer
Enum: 0 1
Example: hasMDE=1

Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1

location
string
Enum: "lan" "wan" "cellular"
Example: location=wan

Network type of the client, can be used to help determine target bitrate.

mediaBufferSize
integer
Example: mediaBufferSize=102400

Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.

mediaIndex
integer

Index of the media to transcode. -1 or not specified indicates let the server choose.

musicBitrate
integer >= 0
Example: musicBitrate=5000

Target bitrate for audio only files (in kbps, used to transcode).

offset
number
Example: offset=90.5

Offset from the start of the media (in seconds).

partIndex
integer

Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode

path
string
Example: path=/library/metadata/151671

Internal PMS path of the media to transcode.

peakBitrate
integer >= 0
Example: peakBitrate=12000

Maximum bitrate (in kbps) to use in ABR.

photoResolution
string^\d[x:]\d$
Example: photoResolution=1080x1080

Target photo resolution.

protocol
string
Enum: "http" "hls" "dash"
Example: protocol=dash

Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)

secondsPerSegment
integer
Example: secondsPerSegment=5

Number of seconds to include in each transcoded segment

subtitleSize
integer >= 1
Example: subtitleSize=50

Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)

subtitles
string
Enum: "auto" "burn" "none" "sidecar" "embedded" "segmented" "unknown"
Example: subtitles=Burn

Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream

videoBitrate
integer >= 0
Example: videoBitrate=12000

Target video bitrate (in kbps).

videoQuality
integer [ 0 .. 99 ]
Example: videoQuality=50

Target photo quality.

videoResolution
string^\d[x:]\d$
Example: videoResolution=1080x1080

Target maximum video resolution.

header Parameters
X-Plex-Client-Identifier
required
string

Unique per client.

X-Plex-Client-Profile-Extra
string
Example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264,hevc&audioCodec=aac&protocol=dash)
X-Plex-Client-Profile-Name
string
Example: generic

Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.

X-Plex-Device
string
Example: Windows

Device the client is running on

X-Plex-Model
string
Example: standalone

Model of the device the client is running on

X-Plex-Platform
string
Example: Chrome

Client Platform

X-Plex-Platform-Version
string
Example: 135

Client Platform Version

X-Plex-Session-Identifier
string

Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)

Responses

Response samples

Content type
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="urn:mpeg:dash:schema:mpd:2011"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
    profiles="urn:mpeg:dash:profile:isoff-live:2011"
    type="static"
    mediaPresentationDuration="PT0H10M34.5333S"
    maxSegmentDuration="PT2S"
    minBufferTime="PT10S">
    <Period start="PT0S" id="0" duration="PT0H10M34.5333S">
        <AdaptationSet segmentAlignment="true">
            <SegmentTemplate timescale="1" duration="1" initialization="session/00lsab52ccmh9htfgwqz0o8k/$RepresentationID$/header" media="session/00lsab52ccmh9htfgwqz0o8k/$RepresentationID$/$Number$.m4s" startNumber="0">
            </SegmentTemplate>
            <Representation id="0" mimeType="video/mp4" codecs="avc1.640028" bandwidth="20000000" width="1920" height="1080">
            </Representation>
        </AdaptationSet>
        <AdaptationSet segmentAlignment="true">
            <SegmentTemplate timescale="1" duration="1" initialization="session/00lsab52ccmh9htfgwqz0o8k/$RepresentationID$/header" media="session/00lsab52ccmh9htfgwqz0o8k/$RepresentationID$/$Number$.m4s" startNumber="0">
            </SegmentTemplate>
            <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="256000" audioSamplingRate="48000">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

Transcode subtitles

Only transcode subtitle streams.

Authorizations:
user_token
path Parameters
transcodeType
required
string
Enum: "video" "music" "audio" "subtitles"

Type of transcode media

query Parameters
transcodeSessionId
string

Transcode session UUID

advancedSubtitles
string
Enum: "burn" "text" "unknown"
Example: advancedSubtitles=burn

Indicates how incompatible advanced subtitles (such as ass/ssa) should be included: * 'burn' - Burn incompatible advanced text subtitles into the video stream * 'text' - Transcode incompatible advanced text subtitles to a compatible text format, even if some markup is lost

audioBoost
integer >= 1
Example: audioBoost=50

Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)

audioChannelCount
integer [ 1 .. 8 ]
Example: audioChannelCount=5

Target video number of audio channels.

autoAdjustQuality
integer
Enum: 0 1
Example: autoAdjustQuality=1

Indicates the client supports ABR.

autoAdjustSubtitle
integer
Enum: 0 1
Example: autoAdjustSubtitle=1

Indicates if the server should adjust subtitles based on Voice Activity Data.

directPlay
integer
Enum: 0 1
Example: directPlay=1

Indicates the client supports direct playing the indicated content.

directStream
integer
Enum: 0 1
Example: directStream=1

Indicates the client supports direct streaming the video of the indicated content.

directStreamAudio
integer
Enum: 0 1
Example: directStreamAudio=1

Indicates the client supports direct streaming the audio of the indicated content.

disableResolutionRotation
integer
Enum: 0 1
Example: disableResolutionRotation=1

Indicates if resolution should be adjusted for orientation.

hasMDE
integer
Enum: 0 1
Example: hasMDE=1

Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1

location
string
Enum: "lan" "wan" "cellular"
Example: location=wan

Network type of the client, can be used to help determine target bitrate.

mediaBufferSize
integer
Example: mediaBufferSize=102400

Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.

mediaIndex
integer

Index of the media to transcode. -1 or not specified indicates let the server choose.

musicBitrate
integer >= 0
Example: musicBitrate=5000

Target bitrate for audio only files (in kbps, used to transcode).

offset
number
Example: offset=90.5

Offset from the start of the media (in seconds).

partIndex
integer

Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode

path
string
Example: path=/library/metadata/151671

Internal PMS path of the media to transcode.

peakBitrate
integer >= 0
Example: peakBitrate=12000

Maximum bitrate (in kbps) to use in ABR.

photoResolution
string^\d[x:]\d$
Example: photoResolution=1080x1080

Target photo resolution.

protocol
string
Enum: "http" "hls" "dash"
Example: protocol=dash

Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)

secondsPerSegment
integer
Example: secondsPerSegment=5

Number of seconds to include in each transcoded segment

subtitleSize
integer >= 1
Example: subtitleSize=50

Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)

subtitles
string
Enum: "auto" "burn" "none" "sidecar" "embedded" "segmented" "unknown"
Example: subtitles=Burn

Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream

videoBitrate
integer >= 0
Example: videoBitrate=12000

Target video bitrate (in kbps).

videoQuality
integer [ 0 .. 99 ]
Example: videoQuality=50

Target photo quality.

videoResolution
string^\d[x:]\d$
Example: videoResolution=1080x1080

Target maximum video resolution.

header Parameters
X-Plex-Client-Identifier
required
string

Unique per client.

X-Plex-Client-Profile-Extra
string
Example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264,hevc&audioCodec=aac&protocol=dash)
X-Plex-Client-Profile-Name
string
Example: generic

Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.

X-Plex-Device
string
Example: Windows

Device the client is running on

X-Plex-Model
string
Example: standalone

Model of the device the client is running on

X-Plex-Platform
string
Example: Chrome

Client Platform

X-Plex-Platform-Version
string
Example: 135

Client Platform Version

X-Plex-Session-Identifier
string

Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)

Responses

Response samples

Content type
text/srt
1
00:00:02,499 --> 00:00:06,416
[SERENE MUSIC]

2
00:00:11,791 --> 00:00:13,958
[BROOK BABBLES] 
[FLY BUZZES]

3
00:00:16,166 --> 00:00:17,666
[BIRD TWEETS]

4
00:00:17,666 --> 00:00:18,708
[WINGS FLAP]

5
00:00:19,833 --> 00:00:20,374
[BIRD TWEETS] 
[WINGS FLAP]

6
00:00:20,374 --> 00:00:21,041
[THUD]

7
00:00:21,374 --> 00:00:22,249
[THUD]

8
00:00:22,249 --> 00:00:23,083
[SQUIRREL LAUGHS]

9
00:00:26,249 --> 00:00:27,541
[SNORES]

10
00:00:29,416 --> 00:00:30,708
[SNORES]

11
00:00:32,749 --> 00:00:34,041
[BUNNY SNORES]

12
00:00:35,916 --> 00:00:37,249
[BUNNY SNORES]

Provider

Media providers are the starting points for the entire Plex Media Server media library API. It defines the paths for the groups of endpoints. The /media/providers should be the only hard-coded path in clients when accessing the media library. Non-media library endpoints are outside the scope of the media provider. See the description in See the section in API Info for more information on how to use media providers.

Get the list of available media providers

Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up.

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add a media provider

This endpoint registers a media provider with the server. Once registered, the media server acts as a reverse proxy to the provider, allowing both local and remote providers to work.

Authorizations:
user_token
query Parameters
url
required
string

The URL of the media provider to add.

Responses

Response samples

Content type
text/html

Refresh media providers

Refresh all known media providers. This is useful in case a provider has updated features.

Authorizations:
user_token

Responses

Response samples

Content type
text/html

Delete a media provider

Deletes a media provider with the given id

Authorizations:
user_token
path Parameters
provider
required
string

The ID of the media provider to delete

Responses

Response samples

Content type
text/html

Content

The actual content of the media provider

Get a collection's image

Get an image for the collection based on the items within

Authorizations:
user_token
path Parameters
collectionId
required
integer

The collection id

updatedAt
required
integer

The update time of the image. Used for busting cache.

query Parameters
object
Examples:
  • rows=2&cols=2&width=512&height=512&border=0&type=-1&format=jpg&crop=center&repeat=true&media=thumb&backgroundColor=0 - The default parameters if none are provided
  • height=256&width=256 - Get a composite image in a smaller size

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

Get items in a collection

Get items in a collection. Note if this collection contains more than 100 items, paging must be used.

Authorizations:
user_token
path Parameters
collectionId
required
integer

The collection id

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a metadata item

Get one or more metadata items.

Authorizations:
user_token
path Parameters
ids
required
Array of strings
query Parameters
asyncCheckFiles
integer
Enum: 0 1

Determines if file check should be performed asynchronously. An activity is created to indicate progress. Default is false.

asyncRefreshLocalMediaAgent
integer
Enum: 0 1

Determines if local media agent refresh should be performed asynchronously. An activity is created to indicate progress. Default is false.

asyncRefreshAnalysis
integer
Enum: 0 1

Determines if analysis refresh should be performed asynchronously. An activity is created to indicate progress. Default is false.

checkFiles
integer
Enum: 0 1

Determines if file check should be performed synchronously. Specifying asyncCheckFiles will cause this option to be ignored. Default is false.

skipRefresh
integer
Enum: 0 1

Determines if synchronous local media agent and analysis refresh should be skipped. Specifying async versions will cause synchronous versions to be skipped. Default is false.

checkFileAvailability
integer
Enum: 0 1

Determines if file existence check should be performed synchronously. Specifying checkFiles will imply this option. Default is false.

asyncAugmentMetadata
integer
Enum: 0 1

Add metadata augmentations. An activity is created to indicate progress. Option will be ignored if specified by non-admin or if multiple metadata items are requested. Default is false.

augmentCount
integer
Enum: 0 1

Number of augmentations to add. Requires asyncAugmentMetadata to be specified.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get items in the section

Get the items in a section, potentially filtering them

Authorizations:
user_token
path Parameters
sectionId
required
string

The id of the section

query Parameters
mediaQuery
object
Examples:
  • type=4&sourceType=2&title==24 - Represents type = 4 AND sourceType = 2 AND title = "24"
  • type=4&sourceType=2&title==24&sort=duration:desc,index - Represents type = 4 AND sourceType = 2 AND title IS \"24\" sort by duration in descending order and index (ascending)"
  • rating=1,2,3&index=5 - Represents (rating=1 OR rating=2 OR rating=3) AND index=5
  • push=1&index=1&or=1&rating=2&pop=1&duration=10 - Represents (index = 1 OR rating = 2) AND duration = 10

This is a complex query built of several parameters. See API Info section for information on building media queries

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section leaves

Get all leaves in a section (such as episodes in a show section)

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section artwork

Get artwork for a library section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section albums

Get all albums in a music section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section categories

Get categories in a library section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section clusters

Get clusters in a library section (typically for photos)

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Similar tracks to transition from one to another

Get a list of audio tracks starting at one and ending at another which are similar across the path

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
startID
required
integer

The starting metadata item id

endID
required
integer

The ending metadata item id

count
integer

The number of items along the path; defaults to 50

maxDistance
number

The maximum distance allowed along the path; defaults to 0.25

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get all folder locations

Get all folder locations of the media in a section

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

The nearest audio tracks

Get the nearest audio tracks to a particular analysis

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

query Parameters
type
integer

The metadata type to fetch (should be 10 for audio track)

values
required
Array of integers[ items [ 50 .. 50 ] ]

The music analysis to center the search. Typically obtained from the musicAnalysis of a track

limit
integer

The limit of the number of items to fetch; defaults to 50

maxDistance
number

The maximum distance to search, defaults to 0.25

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set section moments

Get moments in a library section (typically for photos)

Authorizations:
user_token
path Parameters
sectionId
required
integer

Section identifier

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Hubs

The hubs within a media provider

Get global hubs

Get the global hubs in this PMS

Authorizations:
user_token
query Parameters
count
integer

Limit hub entries to count items

onlyTransient
integer
Enum: 0 1

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)

identifier
Array of strings

If provided, limit to only specified hubs

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a hub's items

Get the items within a single hub specified by identifier

Authorizations:
user_token
query Parameters
count
integer

Limit hub entry to count items

identifier
required
Array of strings

If provided, limit to only specified hubs

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get the continue watching hub

Get the global continue watching hub

Authorizations:
user_token
query Parameters
count
integer

Limit hub entry to count items

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get the hubs which are promoted

Get the global hubs which are promoted (should be displayed on the home screen)

Authorizations:
user_token
query Parameters
count
integer

Limit hub entry to count items

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get hubs for a section by metadata item

Get the hubs for a section by metadata item. Currently only for music sections

Authorizations:
user_token
path Parameters
metadataId
required
integer

The metadata ID for the hubs to fetch

query Parameters
count
integer

Limit hub entries to count items

onlyTransient
integer
Enum: 0 1

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)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get related hubs

Get the hubs for a metadata related to the provided metadata item

Authorizations:
user_token
path Parameters
metadataId
required
integer

The metadata ID for the hubs to fetch

query Parameters
count
integer

Limit hub entries to count items

onlyTransient
integer
Enum: 0 1

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)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get postplay hubs

Get the hubs for a metadata to be displayed in post play

Authorizations:
user_token
path Parameters
metadataId
required
integer

The metadata ID for the hubs to fetch

query Parameters
count
integer

Limit hub entries to count items

onlyTransient
integer
Enum: 0 1

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)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get section hubs

Get the hubs for a single section

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to fetch

query Parameters
count
integer

Limit hub entries to count items

onlyTransient
integer
Enum: 0 1

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)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get hubs

Get the list of hubs including both built-in and custom

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to reorder

query Parameters
metadataItemId
integer

Restrict hubs to ones relevant to the provided metadata item

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Reset hubs to defaults

Reset hubs for this section to defaults and delete custom hubs

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to reorder

Responses

Response samples

Content type
text/html

Create a custom hub

Create a custom hub based on a metadata item

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to reorder

query Parameters
metadataItemId
required
integer

The metadata item on which to base this hub. This must currently be a collection

promotedToRecommended
integer
Enum: 0 1

Whether this hub should be displayed in recommended

promotedToOwnHome
integer
Enum: 0 1

Whether this hub should be displayed in admin's home

promotedToSharedHome
integer
Enum: 0 1

Whether this hub should be displayed in shared user's home

Responses

Response samples

Content type
text/html

Move Hub

Changed the ordering of a hub among others hubs

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to reorder

query Parameters
identifier
required
string

The identifier of the hub to move

after
string

The identifier of the hub to order this hub after (or empty/missing to put this hub first)

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Change hub visibility

Changed the visibility of a hub for both the admin and shared users

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to change

identifier
required
string

The identifier of the hub to change

query Parameters
promotedToRecommended
integer
Enum: 0 1

Whether this hub should be displayed in recommended

promotedToOwnHome
integer
Enum: 0 1

Whether this hub should be displayed in admin's home

promotedToSharedHome
integer
Enum: 0 1

Whether this hub should be displayed in shared user's home

Responses

Response samples

Content type
text/html

Delete a custom hub

Delete a custom hub from the server

Authorizations:
user_token
path Parameters
sectionId
required
integer

The section ID for the hubs to change

identifier
required
string

The identifier of the hub to change

Responses

Response samples

Content type
text/html

Search

The search feature within a media provider

Search Hub

Perform a search and get the result as hubs

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.

Authorizations:
user_token
query Parameters
query
required
string

The query term

sectionId
integer
Example: sectionId=1

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

limit
integer

The number of items to return per hub. 3 if not specified

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Voice Search Hub

Perform a search tailored to voice input and get the result as hubs

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.

Authorizations:
user_token
query Parameters
query
required
string

The query term

type
integer
Example: type=8

The type of thing to limit the search to.

limit
integer

The number of items to return per hub. 3 if not specified

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Rate

The rate feature within a media provider

Rate an item

Set the rating on an item. This API does respond to the GET verb but applications should use PUT

Authorizations:
user_token
query Parameters
identifier
required
string

The identifier of the media provider containing the media to rate. Typically com.plexapp.plugins.library

key
required
string

The key of the item to rate. This is the ratingKey found in metadata items

rating
required
number [ 0 .. 10 ]

The rating to give the item.

ratedAt
integer

The time when the rating occurred. If not present, interpreted as now.

Responses

Response samples

Content type
text/html

Playlist

The playlist feature within a media provider 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.

Retrieve Playlists

Gets a list of playlists and playlist folders for a user. General filters are permitted, such as sort=lastViewedAt:desc. A flat playlist list can be retrieved using type=15 to limit the collection to just playlists.

Authorizations:
user_token
query Parameters
playlistType
string
Enum: "audio" "video" "photo"

Limit to a type of playlist

smart
integer
Enum: 0 1

Type of playlists to return, smart or not. When not provided, will return both.

Responses

Response samples

Content type
application/json

A list of playlists

{
  • "MediaContainer": {
    }
}

Retrieve 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.

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

Responses

Response samples

Content type
application/json

An example playlist

{
  • "MediaContainer": {
    }
}

Retrieve Playlist Contents

Gets the contents if 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.

Authorizations:
user_token
path Parameters
playlistId
required
integer

The ID of the playlist

query Parameters
type
Array of integers

The metadata types of the item to return. Values past the first are only used in fetching items from the background processing playlist.

Responses

Response samples

Content type
application/json

Example playlist items

{
  • "MediaContainer": {
    }
}

Play Queue

The playqueue feature within a media provider A play queue represents the current list of media for playback. Although queues are persisted by the server, they should be regarded by the user as a fairly lightweight, an ephemeral list of items queued up for playback in a session. There is generally one active queue for each type of media (music, video, photos) that can be added to or destroyed and replaced with a fresh queue. Play Queues has a region, which we refer to in this doc (partially for historical reasons) as "Up Next". This region is defined by playQueueLastAddedItemID existing on the media container. This follows iTunes' terminology. It is a special region after the currently playing item but before the originally-played items. This enables "Party Mode" listening/viewing, where items can be added on-the-fly, and normal queue playback resumed when completed. You can visualize the play queue as a sliding window in the complete list of media queued for playback. This model is important when scaling to larger play queues (e.g. shuffling 40,000 audio tracks). The client only needs visibility into small areas of the queue at any given time, and the server can optimize access in this fashion. All created play queues will have an empty "Up Next" area - unless the item is an album and no key is provided. In this case the "Up Next" area will be populated by the contents of the album. This is to allow queueing of multiple albums - since the 'Add to Up Next' will insert after all the tracks. This means that If you're creating a PQ from an album, you can only shuffle it if you set key. This is due to the above implicit queueing of albums when no key is provided as well as the current limitation that you cannot shuffle a PQ with an "Up Next" area. The play queue window advances as the server receives timeline requests. The client needs to retrieve the play queue as the “now playing” item changes. There is no play queue API to update the playing item.

Create a play queue

Makes a new play queue for a device. The source of the playqueue can either be a URI, or a playlist. The response is a media container with the initial items in the queue. Each item in the queue will be a regular item but with playQueueItemID - a unique ID since the queue could have repeated items with the same ratingKey. Note: Either uri or playlistID must be specified

Authorizations:
user_token
query Parameters
uri
string

The content URI for what we're playing.

playlistID
integer

the ID of the playlist we're playing.

type
required
string
Enum: "audio" "video" "photo"

The type of play queue to create

key
string

The key of the first item to play, defaults to the first in the play queue.

shuffle
integer
Enum: 0 1

Whether to shuffle the playlist, defaults to 0.

repeat
integer
Enum: 0 1

If the PQ is bigger than the window, fill any empty space with wraparound items, defaults to 0.

continuous
integer
Enum: 0 1

Whether to create a continuous play queue (e.g. from an episode), defaults to 0.

extrasPrefixCount
integer

Number of trailers to prepend a movie with not including the pre-roll. If omitted the pre-roll will not be returned in the play queue. When resuming a movie extrasPrefixCount should be omitted as a parameter instead of passing 0.

recursive
integer
Enum: 0 1

Only applies to queues of type photo, whether to retrieve all descendent photos from an album or section, defaults to 1.

onDeck
integer
Enum: 0 1

Only applies to queues of type show or seasons, whether to return a queue that is started on the On Deck episode if one exists. Otherwise begins the play queue on the beginning of the show or season.

Responses

Response samples

Content type
application/json

A play queue

{
  • "MediaContainer": {
    }
}

Retrieve a play queue

Retrieves the play queue, centered at current item. This can be treated as a regular container by play queue-oblivious clients, but they may wish to request a large window onto the queue since they won't know to refresh.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

query Parameters
own
integer
Enum: 0 1

If the server should transfer ownership to the requesting client (used in remote control scenarios).

center
string

The play queue item ID for the center of the window - this doesn't change the current selected item.

window
integer

How many items on each side of the center of the window

includeBefore
integer
Enum: 0 1

Whether to include the items before the center (if 0, center is not included either), defaults to 1.

includeAfter
integer
Enum: 0 1

Whether to include the items after the center (if 0, center is not included either), defaults to 1.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Add a generator or playlist to a play queue

Adds an item to a play queue (e.g. party mode). Increments the version of the play queue. Takes the following parameters (uri and playlistID are mutually exclusive). Returns the modified play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

query Parameters
uri
string

The content URI for what we're adding to the queue.

playlistID
string

The ID of the playlist to add to the playQueue.

next
integer
Enum: 0 1

Play this item next (defaults to 0 - queueing at the end of manually queued items).

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Clear a play queue

Deletes all items in the play queue, and increases the version of the play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

Responses

Response samples

Content type
application/json

An empty play queue

{
  • "MediaContainer": {
    }
}

Delete an item from a play queue

Deletes an item in a play queue. Increments the version of the play queue. Returns the modified play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

playQueueItemId
required
integer

The play queue item ID to delete.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Move an item in a play queue

Moves an item in a play queue, and increases the version of the play queue. Returns the modified play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

playQueueItemId
required
integer

The play queue item ID to delete.

query Parameters
after
integer

The play queue item ID to insert the new item after. If not present, moves to the beginning.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Reset a play queue

Reset a play queue to the first item being the current item

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Shuffle a play queue

Shuffle a play queue (or reshuffles if already shuffled). The currently selected item is maintained. Note that this is currently only supported for play queues without an Up Next area. Returns the modified play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

Responses

Response samples

Content type
application/json

A shuffled play queue

{
  • "MediaContainer": {
    }
}

Unshuffle a play queue

Unshuffles a play queue and restores "natural order". Note that this is currently only supported for play queues without an Up Next area. Returns the modified play queue.

Authorizations:
user_token
path Parameters
playQueueId
required
integer

The ID of the play queue.

Responses

Response samples

Content type
application/json

A created playlist

{
  • "MediaContainer": {
    }
}

Timeline

The actions feature within a media provider

Mark an item as played

Mark an item as played. Note, this does not create any view history of this item but rather just sets the state as played. The client must provide either the key or uri query parameter This API does respond to the GET verb but applications should use PUT

Authorizations:
user_token
query Parameters
identifier
required
string

The identifier of the media provider containing the media to rate. Typically com.plexapp.plugins.library

key
string

The key of the item to rate. This is the ratingKey found in metadata items

uri
string

The URI of the item to mark as played. See intro for description of the URIs

Responses

Response samples

Content type
text/html

Report media timeline

This endpoint is hit during media playback for an item. It must be hit whenever the play state changes, or in the absence of a play state change, in a regular fashion (generally this means every 10 seconds on a LAN/WAN, and every 20 seconds over cellular).

Authorizations:
user_token
query Parameters
key
string
Example: key=/foo

The details key for the item.

ratingKey
string
Example: ratingKey=xyz

The rating key attribute for the item.

state
string
Enum: "stopped" "buffering" "playing" "paused"
Example: state=playing

The current state of the media.

playQueueItemID
string
Example: playQueueItemID=123

If playing media from a play queue, the play queue's ID.

time
integer

The current time offset of playback in ms.

duration
integer
Example: duration=10000

The total duration of the item in ms.

continuing
integer
Enum: 0 1
Example: continuing=1

When state is stopped, a flag indicating whether or not the client is going to continue playing anothe item.

updated
integer
Example: updated=14200000

Used when a sync client comes online and is syncing media timelines, holds the time at which the playback state was last updated.

offline
integer
Enum: 0 1
Example: offline=1

Also used by sync clients, used to indicate that a timeline is being synced from being offline, as opposed to being "live".

timeToFirstFrame
integer
Example: timeToFirstFrame=1000

Time in seconds till first frame is displayed. Sent only on the first playing timeline request.

timeStalled
integer
Example: timeStalled=1000

Time in seconds spent buffering since last request.

bandwidth
integer
Example: bandwidth=100

Bandwidth in kbps as estimated by the client.

bufferedTime
integer
Example: bufferedTime=100

Amount of time in seconds buffered by client. Omit if computed by bufferedSize below.

bufferedSize
integer
Example: bufferedSize=1024

Size in kilobytes of data buffered by client. Omit if computed by bufferedTime above

header Parameters
X-Plex-Client-Identifier
required
string

Unique per client.

X-Plex-Session-Identifier
string

Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)

Responses

Response samples

Content type
application/json
Example

Normal response

{
  • "MediaContainer": {
    }
}

Mark an item as unplayed

Mark an item as unplayed. The client must provide either the key or uri query parameter This API does respond to the GET verb but applications should use PUT

Authorizations:
user_token
query Parameters
identifier
required
string

The identifier of the media provider containing the media to rate. Typically com.plexapp.plugins.library

key
string

The key of the item to rate. This is the ratingKey found in metadata items

uri
string

The URI of the item to mark as played. See intro for description of the URIs

Responses

Response samples

Content type
text/html

DVRs

The DVR provides means to watch and record live TV. This section of endpoints describes how to setup the DVR itself

Get DVRs

Get the list of all available DVRs

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Create a DVR

Creation of a DVR, after creation of a devcie and a lineup is selected

Authorizations:
user_token
query Parameters
lineup
string
Example: lineup=lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT

The EPG lineup.

device
Array of strings
Example: device=device[]=device://tv.plex.grabbers.hdhomerun/1053C0CA

The device.

language
string
Example: language=eng

The language.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a single DVR

Get a single DVR by its id (key)

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a single DVR

Delete a single DVR by its id (key)

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

Responses

Response samples

Content type
text/html

Tune a channel on a DVR

Tune a channel on a DVR to the provided channel

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

channel
required
string
Example: 2.1

The channel ID to tune

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add a device to an existing DVR

Add a device to an existing DVR

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

deviceId
required
integer

The ID of the device to add.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Remove a device from an existing DVR

Remove a device from an existing DVR

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

deviceId
required
integer

The ID of the device to add.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add a DVR Lineup

Add a lineup to a DVR device's set of lineups.

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

query Parameters
lineup
required
string

The lineup to delete

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a DVR Lineup

Deletes a DVR device's lineup.

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

query Parameters
lineup
required
string

The lineup to delete

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set DVR preferences

Set DVR preferences by name avd value

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

query Parameters
name
string

Set the name preference to the provided value

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Tell a DVR to reload program guide

Tell a DVR to reload program guide

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

Responses

Response samples

Content type
text/html

Tell a DVR to stop reloading program guide

Tell a DVR to stop reloading program guide

Authorizations:
user_token
path Parameters
dvrId
required
integer

The ID of the DVR.

Responses

Response samples

Content type
text/html

Devices

Media grabbers provide ways for media to be obtained for a given protocol. The simplest ones are stream and download. More complex grabbers can have associated devices

Network tuners can present themselves on the network using the Simple Service Discovery Protocol and Plex Media Server will discover them. The following XML is an example of the data returned from SSDP. The deviceType, serviceType, and serviceId values must remain as they are in the example in order for PMS to properly discover the device. Other less-obvious fields are described in the parameters section below.

Example SSDP output

<root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>0</minor>
    </specVersion>
    <device>
        <deviceType>urn:plex-tv:device:Media:1</deviceType>
        <friendlyName>Turing Hopper 3000</friendlyName>
        <manufacturer>Plex, Inc.</manufacturer>
        <manufacturerURL>https://plex.tv/</manufacturerURL>
        <modelDescription>Turing Hopper 3000 Media Grabber</modelDescription>
        <modelName>Plex Media Grabber</modelName>
        <modelNumber>1</modelNumber>
        <modelURL>https://plex.tv</modelURL>
        <UDN>uuid:42fde8e4-93b6-41e5-8a63-12d848655811</UDN>
        <serviceList>
            <service>
                <URLBase>http://10.0.0.5:8088</URLBase>
                <serviceType>urn:plex-tv:service:MediaGrabber:1</serviceType>
                <serviceId>urn:plex-tv:serviceId:MediaGrabber</serviceId>
            </service>
        </serviceList>
    </device>
</root>
  • UDN: (string) A UUID for the device. This should be unique across models of a device at minimum.
  • URLBase: (string) The base HTTP URL for the device from which all of the other endpoints are hosted.

Get available grabbers

Get available grabbers visible to the server

Authorizations:
user_token
query Parameters
protocol
string
Example: protocol=livetv

Only return grabbers providing this protocol.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get all devices

Get the list of all devices present

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Add a device

This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber.

Authorizations:
user_token
query Parameters
uri
string
Example: uri=http://10.0.0.5

The URI of the device.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Tell grabbers to discover devices

Tell grabbers to discover devices

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get device details

Get a device's details by its id

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Remove a device

Remove a devices by its id along with its channel mappings

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Enable or disable a device

Enable or disable a device by its id

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

query Parameters
enabled
integer
Enum: 0 1

Whether to enable the device

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set a device's channel mapping

Set a device's channel mapping

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

query Parameters
channelMapping
object
Example: channelMapping[46.3]=2&channelMapping[48.9]=4

The mapping of changes, passed as a map of device channel to lineup VCN.

channelMappingByKey
object
Example: channelMappingByKey[46.3]=5cc83d73af4a72001e9b16d7-5cab3c634df507001fefcad0&channelMappingByKey[48.9]=5cc83d73af4a72001e9b16d7-5cab3c63ec158a001d32db8d

The mapping of changes, passed as a map of device channel to lineup key.

channelsEnabled
Array of strings
Example: channelsEnabled=46.1,44.1,45.1

The channels which are enabled.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a device's channels

Get a device's channels by its id

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Set device preferences

Set device preferences by its id

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

query Parameters
name
string

The preference names and values.

Responses

Response samples

Content type
text/html

Tell a device to scan for channels

Tell a device to scan for channels

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

query Parameters
source
string
Example: source=Cable

A valid source for the scan

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Tell a device to stop scanning for channels

Tell a device to stop scanning for channels

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get device thumb

Get a device's thumb for display to the user

Authorizations:
user_token
path Parameters
deviceId
required
integer

The ID of the device.

version
required
integer

A version number of the thumb used for busting cache

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

EPG

The EPG (Electronic Program Guide) is responsible for obtaining metadata for what is airing on each channel and when

Compute the best channel map

Compute the best channel map, given device and lineup

Authorizations:
user_token
query Parameters
device
required
string

The URI describing the device

lineup
required
string

The URI describing the lineup

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get channels for a lineup

Get channels for a lineup within an EPG provider

Authorizations:
user_token
query Parameters
lineup
required
string

The URI describing the lineup

Responses

Response samples

Content type
application/json
{}

Get all countries

This endpoint returns a list of countries which EPG data is available for. There are three flavors, as specfied by the flavor attribute

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get lineups for a country via postal code

Returns a list of lineups for a given country, EPG provider and postal code

Authorizations:
user_token
path Parameters
country
required
string

3 letter country code

epgId
required
string

The providerIdentifier of the provider

query Parameters
postalCode
string

The postal code for the lineups to fetch

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get regions for a country

Get regions for a country within an EPG provider

Authorizations:
user_token
path Parameters
country
required
string

3 letter country code

epgId
required
string

The providerIdentifier of the provider

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get lineups for a region

Get lineups for a region within an EPG provider

Authorizations:
user_token
path Parameters
country
required
string

3 letter country code

epgId
required
string

The providerIdentifier of the provider

region
required
string

The region for the lineup

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get all languages

Returns a list of all possible languages for EPG data.

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Compute the best lineup

Compute the best lineup, given lineup group and device

Authorizations:
user_token
query Parameters
device
required
string

The URI describing the device

lineupGroup
required
string

The URI describing the lineupGroup

Responses

Response samples

Content type
text/html
<html><head><title>Not Found</title></head><body><h1>404 Not Found</h1></body></html>

Get the channels for mulitple lineups

Get the channels across multiple lineups

Authorizations:
user_token
query Parameters
lineup
required
Array of strings

The URIs describing the lineups

Responses

Response samples

Content type
application/json

A lineup channels

{
  • "MediaContainer": {
    }
}

Subscriptions

Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available

Cancel an existing grab

Cancels an existing media grab (recording). It can be used to resolve a conflict which exists for a rolling subscription. Note: This cancellation does not persist across a server restart, but neither does a rolling subscription itself.

Authorizations:
user_token
path Parameters
operationId
required
string

The ID of the operation.

Responses

Response samples

Content type
text/html

Get all subscriptions

Get all subscriptions and potentially the grabs too

Authorizations:
user_token
query Parameters
includeGrabs
integer
Enum: 0 1

Indicates whether the active grabs should be included as well

includeStorage
integer
Enum: 0 1

Compute the storage of recorded items desired by this subscription

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Create a subscription

Create a subscription. The query parameters should be mostly derived from the template

Authorizations:
user_token
query Parameters
targetLibrarySectionID
integer
Example: targetLibrarySectionID=1

The library section into which we'll grab the media. Not actually required when the subscription is to a playlist.

targetSectionLocationID
integer
Example: targetSectionLocationID=3

The section location into which to grab.

type
integer
Example: type=2

The type of the thing we're subscribing too (e.g. show, season).

hints
object
Example: hints[title]=Family Guy

Hints describing what we're looking for. Note: The hint ratingKey is required for downloading from a PMS remote.

prefs
object
Example: prefs[minVideoQuality]=720

Subscription preferences.

params
object
Example: params[mediaProviderID]=1

Subscription parameters.

  • mediaProviderID: Required for downloads to indicate which MP the subscription will download into
  • source: Required for downloads to indicate the source of the downloaded content.

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Process all subscriptions

Process all subscriptions asynchronously

Authorizations:
user_token

Responses

Response samples

Content type
text/html

Get a single subscription

Get a single subscription and potentially the grabs too

Authorizations:
user_token
path Parameters
subscriptionId
required
integer
query Parameters
includeGrabs
integer
Enum: 0 1

Indicates whether the active grabs should be included as well

includeStorage
integer
Enum: 0 1

Compute the storage of recorded items desired by this subscription

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Delete a subscription

Delete a subscription, cancelling all of its grabs as well

Authorizations:
user_token
path Parameters
subscriptionId
required
integer

Responses

Response samples

Content type
text/html

Edit a subscription

Edit a subscription's preferences

Authorizations:
user_token
path Parameters
subscriptionId
required
integer
query Parameters
prefs
object
Example: prefs[minVideoQuality]=720

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Re-order a subscription

Re-order a subscription to change its priority

Authorizations:
user_token
path Parameters
subscriptionId
required
integer
query Parameters
after
integer

The subscription to move this sub after. If missing will insert at the beginning of the list

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get all scheduled recordings

Get all scheduled recordings across all subscriptions

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get the subscription template

Get the templates for a piece of media which could include fetching one airing, season, the whole show, etc.

Authorizations:
user_token
query Parameters
guid
string
Example: guid=plex://episode/5fc70265c40548002d539d23

The guid of the item for which to get the template

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Live TV

LiveTV contains the playback sessions of a channel from a DVR device

Get all sessions

Get all livetv sessions and metadata

Authorizations:
user_token

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a single session

Get a single livetv session and metadata

Authorizations:
user_token
path Parameters
sessionId
required
string

The session id

Responses

Response samples

Content type
application/json
{
  • "MediaContainer": {
    }
}

Get a session playlist index

Get a playlist index for playing this session

Authorizations:
user_token
path Parameters
sessionId
required
string

The session id

consumerId
required
string

The consumer id

Responses

Response samples

Content type
application/vnd.apple.mpegurl
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PROGRAM-DATE-TIME:2024-05-22T17:18:48.044851000Z
#EXTINF:0.551044, nodesc
00000.ts
#EXTINF:1.001000, nodesc
00001.ts
#EXTINF:1.067323, nodesc
00002.ts
#EXTINF:1.001000, nodesc
00003.ts

Get a single session segment

Get a single livetv session segment

Authorizations:
user_token
path Parameters
sessionId
required
string

The session id

consumerId
required
string

The consumer id

segmentId
required
string

The segment id

Responses