Plex.tv - Get Devices
When accessing and logging into a Plex Media server, the device used to access the server is added to the list of authorized devices. This list of devices can be returned from Plex.tv using the Plex server's token.
URL
GET https://plex.tv/devices.xml?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 devices that have accessed the Plex server. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer publicAddress="XXX.XXX.XXX.XXX"> <Device name="Desktop" publicAddress="XXX.XXX.XXX.XXX" product="Plexamp" productVersion="4.10.1" platform="Windows" platformVersion="10.0.19045" device="Windows" model="" vendor="" provides="client,player,pubsub-player" clientIdentifier="ce21643b-880d-4f38-b492-83d68f6e527c" version="4.10.1" id="1051450109" token="h5Q-qkjLkybavTwgNsgo" createdAt="1715866437" lastSeenAt="1720803362" screenResolution="" screenDensity=""> <Connection uri="http://192.168.1.130:32500"/> <Connection uri="http://192.168.23.1:32500"/> </Device> <Device name="Firefox" publicAddress="XXX.XXX.XXX.XXX" product="Plex Web" productVersion="4.133.0" platform="Firefox" platformVersion="127.0" device="Windows" model="hosted" vendor="" provides="" clientIdentifier="b9pon671jsf9i2rwh40kkdiz" version="4.133.0" id="1091679481" token="EEzT5G26yaiuVa3k6GoL" createdAt="1720793901" lastSeenAt="1720794274" screenResolution="1752x1078,1920x1200" screenDensity=""> </Device> </MediaContainer>
The XML returned provides a list of all devices currently authorized from a Plex account. The root is the MediaContainer
element. This element contains a single attribute that is the public IP address of the Plex server.
Attribute | Description |
---|---|
publicAddress | Flag indicating the public address of the server matches the current public address for the Plex account. 0 - the public address doesn't match. 1 - the public address matches. |
Within the MediaContainer
there are one or more Device
child elements. Each Device
element represents one authorized device.
Attribute | Description |
---|---|
name | The name of the device. |
publicAddress | The public IP address of the device. |
product | The name of the product associated with the device. |
productVersion | The version of the product. |
platform | The platform of the device. |
platformVersion | The version of the platform. |
device | The type of device. |
model | The model of the device. |
vendor | The vendor of the device. |
provides | The functionality the device provides. |
clientIdentifier | The unique identifier of the device. |
version | The version of the product. |
id | A unique ID. |
token | The token associated with the device. |
createdAt | When the device was associated to the Plex account. |
lastSeenAt | When the device last connected to the account. |
screenResolution | The screen resolution of the device. |
screenDensity | The density of the screen. |
There could be on or more Connection
child elements within each Device
element. Each Connection
element lists a URL associated to the device.
Attribute | Description |
---|---|
uri | The full URL to the device. |
Examples
curl -X GET https://plex.tv/devices.xml?X-Plex-Token={plex_token}
import requests plex_url = https://plex.tv/devices.xml?X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'https://plex.tv/devices.xml?X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response