Plex.tv - Add a Managed User
This API request will add a managed user to the Plex server. After making a request to this endpoing, an additional call to the Plex.tv - Share a Server endpoint is required to share the Plex server with the user.
URL
POST https://plex.tv/api/v2/home/users/restricted?restrictionProfile={restriction_profile}&{sharing_settings}&friendlyName={name}&X-Plex-Client-Identifier={client_identifier}&X-Plex-Token={plex_token}
Parameters
Name | Description |
---|---|
plex_token | The Plex token. |
restriction_profile | (Optional) The profile associated with the managed user. See Remarks for information on the profiles. |
sharing_settings | (Optional) Settings that affect how the server can share the content with the user. See Remarks on how to specify share settings. |
name | The name of the 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 |
---|---|
200 | Success - The request was successful. |
400 | Bad Request - A parameter is invalid. |
401 | Unauthorized - The token used to make the request is not authorized to add a user. |
Response
Information returned provides details on the managed user account that has been added. All the information for the user is returned in a user
element as shown below:
<user id="398506727" uuid="76b5d1037c626962" title="Child" username="" email="" friendlyName="Child" thumb="https://plex.tv/users/76b5d1037c626962/avatar?c=1722366657" hasPassword="0" restricted="1" updatedAt="1722366657" restrictionProfile="little_kid" admin="0" guest="0" protected="0"/>
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
Profiles
When a managed user is added, a profile can be assigned to the user. A profile restricts the content the user is allowed to stream from the Plex server. If you don't specify a restriction profile for the user, then no content restriction will be used.
The valid profiles are listed in the table below.
Profile | Parameter Value |
---|---|
Younger Kid | little_kid |
Older Kid | older_kid |
Teen | teen |
Share settings
There are two share settings that can be specified for the user: the ability for the user to download content for offline viewing, and access to Live TV.
These settings can be specified by using the shareSettings
parameter in the request.
The values for each setting are specified below:
- Allow Downloads: allowSync
- Allow access to Live TV: allowTuners
The value of each parameter can be either 0 - do not allow, or 1 - allow. If a value is not specified for the user, then the default value is 0.
Each value is specified in the request as a separate UTF-8 encoded array value. Each one would have the setting name surrounded by encoded '[' and ']'.
For example, to allow downloads for a user, you would specify the share settings value in the request as follows:
sharingSettings%5BallowSync%5D=1
To allow a user to access Live TV, you would use the following:
sharingSettings%5BallowTuners%5D=1
To allow a user to both download media and stream Live TV, you would specify both values in the request as separate parameters:
sharingSettings%5BallowTuners%5D=1&sharingSettings%5BallowSync%5D=1
Sharing the server
Once the user has been added, you will need to make a second endpoint request to give the user access to the libraries on the Plex server.
To provide library access to the new managed user, make a request to the Plex.tv - Share a Server endpoint.
Not making a request to the Share a Server endpoint will result in error messages being shown the Plex for the managed user.
Examples
curl -X POST https://plex.tv/api/v2/home/users/restricted?restrictionProfile={restriction_profile}&{sharing_settings}&friendlyName={name}&X-Plex-Client-Identifier={client_identifier}&X-Plex-Token={plex_token}
import requests plex_url = https://plex.tv/api/v2/home/users/restricted?restrictionProfile={restriction_profile}&{sharing_settings}&friendlyName={name}&X-Plex-Client-Identifier={client_identifier}&X-Plex-Token={plex_token} response = requests.post(plex_url) print(response.text)
$response = Invoke-RestMethod 'https://plex.tv/api/v2/home/users/restricted?restrictionProfile={restriction_profile}&{sharing_settings}&friendlyName={name}&X-Plex-Client-Identifier={client_identifier}&X-Plex-Token={plex_token}' -Method 'POST' Write-Output $response