# myPlex access with HTTP API

**URL:** <https://forums.plex.tv/t/myplex-access-with-http-api/11945>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [November 4, 2011, 7:48pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945 "2011-11-04T19:48:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bushd](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@bushd](https://forums.plex.tv/u/bushd)\
**Post date:** [November 4, 2011, 7:48pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/1 "2011-11-04T19:48:42Z")

</div>

Hi,   
  
  
  
does anyone know how to get myPlex informations via the Plex Media Server HTTP API?  
  
The response xml for “localhost:32400” shows a new entry “myplex” but when requesting “localhost:32400/myplex” I get a 404 status code. My guess is that I need to send some further informations like the login, but I don’t know how. Maybe someone can help me out. Thanks.

---

<div class="post-metadata">

**Author:** ![wutname1](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/wutname1/32/142638_2.png) [@wutname1](https://forums.plex.tv/u/wutname1)\
**Post date:** [November 24, 2011, 11:30pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/2 "2011-11-24T23:30:37Z")

</div>

I would like to know about [http://localhost:32400/search](http://localhost:32400/search) giving a 404 error.

---

<div class="post-metadata">

**Author:** ![clintsinger](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@clintsinger](https://forums.plex.tv/u/clintsinger)\
**Post date:** [December 9, 2011, 6:43pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/3 "2011-12-09T18:43:02Z")

</div>

> [@](#):
>
> Hi,   
>   
> does anyone know how to get myPlex informations via the Plex Media Server HTTP API?  
> The response xml for "localhost:32400" shows a new entry "myplex" but when requesting "localhost:32400/myplex" I get a 404 status code. My guess is that I need to send some further informations like the login, but I don't know how. Maybe someone can help me out. Thanks.

  
  
Did you make any progress on this? I have been looking for some information how to query myPlex to get the list of servers and their associated tokens but haven't been too successful. I have even been splunking in the the elan-plex source on GitHub but I am a bit unsure as to what the cURL USERNAME and PASSWORD options do to the URL or payload. It looks like I need to set some header options then do something with the username and password and finally post it to sign\_in.xml (I don't have my source code in front of me so I am doing this from memory) but it isn't working yet.  
  
Anyone have some information about this?  
  
Cheers,  
Clint

---

<div class="post-metadata">

**Author:** ![jam](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jam/32/186050_2.png) [@jam](https://forums.plex.tv/u/jam)\
**Post date:** [December 9, 2011, 8:05pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/4 "2011-12-09T20:05:49Z")

</div>

Hey Clint!  
  
  
  
Here are the headers that can be sent to myPlex:  
  
  
  
X-Plex-Platform (Platform name, eg iOS, MacOSX, Android, LG, etc)  
  
X-Plex-Platform-Version (Operating system version, eg 4.3.1, 10.6.7, 3.2)  
  
X-Plex-Provides (one or more of [player, controller, server])  
  
X-Plex-Product (Plex application name, eg Laika, Plex Media Server, Media Link)  
  
X-Plex-Version (Plex application version number)  
  
X-Plex-Device (Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV)  
  
X-Plex-Client-Identifier (UUID, serial number, or other number unique per device)  
  
  
  
Not all of them are required, but please try to send as many as you can so we can track what clients and devices are being used to access the service 🙂  
  
  
  
You should sign in by issuing a POST request to [https://my.plexapp.com/users/sign\_in.xml](https://my.plexapp.com/users/sign_in.xml). The username and password should be sent using HTTP Basic Auth. If the request is successful, you’ll get XML back containing an auth token. Subsequent requests should append the token to the query string as the auth\_token parameter.  
  
  
  
Once you’re signed in, you can get the server list from [https://my.plexapp.com/pms/servers.xml](https://my.plexapp.com/pms/servers.xml).

---

<div class="post-metadata">

**Author:** ![bushd](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@bushd](https://forums.plex.tv/u/bushd)\
**Post date:** [December 9, 2011, 8:32pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/5 "2011-12-09T20:32:11Z")

</div>

```auto

localhost:32400/myplex/account 

```

  
gives you something like this (if logged into myplex):  
  

```auto

<MyPlex authToken="<Hash>" username="<email>" mappingState="mapped" mappingError="" mappingErrorMessage="" signInState="ok" publicAddress="<IP>" publicPort="32400" privateAddress="" privatePort="0"/>

```

  
  
using  

```auto

https://my.plexapp.com/pms?X-Plex-Token=<Hash>

```

  
  
gives you something like this:  
  

```auto

<MediaContainer friendlyName="myPlex" machineIdentifier="<Other Hash>" identifier="com.plexapp.plugins.myplex" size="3"><br />
   <Directory key="library" title="library"/><br />
   <Directory key="servers" title="servers"/><br />
   <Directory key="system" title="system"/><br />
</MediaContainer>

```

  
  
also interesting:  

```auto

https://my.plexapp.com/pms/playlists?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue/unwatched?X-Plex-Token=<Hash><br />
https://my.plexapp.com/pms/playlists/queue/watched?X-Plex-Token=<Hash>

```

---

<div class="post-metadata">

**Author:** ![clintsinger](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@clintsinger](https://forums.plex.tv/u/clintsinger)\
**Post date:** [December 9, 2011, 11:41pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/6 "2011-12-09T23:41:26Z")

</div>

> [@](#):
>
> Hey Clint!  
>   
> Here are the headers that can be sent to myPlex:  
>   
> X-Plex-Platform (Platform name, eg iOS, MacOSX, Android, LG, etc)  
> X-Plex-Platform-Version (Operating system version, eg 4.3.1, 10.6.7, 3.2)  
> X-Plex-Provides (one or more of [player, controller, server])  
> X-Plex-Product (Plex application name, eg Laika, Plex Media Server, Media Link)  
> X-Plex-Version (Plex application version number)  
> X-Plex-Device (Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV)  
> X-Plex-Client-Identifier (UUID, serial number, or other number unique per device)  
>   
> Not all of them are required, but please try to send as many as you can so we can track what clients and devices are being used to access the service :)  
>   
> You should sign in by issuing a POST request to https://my.plexapp.com/users/sign\_in.xml. The username and password should be sent using HTTP Basic Auth. If the request is successful, you'll get XML back containing an auth token. Subsequent requests should append the token to the query string as the auth\_token parameter.  
>   
> Once you're signed in, you can get the server list from https://my.plexapp.com/pms/servers.xml.

  
  
Thanks!  
  
I was able to query the myPlex site to get the auth\_token which I then used to query the servers. I also noticed that I could use the same token when talking to my own server over the internet by entering it as the X-Plex-Token. I assume this is what I am supposed to do? One thing I observed is that I have received different tokens and they all still work against my own server? Is that correct? What causes them to change and why are old ones still valid? If I change the token slightly I get a 403 forbidden message which is what I would expect.

---

<div class="post-metadata">

**Author:** ![clintsinger](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@clintsinger](https://forums.plex.tv/u/clintsinger)\
**Post date:** [December 9, 2011, 11:42pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/7 "2011-12-09T23:42:06Z")

</div>

> [@](#):
>
> ```auto
> 
> localhost:32400/myplex/account 
> 
> ```
> 
>   
> gives you something like this (if logged into myplex):  
>   
> 
> ```auto
> 
> <MyPlex authToken="<Hash>" username="<email>" mappingState="mapped" mappingError="" mappingErrorMessage="" signInState="ok" publicAddress="<IP>" publicPort="32400" privateAddress="" privatePort="0"/>
> 
> ```
> 
>   
>   
> using  
> 
> ```auto
> 
> https://my.plexapp.com/pms?X-Plex-Token=<Hash>
> 
> ```
> 
>   
>   
> gives you something like this:  
>   
> 
> ```auto
> 
> <MediaContainer friendlyName="myPlex" machineIdentifier="<Other Hash>" identifier="com.plexapp.plugins.myplex" size="3"><br />
> <Directory key="library" title="library"/><br />
> <Directory key="servers" title="servers"/><br />
> <Directory key="system" title="system"/><br />
> </MediaContainer>
> 
> ```
> 
>   
>   
> also interesting:  
> 
> ```auto
> 
> https://my.plexapp.com/pms/playlists?X-Plex-Token=<Hash><br />
> https://my.plexapp.com/pms/playlists/queue?X-Plex-Token=<Hash><br />
> https://my.plexapp.com/pms/playlists/queue/unwatched?X-Plex-Token=<Hash><br />
> https://my.plexapp.com/pms/playlists/queue/watched?X-Plex-Token=<Hash>
> 
> ```

  
  
Cool. I will check out some of your suggestions.

---

<div class="post-metadata">

**Author:** ![solidfox](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@solidfox](https://forums.plex.tv/u/solidfox)\
**Post date:** [December 18, 2011, 11:18am UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/8 "2011-12-18T11:18:12Z")

</div>

> [@](#):
>
> Hey Clint!  
>   
> Here are the headers that can be sent to myPlex:  
>   
> X-Plex-Platform (Platform name, eg iOS, MacOSX, Android, LG, etc)  
> X-Plex-Platform-Version (Operating system version, eg 4.3.1, 10.6.7, 3.2)  
> X-Plex-Provides (one or more of [player, controller, server])  
> X-Plex-Product (Plex application name, eg Laika, Plex Media Server, Media Link)  
> X-Plex-Version (Plex application version number)  
> X-Plex-Device (Device name and model number, eg iPhone3,2, Motorola XOOM™, LG5200TV)  
> X-Plex-Client-Identifier (UUID, serial number, or other number unique per device)  
>   
> Not all of them are required, but please try to send as many as you can so we can track what clients and devices are being used to access the service :)  
>   
> You should sign in by issuing a POST request to https://my.plexapp.com/users/sign\_in.xml. The username and password should be sent using HTTP Basic Auth. If the request is successful, you'll get XML back containing an auth token. Subsequent requests should append the token to the query string as the auth\_token parameter.  
>   
> Once you're signed in, you can get the server list from https://my.plexapp.com/pms/servers.xml.

  
  
Any official documentation on how to write a client for this?

---

<div class="post-metadata">

**Author:** ![JimBurlison](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jimburlison/32/117872_2.png) [@JimBurlison](https://forums.plex.tv/u/JimBurlison)\
**Post date:** [December 15, 2014, 9:34pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/9 "2014-12-15T21:34:26Z")

</div>

Updated&nbsp;[https://forums.plex.tv/topic/104353-pms-web-api-documentation/](https://forums.plex.tv/topic/104353-pms-web-api-documentation/)&nbsp;google API doc with this information.

---

<div class="post-metadata">

**Author:** ![redchiliflakes](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/redchiliflakes/32/122808_2.png) [@redchiliflakes](https://forums.plex.tv/u/redchiliflakes)\
**Post date:** [August 29, 2015, 1:25am UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/10 "2015-08-29T01:25:03Z")

</div>

Thanks, figured it out!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 9:23pm UTC](https://forums.plex.tv/t/myplex-access-with-http-api/11945/11 "2019-12-20T21:23:27Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
