Skip to main content
GET
/
resources
PlexPHP
declare(strict_types=1);

require 'vendor/autoload.php';

use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;

$sdk = Plex_API\PlexAPI::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();



$response = $sdk->plex->getServerResources(
    clientID: '3381b62b-9ab7-4e37-827b-203e9809eb58',
    includeHttps: Operations\IncludeHttps::Enable,
    includeRelay: Operations\IncludeRelay::Enable,
    includeIPv6: Operations\IncludeIPv6::Enable

);

if ($response->plexDevices !== null) {
    // handle response
}
[
  {
    "name": "<string>",
    "product": "<string>",
    "productVersion": "<string>",
    "platform": "<unknown>",
    "platformVersion": "<unknown>",
    "device": "<unknown>",
    "clientIdentifier": "<string>",
    "createdAt": "2019-06-24T11:38:02Z",
    "lastSeenAt": "2019-06-24T11:38:02Z",
    "provides": "<string>",
    "ownerId": "<unknown>",
    "sourceTitle": "<unknown>",
    "publicAddress": "<string>",
    "accessToken": "<string>",
    "owned": true,
    "home": true,
    "synced": true,
    "relay": true,
    "presence": true,
    "httpsRequired": true,
    "publicAddressMatches": true,
    "dnsRebindingProtection": true,
    "natLoopbackSupported": true,
    "connections": [
      {
        "protocol": "http",
        "address": "<string>",
        "port": 123,
        "uri": "<string>",
        "local": true,
        "relay": true,
        "IPv6": true
      }
    ]
  }
]

Authorizations

X-Plex-Token
string
header
required

The token which identifies the user accessing the PMS. This can be either:

  • A traditional access token obtained from plex.tv
  • A JWT token obtained through the JWT authentication flow

JWT tokens provide better security with:

  • Short-lived tokens (7 days expiration)
  • Public-key cryptography (ED25519)
  • Better clock synchronization
  • Individual device revocation capability

Headers

accepts
enum<string>
default:application/xml

Indicates the client accepts the indicated media types

Available options:
application/json,
application/xml
X-Plex-Client-Identifier
string
required

An opaque identifier unique to the client

Example:

"abc123"

Query Parameters

includeHttps
enum<integer>
default:0

Include Https entries in the results

Available options:
0,
1
Example:

1

includeRelay
enum<integer>
default:0
Available options:
0,
1
Example:

1

includeIPv6
enum<integer>
default:0

Include IPv6 entries in the results

Available options:
0,
1
Example:

1

Response

List of Plex Devices. This includes Plex hosted servers and clients

name
string
required
product
string
required
productVersion
string
required
platform
null | string
required
platformVersion
null | string
required
device
null | string
required
clientIdentifier
string
required
createdAt
string<date-time>
required

The time the device was created/registered

Example:

"2019-06-24T11:38:02Z"

lastSeenAt
string<date-time>
required

The last time the device was seen

Example:

"2019-06-24T11:38:02Z"

provides
string
required
ownerId
null | integer
required

ownerId is null when the device is owned by the token used to send the request

sourceTitle
null | string
required
publicAddress
string
required
accessToken
string
required
owned
boolean
required
home
boolean
required
synced
boolean
required
relay
boolean
required
presence
boolean
required
httpsRequired
boolean
required
publicAddressMatches
boolean
required
dnsRebindingProtection
boolean
required
natLoopbackSupported
boolean
required
connections
object[]
required