pub package

An API wrapper for the Plex Web API.

The Plex Web API is a poorly documented api exposed by Plex servers.

Import Package

import 'package:dart_plex_api/dart_plex_api.dart';

Getting Started (Setup Connection)

  1. Create a PlexCredentials object representing your plex account
PlexCredentials credentials = PlexCredentials(
    username: "<USERNAME>",
    password: "<PASSWORD>",
  1. Create a PlexHeaders object with, at least, an identifier for your client.
PlexHeaders headers = PlexHeaders(
    clientIdentifier: "Plex Dart Client",
  1. Finally, create a PlexConnection object passing the previous 2 objects. Be sure to call the asynchronous authorize method to ensure a safe connection.
PlexConnection connection = await PlexConnection(
    host: "",
    port: 32400,
    credentials: credentials,
    headers: headers,


dart_plex_api supports manual raw requests and known routes (using PlexRoutes).


http.Response response = await connection.requestRaw("/");


Since the API is not properly documented, it may be difficult to know the exact result structure and correct route formats. PlexRoute objects provide a way to quickly query routes without immediate knowledge of raw routes. Each PlexRoute has a request which returns a PlexObject.

PlexRoot root = await connection.root.request();

This is also useful when multiple requests are neccessary to retrieve data. For example, it would be wise to query all library sections (at "/library/sections") to get a listing of library sections, followed by a request to get more details (at "/library/sections/<SECTION_KEY>").

dynamic sections = json.decode(
  (await connection.requestRaw("/library/sections")).body

dynamic firstSection = json.decode(
  (await connection.requestRaw("/library/sections/" + sections["key"])).body

This can be done much easier using routing objects.

PlexLibrarySectionIndex index = await connection.root.library.sections.all.request();

/// A String identifying the Library Section
String key =[0].key;

/// A String identifying the type of section (ie Music, Photos, Videos...)
String type =[0].type;

List<PlexObject> sections = await connection.root.library.sections
    key: key,




http.Response response = await connection.requestRaw("/");


PlexRoot root = await connection.root.request();



http.Response response = await connection.requestRaw("/library");


PlexLibrary library = await connection.root.library.request();

Library Section


http.Response response = await connection.requestRaw("/library/sections/2");


PlexObject library = await connection.root.library.sections.get("2")request();

Other Resources

Unofficial Python Bindings for Plex Api:

Unofficial API Wiki (Earlopain):

Unofficial API Wiki (Arcanemagus):

Remote control API Wiki (plexinc):