Plex.tv - Change Discover Together Settings

This API request will allow a user to change their Discover Together settings. Each user will need to set this using their own Plex token.

The Discover Together settings will allow a user to control what activities their friends can see on Plex.

URL

POST https://community.plex.tv/api

Headers

NameValue
x-plex-tokenThe Plex user token.
Content-Typeapplication/json

Body

{"query": "mutation updateUserPrivacy($input: UpdatePrivacyInput!){updatePrivacy(input: $input)}", "variables": {"input": {"watchHistory": "watch_history", "watchlist": "watchlist", "ratings": "ratings", "friends": "friends", "profile": "profile"}}, "operationName": "updateUserPrivacy"}

Values

ValueDescription
watch_historyThe watch history of the user. See Remarks below for possible values.
watchlistAny watchlists the user has created. See Remarks below for possible values.
ratingsRatings the user has specified. See Remarks below for possible values.
friendsThe friends of the user. See Remarks below for possible values.
profileThe visibility of the user account. See Remarks below for possible values.

Return Status

HTTP CodeDescription
200Success - The request was successful or an error occurred. See Remarks for more information.
400Bad Request - The Content-Type was not specified as application/json. See Remarks for more information.
401Unauthorized - The Plex token provided was not valid.

Response

A JSON string value is returned that indicates the privacy setting for the user has been updated.

An example of the JSON response is shown below:

{
   "data": {
     "updatePrivacy": true
   }
}

Remarks

Each of the Discover Together activities can be changed to one of several values. The valid values are listed in the table below.

The values in the table are ordered least restrictive (ANYONE) to most restrictive (PRIVATE).

Discover Together Activity Values
ValueDescription
ANYONEAnyone can view the activity.
PLEXanyone signed into Plex can view the activity.
FRIENDS_OF_FRIENDSFriends of friends can view the activity.
FRIENDSFriends can view the activity.
PRIVATENo one can view the activity.

If you want to not share any activity, then all activity values should be set to PRIVATE.

In the Plex-hosted Web app, the most restrictive setting the profile activity is FRIENDS.

By using this API endpoint, the profile activity can be set to PRIVATE.

Incorrect value

If an incorrect value is provided for an activity, a 200 Success status code is returned, which doesn't help determine that an error occurred.

To check for an error, the response content will need to be validated. For an incorrect value, the response content will contain a JSON string with the errors root element. The message element will contain the invalid activity value.

Below is an example of the error JSON returned for an invalid value:

{
  "errors": [
      {
          "message": "Variable \"$input\" got invalid value \"INVALID\" at \"input.watchHistory\"; Value \"INVALID\" does not exist in \"PrivacyMode\" enum.",
          "locations": [
              {
                  "line": 1,
                  "column": 28
              }
          ]
      }
  ]
}

Incorrect Content-Type header

The Content-Type header value needs to be application/json. If the Content-Type header value is not set properly, this endpoint will return a 400 status code with the following JSON response body:

{
  "errors": [
      {
          "message": "Must provide query string."
      }
  ]
}

Examples

curl -X POST '-H "x-plex-token: plex_token" -H "Content-Type: application/json"' -d '{"query": "mutation updateUserPrivacy($input: UpdatePrivacyInput!){updatePrivacy(input: $input)}", "variables": {"input": {"watchHistory": "watch_history", "watchlist": "watchlist", "ratings": "ratings", "friends": "friends", "profile": "profile"}}, "operationName": "updateUserPrivacy"}' https://community.plex.tv/api
import requests
plex_url = https://community.plex.tv/api

headers = {'x-plex-token': 'plex_token', 'Content-type': 'application/json'}
data = {"query": "mutation updateUserPrivacy($input: UpdatePrivacyInput!){updatePrivacy(input: $input)}", "variables": {"input": {"watchHistory": "watch_history", "watchlist": "watchlist", "ratings": "ratings", "friends": "friends", "profile": "profile"}}, "operationName": "updateUserPrivacy"}
response = requests.post(plex_url, headers=headers json=data)

print(response.text)
$body = @'{"query": "mutation updateUserPrivacy($input: UpdatePrivacyInput!){updatePrivacy(input: $input)}", "variables": {"input": {"watchHistory": "watch_history", "watchlist": "watchlist", "ratings": "ratings", "friends": "friends", "profile": "profile"}}, "operationName": "updateUserPrivacy"}'
$response = Invoke-RestMethod "https://community.plex.tv/api" -Method POST -Body $body -Headers @{"x-plex-token"="plex_token"; "ContentType"="application/json"}

Write-Output $response
Subscribe
Display