How to Change a PIN from Plex
You can easily change a PIN from Plex using the Web app if the user has added a PIN. You may want to change a PIN if someone else knows the PIN, or would just prefer to change it on a regular basis.
If you would like to change the PIN for a Plex Home user, you can use the method outlined in the next section.
How to change a PIN
The following steps explain how to change a PIN for a user in Plex.
- Log into your Plex server as an administrator, and then click the Settings - the wrench - link in the upper-right corner of the Plex server page.
- Click the Plex Home option from the menu on the left.
- Hover over the user whose PIN you would like to change, and then click the Edit PIN link that appears.
- In the Confirm Current PIN dialog, enter the current PIN of the user. The PIN confirmation dialog won't be displayed for managed users.
- In the Edit PIN dialog, enter the PIN and then click the Save option.
There is no confirmation message displayed when the PIN is changed.
If the user no longer would like a PIN, then you can easily remove the PIN for the user.
How to change a PIN using the API
While using the Plex Web App is the easiest way of changing a user's PIN, you can also change a PIN using the plex.tv API.
There are a few things to note when using the API to change a user's PIN:
- The Plex Authentication Token used in the request needs to be either an administrator token or a device token. A managed user token will not work, even if the PIN being changed is for the managed user.
- The ID associated with the user will need to be known as it will be included in the URL of the request. For managed users the ID can be found by calling the Get Accounts API. For the ID of the administrative user, it will be explained in the next section.
Any additional information for changing the PIN will be outlined in the next two sections.
Admin User
To change the PIN for the administrative user, you will need to know the current PIN. If you don't know the current PIN, then you will need to use the Web App's PIN forgot option.
Before changing the PIN, you will also need to know the ID of the administrative user account. The easiest way to get the ID is to make a get user plex.tv API request using the administrative token:
GET https://plex.tv/api/v2/user?X-Plex-Token={admin_plex_token}
The ID of the administrative user will be returned in the id
attribute of the user
element in the XML.
Now that you have the administrative ID, you can make a change administrator PIN API request to change the PIN for the administrative user account:
PUT https://plex.tv/api/home/users/{admin_id}?currentPin={old_pin}&pin={new_pin}&X-Plex-Token={plex_token}
Once the request is made, you will get one of the following response status codes indicating the result:
HTTP Code | Description |
---|---|
200 | Success. The PIN has been changed. |
401 | Unauthorized. The old PIN is incorrect or the token used to make the request is not authorized to change the PIN. |
404 | Not found. The user associated with the ID was not found. Verify the ID of the API request. |
Managed User
Changing the PIN for a managed user is similar. One difference is that you don't need to know the current PIN of the user to change it. You will also need an additional piece of information to change the PIN: a client ID.
You can get a client ID by making a request to the Get Devices API and look for an ID in the clientIdentifier
attribute.
I recommend you use an ID of a client that is further down in the list as that API request call will return all devices that have ever been authenticated with the Plex server, including devices no longer valid.
Once you have a client ID, you can use that to change the PIN for a managed user using the following API request:
POST https://plex.tv/api/v2/home/users/restricted/{user_id}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_id}&pin={new_pin}
Once the request is made, you will get one of the following response status codes indicating the result:
HTTP Code | Description |
---|---|
201 | Created. The PIN has been changed |
401 | Unauthorized. The token used to make the request is not authorized to change the PIN. |
404 | Not found. The user associated with the ID was not found. Verify the ID of the API request. |