How to Add a PIN for a Plex User

If you manage a Plex server that has added multiple managed users or Plex users to access the media, then you may want to protect access to those accounts. By default, any managed user can switch to any other managed user within Plex Home. This can be an issue if you have restricted media that only a specific user should access.

While you can limit library access for a user, if another user has access to that library, then any user can switch to that user for access. The way to prevent this is by setting up a PIN. When a PIN is added for a user, then selecting that user when using Plex will require the PIN to be entered.

Setting up a PIN is simple and the steps are outlined below.

How to Add a PIN for a Plex User

How to add a PIN

The following steps explain how to add a PIN for a user in Plex.

  1. 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.
    Plex Settings Icon.
    The 'Plex Settings' icon
  2. Click the Plex Home option from the menu on the left.
    Plex Home Option.
    The 'Plex Home' option
  3. Hover over the user whose PIN you would like to add, and then click the Set PIN link that appears.
    Plex Set PIN Option.
    The 'Set PIN' option in Plex
  4. In the Edit PIN dialog, enter the PIN and then click the Save option.
    Saving the User's PIN in Plex.
    Saving the user's PIN in Plex

There is no confirmation message displayed when the PIN is set. In the list of users listed in the Plex Home screen, you will see the PIN Required next to the user.

The PIN Required Message for the User.
The PIN required message for the user

Once the PIN has been set, you can change the PIN at any time.

If the user no longer would like a PIN, then you can easily remove the PIN for the user.

How to add a PIN using the API

While using the Plex Web App is the easiest way of adding a user's PIN, you can also add a PIN using the plex.tv API.

There are a few things to note when using the API to add a user's PIN:

  1. 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 added is for the managed user.
  2. 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 adding the PIN will be outlined in the next two sections.

Admin User

Before adding the PIN, you will 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 an add administrator PIN API request to add the PIN for the administrative user account:

PUT https://plex.tv/api/home/users/{admin_id}?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:

API Request Return Status Codes
HTTP CodeDescription
200Success. The PIN has been added.
401Unauthorized. The old PIN is incorrect or the token used to make the request is not authorized to add the PIN.
404Not found. The user associated with the ID was not found. Verify the ID of the API request.

Managed User

Adding the PIN for a managed user is similar. You will also need an additional piece of information to add 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 add 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:

API Request Return Status Codes
HTTP CodeDescription
201Created. The PIN has been added.
401Unauthorized. The token used to make the request is not authorized to add the PIN.
404Not found. The user associated with the ID was not found. Verify the ID of the API request.
Subscribe
Display