Where to Get the Plex Token?
If you ever need to access a plugin, application, or script from outside of Plex you will be required to provide your Plex token. You may also be asking where to get the Plex token.
While most users won’t need to worry about or use the Plex token, if you wish to create an application or script that calls the Plex API commands, you will need to provide the X-Plex-Token
value.
Table of contents
- What is the Plex token?
- The Plex server token
- Get the Plex token for all users and devices
- Regenerating a new claim token
What is the Plex token?
The Plex token is used to authenticate a device with your Plex server. When you are signed into your Plex Media Server, you are assigned a generated token. This token is used to authenticate your device with your Plex server. This replaces having to provide your user ID and password with each request you make to Plex.
The token we will be looking at in this article will be different for each device and Web browser you use to sign into Plex. For example, if you sign into Plex on two different browsers on the same system, each browser would have a different Plex token.
The good news is that you only need one token to use with the Plex API – as long as the token is valid. So once you sign into Plex, you can just grab the token and use it to access Plex.
So how do you get the Plex token, I’ll explain it in the next section.
Where to get the Plex token?
Once you are signed into your Plex Media Server as an admin, it is easy to get the Plex token. To get the token, use the following steps:
- Open a Web browser and navigate to your Plex server and access the server using an ID that has full access to the server.
- Navigate to any item on your Plex server. Make sure it is an individual item, and not a collection or series, as the option we will use is only accessible for an item.
- With the item available, click the three dots to display a context menu, and then click the Get Info option.
Get info for an item in Plex Media Server. - The information window about the item will appear. In the lower-left corner, click the View XML link.
View XML in Plex Media Server. - The XML data for the item will appear in the browser window. The Plex Token will be shown at the end (far right) of the URL.
Plex token displayed in URL.
Now that you have the token, you can copy it and use it within the Plex API commands to return information about the Plex server.
The steps outlined above can only be done by a Plex user with full access to the server, not from other accounts. This is because the Get Info and the View XML link are only visible to a user with full permissions.
The Plex server token
The above section discussed the Plex tokens that can be created to authenticate devices to Plex. There is also another token that authenticates your Plex server to your Plex account.
This server token is stored with the Plex settings and isn't readily available to be read. If you have access to your server, you can find the Plex token easily.
Location of the Plex server token
The Plex token for your server is stored in a location that is dependent on what operating system you use for your Plex server:
Operating System | Location |
---|---|
Windows | HKEY_CURRENT_USER\Software\Plex, Inc.\Plex Media Server Value: PlexOnlineToken |
MacOS | ~/Library/Preferences/com.plexapp.plexmediaserver.plist Key: PlexOnlineToken |
Linux | $PLEX_HOME/Library/Application Support/Plex Media Server/Preferences.xml Value: PlexOnlineToken |
Debian, Fedora, Ubuntu, and CentOS | /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml Value: PlexOnlineToken |
How to reset the server Plex token
While I don't recommend you do this or would have any reason to reset your server's authentication token, you can reset your Plex authentication token if you choose.
If you do reset your server's Plex authentication token, you will need to reclaim your Plex server for your Plex account.
To reset your server's Plex authentication token, you would need to do the following:
- Log into your Plex server.
- Open the settings location as described in the previous section.
- Delete the following values from the settings:
- PlexOnlineHome (this setting will only be available if you are using the Plex Home managed users feature.)
- PlexOnlineMail
- PlexOnlineToken
- PlexOnlineUsername
- Restart Plex, and then claim your server for your Plex.tv account.
An additional method is to remove the server from your Plex account, which will invalidate the token associated with that server.
Reclaiming your Plex server should have regenerated a new authentication token for your Plex server. The old authentication token is now invalid.
What can you do with the Plex token?
The Plex token assigned to a device that can access Plex can be used for a few functions. The first was mentioned earlier: to access the Plex Media Server API commands.
Each Plex API command requires the Plex token to be provided for authentication. When a valid token is provided, the user can get information about the Plex server. An invalid token will return an unauthorized error.
A second function that can be used is to download the latest Plex version from the online Plex server. The Plex Server Auto Updater is a tool used to update Plex when it is run as a Windows service, reads the token from the registry, and uses it to download the latest version of Plex Media Server.
Get the Plex token for all users and devices
The above sections outlined two ways of getting a device Plex token. What if you would like to get the Plex tokens for all authorized devices and users associated with your Plex account?
You can by using the Plex server token outlined above, and the following steps:
- Follow the steps outlined in The Plex server token section above to get the server token. Copy this token as it will be used in the next step.
- In the address bar of a Web browser, enter the following URL:
Replacehttps://plex.tv/api/v2/server/access_tokens?auth_token=[server_token]
[server_token]
with the token you found in step 1. - Press enter to have the browser request the URL and return XML data.
The XML data that is returned will list all devices authorized for your server along with their token (the token=
contains the token for the device).
Below the device list are additional tokens that have a type server
and then an invited
element. Each token/invited
pair is one user associated with your account.
The Plex token for that user is listed in the parent token
element for the invited
element associated with the user.
What happens if you need a new token? Perhaps the token has been misused, or others know of it. The next section will explain how you can invalidate tokens for your Plex server.
Regenerating a new claim token
You may need to make the tokens associated with your Plex server invalid. Since they are used to authenticate to your server, you may have found one that is being misused. Making your tokens invalid isn’t something most users will need to do – I haven’t had a need myself, but the option is available.
To invalidate all the tokens associated with your Plex instance, do the following:
- Open a Web browser and navigate to your Plex account profile.
- Click the Edit link next to the Password option.
- After filling in the new password fields and the current password, check the Sign out connected devices after password change checkbox.
After performing the above steps, all tokens previously associated with your account will now be invalid. This means that all servers and clients will no longer be connected to your Plex account. You will need to claim your Plex server to have it associated with your account.
The above sections talked about what is the Plex token, where to get the Plex token, and how to make the tokens associated with your account invalid. While most users of Plex won’t have a need for the Plex token, it is available if you would like to do more with your server.