Third-Party App - Managed User Session Attribution via Public API

Hi Plex Team,

I am trying to create an app that gives the feel of channel surfing, but with content from my PMS, and I am trying to properly implement managed user (Home User) support with correct session attribution. I’ve hit a roadblock with the public API and hoping you can point me in the right direction.

What I’m Trying to Accomplish:

  • Allow managed users to select their profile

  • Have their playback sessions appear under their account in the Plex dashboard (not the main account owner)

What I’ve Implemented:

  1. Using /api/v2/home/users to get list of users :white_check_mark:

  2. Using /api/home/users/{id}/switch to get user-specific token :white_check_mark:

  3. Using main account token for server access (libraries, media info, streams) :white_check_mark:

The Problem: When a managed user’s token is used for timeline calls (/:/timeline), the server returns 401 Unauthorized:

POST /api/home/users/{userId}/switch
Response: authToken="{token}"

GET http://192.168.50.124:32400/:/timeline?ratingKey=98682&state=playing&X-Plex-Token={token}
Response: 401 Unauthorized

Using the main account token for timeline calls works (200 OK), but sessions are attributed to the main account owner instead of the managed user.

What I’ve Tried:

  • :white_check_mark: Using managed user token from /switch API - 401 error

  • :white_check_mark: Using main account token with &accountID={userId} parameter - 200 OK but session shows under main account

  • :white_check_mark: Verified the switch response contains only authToken and authenticationToken (both identical, no separate server token)

Questions:

  1. Is there a way to properly attribute sessions to managed users via the public API?

  2. Do managed user tokens from /switch have server access permissions, or are they plex.tv-only?

  3. Is there a different endpoint or parameter I’m missing for multi-user session tracking?

  4. If this isn’t supported in the public API, would you consider adding it?

I’ve examined the full XML response from /switch and it looks like there are no additional token fields beyond authToken. The official Plex apps handle this correctly, so I’m hoping there’s an approach I haven’t discovered yet.

Any guidance would be greatly appreciated! Happy to provide additional technical details if helpful.

Thanks!

1 Like

Exchange for their server token at

https://plex.tv/api/v2/resources
2 Likes

Thank you! I’ll go give it a try!

That did it, thanks!