Plex.tv - Get Servers
A Plex account can have multiple Plex servers associated with it. This API request will return a list of all servers for the Plex account.
URL
GET https://plex.tv/servers.xml?includeLite=1&X-Plex-Token={plex_token}Parameters
| Name | Description |
|---|---|
| plex_token | The Plex token. |
| includeLite | (Optional) Gets a simple list of servers. Without this parameter, the list of servers will be limited to those that have remote access enabled. |
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 servers for the associated Plex account. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer friendlyName="myPlex" identifier="com.plexapp.plugins.myplex" machineIdentifier="df3d7a630a9dde6445c90385077e981ba914876f" size="1">
<Server accessToken="Hs2vG4eNtR7nzq1t_cGR" name="PlexServer" address="" port="0" version="1.40.4.8679-424562606" scheme="http" host="" localAddresses="XXX.XXX.XXX.XXX" machineIdentifier="fc8678129e6bdc8668b658c39820e45fbe276467" createdAt="1422640063" updatedAt="1422640063" owned="1" synced="0"/>
</MediaContainer>The XML returned provides a list of all servers associated with a Plex account. The root is the MediaContainer element. This element contains several attributes for the servers.
| Attribute | Description |
|---|---|
| friendlyName | The name of the Plex server. |
| identifier | The type of item. |
| machineIdentifier | Unique identifier for the server. |
| size | The number of servers. |
Within the MediaContainer there are one or more Server child elements. Each Server element represents one sever.
| Attribute | Description |
|---|---|
| accessToken | The token associated with the server. |
| name | The name of the server. |
| address | The IP address of the server. |
| port | The Plex Media Server port. |
| version | The version of Plex Media Server that is installed. |
| scheme | The scheme used to connect to the server. |
| host | The host name of the server. If there is no host name associated with the server then the IP address is displayed. |
| localAddresses | The local addresses for the server. |
| machineIdentifier | Unique identifier for the server. |
| createdAt | The timestamp when the server was created. |
| updatedAt | The timestamp when the server was updated. |
| owned | Flag indicating if the server is owned. 0 - the server is not owned. 1 - the server is owned. |
| synced | Flag indicating if the server is synced. 0 - the server is not synced. 1 - the server is synced. |
Remarks
includeLite Parameter
This parameter is optional and will return a simple list of servers. If this parameter is excluded, then only servers with remote access enabled will be returned.
Examples
curl -X GET https://plex.tv/servers.xml?includeLite=1&X-Plex-Token={plex_token}
import requests
plex_url = https://plex.tv/servers.xml?includeLite=1&X-Plex-Token={plex_token}
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod "https://plex.tv/servers.xml?includeLite=1&X-Plex-Token={plex_token}" -Method GET
Write-Output $response