Plex.tv - Get Resources
This API endpoint will return a list of all resources.
URL
GET https://plex.tv/resources?X-Plex-Token={plex_token}Parameters
| Name | Description |
|---|---|
| plex_token | The Plex token. |
Return Status
| HTTP Code | Description |
|---|---|
| 200 | Success - The request was successful. |
| 401 | Unauthorized - The Plex token provided was not valid. |
Response
XML string value that lists the resources:
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="3">
<Device name="PlexServer" product="Plex Media Server" productVersion="1.40.4.8679-424562606" platform="Windows" platformVersion="10.0 (Build 19045)" device="PC" clientIdentifier="56c3281a85646683be8051dfb8c6a0964c0b04f1" createdAt="1449974814" lastSeenAt="1720814465" provides="server" owned="1" accessToken="Ds4gHEeLtH8nzj1t_dqG" publicAddress="XXX.XXX.XXX.XXX" httpsRequired="0" synced="0" relay="0" dnsRebindingProtection="0" publicAddressMatches="1" presence="1">
<Connection protocol="http" address="192.168.2.120" port="32400" uri="http://192.168.2.120:32400" local="1"/>
</Device>
<Device name="Android" product="Plexamp" productVersion="4.10.1" platform="Android" platformVersion="14" device="Android" clientIdentifier="37e1b9c1-f87d-4c37-92c3-84657d636f7b" createdAt="1667934149" lastSeenAt="1720646785" provides="client,player,pubsub-player" owned="1" publicAddress="XXX.XXX.XXX.XXX" publicAddressMatches="0" presence="0">
<Connection protocol="http" address="192.168.2.164" port="32500" uri="http://192.168.2.164:32500" local="1"/>
</Device>
<Device name="Desktop" product="Plexamp" productVersion="4.10.1" platform="Windows" platformVersion="10.0.19045" device="Windows" clientIdentifier="d8908091-f886-4e75-bcf4-79fbfd57a673" createdAt="1715866437" lastSeenAt="1720803362" provides="client,player,pubsub-player" owned="1" publicAddress="XXX.XXX.XXX.XXX" publicAddressMatches="1" presence="0">
<Connection protocol="http" address="192.168.2.100" port="32500" uri="http://192.168.2.100:32500" local="1"/>
<Connection protocol="http" address="192.168.56.1" port="32500" uri="http://192.168.56.1:32500" local="1"/>
</Device>
</MediaContainer>The XML returned provides a list of the resources. The root is the MediaContainer element. This element contains a single attribute that is the number of resources returned..
| Attribute | Description |
|---|---|
| size | The number of resources. |
Within the MediaContainer there are one or more Device child elements. Each Device element represents one resource.
| Attribute | Description |
|---|---|
| name | The name of the resource. |
| product | The name of the product associated with the resource. |
| productVersion | The version of the product. |
| platform | The platform of the resource. |
| platformVersion | The version of the platform. |
| device | The type of resource. |
| clientIdentifier | The unique identifier of the resource. |
| createdAt | When the resource was associated to the Plex account. |
| lastSeenAt | When the resource last connected to the account. |
| provides | The functionality the resource provides. |
| owned | Flag indicating if the resource is owned. 0 - the resource is not owned. 1 - the resource is owned. |
| accessToken | The token associated with the resource. |
| publicAddress | The public IP address of the resource. |
| publicAddressMatches | Unique identifier for the resource. |
| httpsRequired | Flag indicating https is required when connecting to the resource. 0 - https is not required. 1 - https is required. |
| synced | Flag indicating the resource is synced. 0 - the resource is not synced. 1 - the resource is synced. |
| relay | Flag indicating that the Plex relay is enabled for the resource. 0 - relay is not enabled. 1 - relay is enabled. |
| dnsRebindingProtection | DNS rebinding protection is enabled for the resource. 0 - DNS rebinding protection is not enabled. 1 - DNS rebinding protection is enabled. |
| publicAddressMatches | Unique identifier for the resource. |
| presence | Flag indicating the resource is currently active and present. 0 - the resource is not active or present. 1 - the resource is active and present. |
There could be on or more Connection child elements within each Device element. Each Connection element lists a URL associated to the resource.
| Attribute | Description |
|---|---|
| protocol | The protocol used to connect to the resource. |
| address | The address assigned to the resource. |
| port | The port used to connect to the resource. |
| uri | The full URL to the resource. |
| local | Flag indicating if the resource is local. 0 - the resource is not local. 1 - the resource is local. |
Examples
curl -X GET https://plex.tv/resources?X-Plex-Token={plex_token}
import requests
plex_url = https://plex.tv/resources?X-Plex-Token={plex_token}
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod "https://plex.tv/resources?X-Plex-Token={plex_token}" -Method GET
Write-Output $response