Skip to content

Repository files navigation

Plex Media Server OpenAPI Specification

An Open Source OpenAPI Specification for Plex Media Server

Automation and SDKs provided by Speakeasy

Documentation

API Documentation

SDKs

The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.

LanguageRepositoryReleasesOther
PythonGitHubPyPI-
JavaScript/TypeScriptGitHubNPM \ JSR-
GoGitHubReleasesGoDoc
RubyGitHubReleases-
SwiftGitHubReleases-
PHPGitHubReleases-
JavaGitHubReleases-
C#GitHubReleases-

Project Structure

The main OpenAPI Specification is located in the root directory as pms-spec.yaml. Which references

  • /paths: The endpoints for the Plex Media Server API. Each endpoint is defined in a separate file.
  • /models: The schema models used in the specification.
  • /parameters: The parameters used in the specification.
  • /responses: The responses used in the specification.

In addition, there is a bundled single file OpenAPI Specification, plex-media-server-spec-dereferenced.yaml which is automatically bundled on any changes to the main specification.

Style Guide

All spec files should adhere to the 3.1 OpenAPI Specification.

Reference documentation can be found Here and Here.

Every endpoint is defined in the /paths directory, with Each endpoint defined in a separate file. The file name should be the endpoint name with the method type. For example, the endpoint /library/sections is defined in the file /paths/library_sections.get.yaml.

The file should contain data in the following order:

[get/post/put/delete]:
servers: # only specify if the endpoint requires a different server than the users plex serversecurity: # only specify if the endpoint requires authentication different from the global securitytags: - example # a list of tags that the endpoint belongs to, this is used for grouping in the documentation and SDKssummary: a brief description of the endpointdescription: a more detailed description of the endpointoperationId: anExampleOperationId # camel case summarizing the action being performed.parameters: # parameters are defined in the /parameters directory, or inline if they are not reused very much
- $ref: "../../parameters/..."# a reference to a parameter file in the /parameters directory
- name: example # a parameter that is not a referencein: query # the location of the parameter, can be query, path, header, or cookiedescription: an example parameterrequired: true # whether the parameter is required or not, path parameters are always required. Only specify this key if the parameter is requiredschema:
type: stringresponses:
2XX:
$ref: "../../responses/..."# a reference to a response file in the /responses directory4XX:
5XX:

Headers

Plex Media Server 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:

HeaderDescriptionSample
X-Plex-Client-IdentifierAn opaque identifier unique to the clientabc123
X-Plex-TokenAn authentication token, obtained from plex.tvXXXXXXXXXXXX
X-Plex-ProductThe name of the client productPlex for Roku
X-Plex-VersionThe version of the client application2.4.1
X-Plex-PlatformThe platform of the clientRoku
X-Plex-Platform-VersionThe version of the platform4.3 build 1057
X-Plex-DeviceA relatively friendly name for the client deviceRoku 3
X-Plex-ModelA potentially less friendly identifier for the device model4200X
X-Plex-Device-VendorThe device vendorRoku
X-Plex-Device-NameA friendly name for the clientLiving Room TV
X-Plex-MarketplaceThe marketplace on which the client application is distributedgooglePlay

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

Rules

  • A property in the response is only marked as required if it is always returned, regardless of the parameters sent with the request.
  • Although Plex.tv API uses the X-Plex-Token as a query parameter, this specification will always define this as a header parameter where supported since this follows industry security standards.
  • Though Plex does default return XML unless the accept header is set to application/json, this specification will not include the accept header in the endpoints. Assume it should always be included in the request.
  • Parameters added to endpoints via reference should always be specified at the bottom of the paramters set, since there is a large set of common parameters that are used across all endpoints.

Questions?

Reach out to me on the Discord Server

About

An open source Plex Media Server API Specification

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages