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

NameDescription
plex_tokenThe Plex token.

Return Status

HTTP CodeDescription
200Success - The request was successful.
401Unauthorized - 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.

MediaContainer Attributes
AttributeDescription
publicAddressFlag 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.

Device Attributes
AttributeDescription
nameThe name of the device.
publicAddressThe public IP address of the device.
productThe name of the product associated with the device.
productVersionThe version of the product.
platformThe platform of the device.
platformVersionThe version of the platform.
deviceThe type of device.
modelThe model of the device.
vendorThe vendor of the device.
providesThe functionality the device provides.
clientIdentifierThe unique identifier of the device.
versionThe version of the product.
idA unique ID.
tokenThe token associated with the device.
createdAtWhen the device was associated to the Plex account.
lastSeenAtWhen the device last connected to the account.
screenResolutionThe screen resolution of the device.
screenDensityThe 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.

Connection Attributes
AttributeDescription
uriThe 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

Subscribe
Display