Skip to main content
GET
/
user
PlexPHP
declare(strict_types=1);

require 'vendor/autoload.php';

use LukeHagar\Plex_API;

$sdk = Plex_API\PlexAPI::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();



$response = $sdk->authentication->getTokenDetails(

);

if ($response->userPlexAccount !== null) {
    // handle response
}
{
  "authToken": "CxoUzBTSV5hsxjTpFKaf",
  "email": "[email protected]",
  "friendlyName": "friendlyUsername",
  "hasPassword": true,
  "id": 13692262,
  "joinedAt": 1556281940,
  "title": "UsernameTitle",
  "twoFactorEnabled": false,
  "username": "Username",
  "uuid": "dae343c1f45beb4f",
  "adsConsent": true,
  "adsConsentReminderAt": 1556281940,
  "adsConsentSetAt": 1556281940,
  "anonymous": false,
  "backupCodesCreated": false,
  "confirmed": false,
  "country": "US",
  "emailOnlyAuth": false,
  "experimentalFeatures": false,
  "entitlements": "[]",
  "guest": false,
  "home": false,
  "homeAdmin": false,
  "homeSize": 1,
  "locale": "<string>",
  "mailingListActive": false,
  "mailingListStatus": "active",
  "maxHomeSize": 15,
  "pin": "<string>",
  "profile": {
    "autoSelectAudio": true,
    "defaultAudioLanguage": "ja",
    "defaultSubtitleLanguage": "en",
    "autoSelectSubtitle": 1,
    "defaultSubtitleAccessibility": 1,
    "defaultSubtitleForced": 1,
    "watchedIndicator": 1,
    "mediaReviewsVisibility": 1,
    "defaultAudioAccessibility": 0,
    "defaultAudioLanguages": null,
    "defaultSubtitleLanguages": null,
    "mediaReviewsLanguages": null
  },
  "protected": false,
  "rememberExpiresAt": 1556281940,
  "restricted": false,
  "roles": [
    "<string>"
  ],
  "scrobbleTypes": "<string>",
  "services": [
    {
      "identifier": "metadata-dev",
      "endpoint": "https://epg.provider.plex.tv",
      "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
      "secret": "<string>",
      "status": "online"
    }
  ],
  "subscription": {
    "features": [
      "<string>"
    ],
    "active": true,
    "subscribedAt": "2021-04-12T18:21:12Z",
    "status": "Inactive",
    "paymentService": "<string>",
    "plan": "<string>"
  },
  "subscriptionDescription": "<string>",
  "subscriptions": [
    {
      "features": [
        "<string>"
      ],
      "active": true,
      "subscribedAt": "2021-04-12T18:21:12Z",
      "status": "Inactive",
      "paymentService": "<string>",
      "plan": "<string>"
    }
  ],
  "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
  "attributionPartner": null
}

Authorizations

X-Plex-Token
string
header
required

The token which identifies the user accessing the PMS. This can be either:

  • A traditional access token obtained from plex.tv
  • A JWT token obtained through the JWT authentication flow

JWT tokens provide better security with:

  • Short-lived tokens (7 days expiration)
  • Public-key cryptography (ED25519)
  • Better clock synchronization
  • Individual device revocation capability

Headers

accepts
enum<string>
default:application/xml

Indicates the client accepts the indicated media types

Available options:
application/json,
application/xml
X-Plex-Client-Identifier
string
required

An opaque identifier unique to the client

Example:

"abc123"

X-Plex-Product
string

The name of the client product

Example:

"Plex for Roku"

X-Plex-Version
string

The version of the client application

Example:

"2.4.1"

X-Plex-Platform
string

The platform of the client

Example:

"Roku"

X-Plex-Platform-Version
string

The version of the platform

Example:

"4.3 build 1057"

X-Plex-Device
string

A relatively friendly name for the client device

Example:

"Roku 3"

X-Plex-Model
string

A potentially less friendly identifier for the device model

Example:

"4200X"

X-Plex-Device-Vendor
string

The device vendor

Example:

"Roku"

X-Plex-Device-Name
string

A friendly name for the client

Example:

"Living Room TV"

X-Plex-Marketplace
string

The marketplace on which the client application is distributed

Example:

"googlePlay"

Response

Logged in user details

authToken
string
required

The account token

Example:

"CxoUzBTSV5hsxjTpFKaf"

email
string<email>
required

The account email address

friendlyName
string
required

Your account full name

Example:

"friendlyUsername"

hasPassword
boolean
default:true
required

If the account has a password

id
integer<int32>
required

The Plex account ID

Example:

13692262

joinedAt
integer<int64>
required

Unix epoch datetime in seconds

Example:

1556281940

title
string
required

The title of the account (username or friendly name)

Example:

"UsernameTitle"

twoFactorEnabled
boolean
default:false
required

If two-factor authentication is enabled

username
string
required

The account username

Example:

"Username"

uuid
string
required

The account UUID

Example:

"dae343c1f45beb4f"

Unknown

Unix epoch datetime in seconds

Example:

1556281940

Unix epoch datetime in seconds

Example:

1556281940

anonymous
boolean | null
default:false

Unknown

backupCodesCreated
boolean
default:false

If the two-factor authentication backup codes have been created

confirmed
boolean
default:false

If the account has been confirmed

country
string

The account country

Required string length: 2
Example:

"US"

emailOnlyAuth
boolean
default:false

If login with email only is enabled

experimentalFeatures
boolean
default:false

If experimental features are enabled

entitlements
string[]

List of devices your allowed to use with this account

Example:

"[]"

guest
boolean
default:false

If the account is a Plex Home guest user

home
boolean
default:false

If the account is a Plex Home user

homeAdmin
boolean
default:false

If the account is the Plex Home admin

homeSize
integer<int32>

The number of accounts in the Plex Home

Example:

1

locale
string | null

The account locale

mailingListActive
boolean
default:false

If you are subscribed to the Plex newsletter

mailingListStatus
enum<string>

Your current mailing list status

Available options:
active,
unsubscribed,
removed
Example:

"active"

maxHomeSize
integer<int32>

The maximum number of accounts allowed in the Plex Home

Example:

15

pin
string
deprecated

[Might be removed] The hashed Plex Home PIN

profile
UserProfile · object
protected
boolean
default:false

If the account has a Plex Home PIN enabled

rememberExpiresAt
integer<int64>

Unix epoch datetime in seconds

Example:

1556281940

restricted
boolean
default:false

If the account is a Plex Home managed user

roles
string[]

[Might be removed] List of account roles. Plexpass membership listed here

scrobbleTypes
string

Unknown

services
object[]
subscription
Subscription · object

If the account's Plex Pass subscription is active

subscriptionDescription
string | null

Description of the Plex Pass subscription

subscriptions
Subscription · object[]
thumb
string<uri>

URL of the account thumbnail

Example:

"https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101"

attributionPartner
string | null
Example:

null