Deep Links

The Plex app for iOS supports deep links, but they aren’t documented anywhere. So I did some poking about, and here’s what I’ve learned.

There are three schemes that will prompt iOS to open Plex:

  • plex://
  • plexapp://
  • plexappext://

The plexapp:// scheme deals with app activation only and is not useful to anyone except Plex, so don’t use that one. The other two can both be used to perform two actions:

  • preplay: opens a given media item to its info screen
  • play: play the given media item

The plexappext:// scheme does not provide a means of specifying the server on which the media item resides, so it is only really useful from within the app on a server-specific channel or extension.

The plex:// scheme supports specifying the server, so it is useful from outside the app. A properly constructed plex:// link will open the app (even from cold start), connect to servers, find the item, and perform the requested action, provided the app has been opened at least once before (to complete the first-run experience) and has been logged into with an account with access to the given server and media item.

For both of these schemes, specify the action as the host:

  • plex://preplay/
  • plexappext://preplay/

The plexappext:// scheme uses the path to specify the metadata key. So to tell the app to open a media item with metadata key /library/metadata/12345, use:

plexappext://preplay/library/metadata/12345

But such links only work if the app is already connected and has the appropriate server currently selected. For more flexibility, use the plex:// scheme instead.

The plex:// scheme uses querystring parameters to specify:

  • metadataKey
  • metadataType
  • server

So to open /library/metadata/12345, a movie (type = 1) on a server with id ffff1234567890abcdeffedcba0987654321ffff, use:

plex://preplay/?metadataKey=%2Flibrary%2Fmetadata%2F12345&metadataType=1&server=ffff1234567890abcdeffedcba0987654321ffff

To play the media item immediately instead of going to its info screen, use the play action:

plex://play/?metadataKey=%2Flibrary%2Fmetadata%2F12345&metadataType=1&server=ffff1234567890abcdeffedcba0987654321ffff

Media types are documented (unofficially) here.

Use the plex.tv web API to look up server IDs (you need the 40-hex-character machine identifier; the server’s friendly name will not work).

Use the PMS REST API to find metadata keys.

6 Likes

The schemes are slightly different in the beta version of the Plex app:

  • plex:// -> plex.beta://
  • plexapp:// -> plexappbeta://
  • plexappext:// -> plexappext.beta://

Great work thank you! I used this info to create iOS shortcuts for the Plex app.

Is there any way to pass parameters such as shuffle or volume?

3 Likes

Really helpful thanks! Is there any way to access the music stations such as Library Radio?

I’d like to know the answer on this too. I have liked the radio stations and hope to make some Siri shortcuts to them since CarPlay doesn’t do Plex.

Wonderful information here. Thanks so much for pulling it all together. Does anyone happen to know what the deeplink schemes for Android may be? My ultimate goal is scan a QR code and then have the media open up in Plex (an awesome bonus would be if it could be autoplaying through chromecast on scan).

I would also like to know about deep links on Android. I get push bullet notifications on my phone and would love to add even just a link to open Plex right in the notification.

I’ve tried those on Android as well as iPhone, it does launch the app but it doesn’t reach the media item, is anybody experiencing the same issue? :
plex://preplay/?metadataKey=%2Flibrary%2Fmetadata%2F*****&metadataType=1&server=*********

Update on this: I just got the deep link working with the latest server and app updates (Windows, iOS) and there is some simplification that can be had.

An example working URL of mine is:
plex://play/?metadataKey=%2Fplaylists%2F51446&server=yourserverid

Some things to note:

  1. There is no metadataType parameter. I tried removing it from the URL and things still work, so it seems it’s no longer necessary. Validated with a playlist and music album.
  2. I got the metadataKey simply by looking at the URL in the Plex web app (can be done on your mobile device or on your computer). Once you’re looking at the page for the item you want to play, simply look for the “key” query parameter. The value of it is the metadataKey.

For example, for the following web app URL: http://127.0.0.1:32400/web/index.html#!/server/yourserverid/playlist?key=%2Fplaylists%2F51446&context=library%3Acontent.playlists.music

The metadataKey is: %2Fplaylists%2F51446

That’s it! No need for the PMS REST API or unofficially documented metadataTypes anymore.

I would still love to know if there’s a way to request the item being played to be shuffled first, but this is still a huge start.

Of course ideally Plex would add official deep link support and documentation or, even better, iOS shortcuts support (for those of us on iOS). I can dream. :slight_smile:

2 Likes

Have you ever tried to deep link a tv/dvr channel? Would be great!

Has anyone gotten this to work on Android on the most recent version of Plex? I can’t seem to get Plex to open on my Google Pixel 4 XL using any of these links.

Can we please add this functionality on Android?

https://developer.android.com/training/app-links

If anyone is interested, I’ve built a simple shortcut to open any app.plex.tv link in the native iOS plex app. Not the most elegant way to do it, but it works for movies, series, episodes, collections and probably more. Simply share the link into the shortcut (it uses the preplay prefix, so it shows the item and does not immediately play it)

https://www.icloud.com/shortcuts/10522f62601b49dd964f5371840e7c02

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