Plex.tv - Get a Server
A Plex account can have multiple Plex servers associated with it. This API request will return some information on a single server associated with a Plex account.
URL
GET https://plex.tv/api/servers/{machine_identifier}?X-Plex-Token={plex_token}Parameters
| Name | Description |
|---|---|
| plex_token | The Plex token. |
| machine_identifier | The ProcessedMachineIdentifier for the Plex server. You can get this identifier from the Plex advanced settings. |
Return Status
| HTTP Code | Description |
|---|---|
| 200 | Success - The request was successful. |
| 401 | Unauthorized - The Plex token provided was not valid or was not provided. |
| 404 | Not Found - The server associated with the machine identifier does not exist. |
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="c080de7e0168d1da7027f8b218adb769bd1d6c6c" size="4">
<Server name="MyPlexServer" address="XXX.XXX.XXX.XXX" port="32401" version="1.30.2.6563-3d4dc0cce" scheme="http" host="XXX.XXX.XXX.XXX" localAddresses="192.168.1.100" machineIdentifier="93c418a691854d3be47ead674134d86a3f5e00f4" createdAt="1690834837" updatedAt="1722366657" owned="1" synced="0">
<Section id="XXXXXXXXX" key="2" type="movie" title="Movies"/>
<Section id="XXXXXXXXX" key="1" type="artist" title="Music"/>
<Section id="XXXXXXXXX" key="22" type="photo" title="Photos"/>
<Section id="XXXXXXXXX" key="8" type="show" title="TV Shows"/>
</Server>
</MediaContainer>The XML returned provides information about a server associated with a Plex account. The root is the MediaContainer element. This element contains several attributes for the server.
| Attribute | Description |
|---|---|
| friendlyName | The name of the Plex server. |
| identifier | The type of item. |
| machineIdentifier | Unique identifier for the server. |
| size | The number of media sections available on the server. |
Within the MediaContainer is a Server element that contains information about the server.
| Attribute | Description |
|---|---|
| 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. |
Each library section available on the server is represented by one Section element within the Server element.
| Attribute | Description |
|---|---|
| id | The identifier for the section. |
| key | The key for the section. |
| type | The type of section. |
| title | The title of the section. |
Examples
curl -X GET https://plex.tv/api/servers/{machine_identifier}?X-Plex-Token={plex_token}
import requests
plex_url = https://plex.tv/api/servers/{machine_identifier}?X-Plex-Token={plex_token}
response = requests.get(plex_url)
print(response.text)
$response = Invoke-RestMethod "https://plex.tv/api/servers/{machine_identifier}?X-Plex-Token={plex_token}" -Method GET
Write-Output $response