Plex.tv - Remove a Managed User PIN
This API request will remove a PIN to a managed user account on a Plex server.
URL
POST https://plex.tv/api/v2/home/users/restricted/{client_id}}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&removePin=1
Parameters
Name | Description |
---|---|
plex_token | The Plex token. |
user_id | The 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_identifier | The 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. |
Return Status
HTTP Code | Description |
---|---|
201 | Created - The PIN was removed for the managed user. |
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. |
Response
Information returned provides details on the managed user account that had the PIN removed. 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.
Attribute | Description |
---|---|
id | The ID of the user. |
uuid | The unique identifier for the user. |
title | The title of the user. |
username | The user name associated to the user. |
The email associated to the user. | |
friendlyName | An easier to read name for the user. |
thumb | The thumbnail for the user. |
hasPassword | Flag indicating the user has a password. 0 - the user doesn't have a password set. 1 - the user has a password set. |
restricted | Flag indicating the user account has restrictions. 0 - the user has no restrictions. 1 - the user has restrictions. |
updatedAt | The date and time in epoch time, the user was updated. |
restrictionProfile | The restriction profile set to the user. |
admin | Flag indicating the user account is the server admin. 0 - the user is not the admin. 1 - the user is the admin. |
guest | Flag indicating the user account is a guest. 0 - the user is not a guest. 1 - the user is a guest. |
protected | Flag 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.
Sending the request successfully multiple times will return the same 201 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/{client_id}}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&removePin=1
import requests plex_url = https://plex.tv/api/v2/home/users/restricted/{client_id}}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&removePin=1 response = requests.post(plex_url) print(response.text)
$response = Invoke-RestMethod 'https://plex.tv/api/v2/home/users/restricted/{client_id}}?X-Plex-Token={plex_token}&X-Plex-Client-Identifier={client_identifier}&removePin=1' -Method 'POST' Write-Output $response