GET
/
library
/
recentlyAdded
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Components;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using System.Collections.Generic;

var sdk = new PlexAPI(accessToken: "<YOUR_API_KEY_HERE>");

GetRecentlyAddedLibraryRequest req = new GetRecentlyAddedLibraryRequest() {
    ContentDirectoryID = 2,
    PinnedContentDirectoryID = new List<long>() {
        3,
        5,
        7,
        13,
        12,
        1,
        6,
        14,
        2,
        10,
        16,
        17,
    },
    SectionID = 2,
    Type = QueryParamType.TvShow,
};

var res = await sdk.Library.GetRecentlyAddedLibraryAsync(req);

// handle response
{
  "MediaContainer": {
    "Type": [
      {
        "key": "/library/sections/2/all?type=2",
        "type": "filter",
        "subtype": "clip",
        "title": "TV Shows",
        "active": false,
        "Filter": [
          {
            "filter": "genre",
            "filterType": "string",
            "key": "/library/sections/2/genre?type=2",
            "title": "Genre",
            "type": "filter",
            "advanced": true
          }
        ],
        "Sort": [
          {
            "default": "asc",
            "active": false,
            "activeDirection": "asc",
            "defaultDirection": "asc",
            "descKey": "titleSort:desc",
            "firstCharacterKey": "/library/sections/2/firstCharacter",
            "key": "titleSort",
            "title": "Title"
          }
        ],
        "Field": [
          {
            "key": "show.title",
            "title": "Show Title",
            "type": "string",
            "subType": "rating"
          }
        ]
      }
    ],
    "FieldType": [
      {
        "type": "tag",
        "Operator": [
          {
            "key": "=",
            "title": "is"
          }
        ]
      }
    ],
    "size": 50,
    "allowSync": true,
    "identifier": "com.plexapp.plugins.library",
    "mediaTagPrefix": "/system/bundle/media/flags/",
    "mediaTagVersion": 1680021154,
    "mixedParents": true,
    "Metadata": [
      {
        "allowSync": true,
        "librarySectionID": 1,
        "librarySectionTitle": "Movies",
        "librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
        "ratingKey": 59398,
        "key": "/library/metadata/59398",
        "guid": "plex://movie/5e161a83bea6ac004126e148",
        "studio": "Marvel Studios",
        "type": "movie",
        "title": "Ant-Man and the Wasp: Quantumania",
        "contentRating": "PG-13",
        "summary": "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.",
        "rating": 4.7,
        "audienceRating": 8.3,
        "year": 2023,
        "tagline": "Witness the beginning of a new dynasty.",
        "thumb": "/library/metadata/59398/thumb/1681888010",
        "art": "/library/metadata/59398/art/1681888010",
        "duration": 7474422,
        "originallyAvailableAt": "2023-02-15T00:00:00.000Z",
        "addedAt": 1681803215,
        "updatedAt": 1681888010,
        "audienceRatingImage": "rottentomatoes://image.rating.upright",
        "chapterSource": "media",
        "primaryExtraKey": "/library/metadata/59399",
        "ratingImage": "rottentomatoes://image.rating.rotten",
        "Media": [
          {
            "id": 120345,
            "duration": 7474422,
            "bitrate": 3623,
            "width": 1920,
            "height": 804,
            "aspectRatio": 2.35,
            "audioChannels": 6,
            "audioCodec": "ac3",
            "videoCodec": "h264",
            "videoResolution": 1080,
            "container": "mp4",
            "videoFrameRate": "24p",
            "optimizedForStreaming": 0,
            "has64bitOffsets": true,
            "videoProfile": "high",
            "Part": [
              {
                "id": 120353,
                "key": "/library/parts/120353/1681803203/file.mp4",
                "duration": 7474422,
                "file": "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4",
                "size": 3395307162,
                "container": "mp4",
                "has64bitOffsets": true,
                "hasThumbnail": 1,
                "optimizedForStreaming": true,
                "videoProfile": "high"
              }
            ]
          }
        ],
        "Genre": [
          {
            "tag": "Comedy"
          }
        ],
        "Director": [
          {
            "tag": "Peyton Reed"
          }
        ],
        "Writer": [
          {
            "tag": "Jeff Loveness"
          }
        ],
        "Country": [
          {
            "tag": "United States of America"
          }
        ],
        "Role": [
          {
            "tag": "Paul Rudd"
          }
        ]
      }
    ]
  }
}

Authorizations

X-Plex-Token
string
header
required

Plex Authentication Token

Query Parameters

contentDirectoryID
integer
Example:

2

pinnedContentDirectoryID
integer[]
Example:
[3, 5, 7, 13, 12, 1, 6, 14, 2, 10, 16, 17]
sectionID
integer

The library section ID for filtering content.

Example:

2

type
enum<integer>
required

The type of media to retrieve or filter by. 1 = movie 2 = show 3 = season 4 = episode E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries

Available options:
1,
2,
3,
4,
8,
9,
10
Example:

2

includeMeta
enum<integer>
default:0

Adds the Meta object to the response

Available options:
0,
1
Example:

1

X-Plex-Container-Start
integer
default:0

The index of the first item to return. If not specified, the first item will be returned. If the number of items exceeds the limit, the response will be paginated. By default this is 0

Example:

0

X-Plex-Container-Size
integer
default:50

The number of items to return. If not specified, all items will be returned. If the number of items exceeds the limit, the response will be paginated. By default this is 50

Example:

50

Response

200
application/json
The recently added content
MediaContainer
object

The Meta object is only included in the response if the includeMeta parameter is set to 1.