Plex.tv - Change an Admin User PIN
This API request will change a PIN to an administrator account on a Plex server.
URL
PUT https://plex.tv/api/home/users/{user_id}?currentPin={current_pin}&pin={new_pin}&X-Plex-Token={plex_token}
Parameters
Name | Description |
---|---|
plex_token | The Plex token. |
user_id | The ID of the administrative user. You can get the user ID by making a request to the Get Users API and using the id attribute value for a user that has the admin attribute set to 1 . |
current_pin | The current PIN for the administrator account. |
new_pin | The new PIN for the administrator account. |
Return Status
HTTP Code | Description |
---|---|
200 | Success - The request was successful. |
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
Not much information is returned in the response. Only a status code of 200, a response code of 0, and a status indicating the user's PIN was changed is returned. The response of a successful PIN being changed for the administrative account is shown below:
<?xml version="1.0" encoding="UTF-8"?> <Response code="0" status="Updated user"/>
Remarks
If the value of the pin
parameter is left empty, then the PIN is deleted for the user instead of being changed.
If the pin provided for the currentPin
parameter is not correct, then this request will return a 401 (Unauthorized) error with the following response:
<?xml version="1.0" encoding="UTF-8"?> <Response code="401" status="Incorrect PIN"/>
You may also get a 401 if the Plex token cannot be parsed on the command line. The response would be:
<?xml version="1.0" encoding="UTF-8"?> <errors> <error>Please sign in.</error> </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>Invalid authentication token.</error> </errors>
A 404 can also be returned if the user ID was not found. This error will have the following response:
<?xml version="1.0" encoding="UTF-8"?> <Response code="404" status="User {user_id} could not be found in your home"/>
The user_id
value will be replaced with the ID provided in the request.
Examples
curl -X PUT https://plex.tv/api/home/users/{user_id}?currentPin={current_pin}&pin={new_pin}&X-Plex-Token={plex_token}
import requests plex_url = https://plex.tv/api/home/users/{user_id}?currentPin={current_pin}&pin={new_pin}&X-Plex-Token={plex_token} response = requests.put(plex_url) print(response.text)
$response = Invoke-RestMethod 'https://plex.tv/api/home/users/{user_id}?currentPin={current_pin}&pin={new_pin}&X-Plex-Token={plex_token}' -Method 'PUT' Write-Output $response