Plex.tv - Change a Managed User PIN

This API request will change a PIN to a managed user account on a Plex server.

URL

POST https://plex.tv/api/v2/home/users/restricted/{user_id}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&pin={new_pin}

Parameters

NameDescription
plex_tokenThe Plex token.
user_idThe ID of the managed user. You can get the user ID by making a request to the Get Users API and using the id attribute value for the managed user.
client_identifierThe identifier for the client. You can get a client ID by making a request to the Get Devices API and look for an ID in the clientIdentifier attribute.
new_pinThe new PIN for the managed user account.

Return Status

HTTP CodeDescription
201Created - The PIN has been changed.
400Bad Request - The user is invalid.
401Unauthorized - The token used to make the request is not authorized to change the PIN, or the user already has a PIN.
404Not found - The user associated with the ID was not found. Verify the ID of the API request.

Response

Information returned provides details on the managed user account that the new pin has been assigned to. All the information for the user is returned in a user element as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<user id="xxxxxxxxx" uuid="654795afd035edce" title="Kids" username="" email="" friendlyName="Older Kid" thumb="https://plex.tv/users/654795afd035edce/avatar?c=xxxxxxxxxx" hasPassword="0" restricted="1" updatedAt="1722343001" restrictionProfile="older_kid" admin="0" guest="0" protected="1"/>

The XML returned provides a information about the user. The root is the user element.

User Attributes
AttributeDescription
idThe ID of the user.
uuidThe unique identifier for the user.
titleThe title of the user.
usernameThe user name associated to the user.
emailThe email associated to the user.
friendlyNameAn easier to read name for the user.
thumbThe thumbnail for the user.
hasPasswordFlag indicating the user has a password.
0 - the user doesn't have a password set.
1 - the user has a password set.
restrictedFlag indicating the user account has restrictions.
0 - the user has no restrictions.
1 - the user has restrictions.
updatedAtThe date and time in epoch time, the user was updated.
restrictionProfileThe restriction profile set to the user.
adminFlag indicating the user account is the server admin.
0 - the user is not the admin.
1 - the user is the admin.
guestFlag indicating the user account is a guest.
0 - the user is not a guest.
1 - the user is a guest.
protectedFlag indicating the user account is protected.
0 - the user is not protected.
1 - the user is protected.

Remarks

This API request will return different responses for each error status code.

If the X-Plex-Client Identifier parameter was not provide, you will get a 400 - Bad Request status code with the following response:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
    <error code="1000" message="X-Plex-Client-Identifier is missing" status="400"/>
</errors>

If the provided Plex token is not a valid administrator token, then the request will return a 404 (Not Found) with the following response:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
    <error code="1001" message="User could not be authenticated" status="401"/>
</errors>

A 404 will be returned if the user ID was not found. This error will have the following response:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
    <error code="1002" message="The requested resource or endpoint could not be found" status="404"/>
</errors>

Examples

curl -X POST https://plex.tv/api/v2/home/users/restricted/{user_id}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&pin={new_pin}
import requests
plex_url = https://plex.tv/api/v2/home/users/restricted/{user_id}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&pin={new_pin}

response = requests.post(plex_url)

print(response.text)
$response = Invoke-RestMethod 'https://plex.tv/api/v2/home/users/restricted/{user_id}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&pin={new_pin}' -Method 'POST'

Write-Output $response
Subscribe
Display