Plex icon

Plex

Interact with Plex Media Server API

Library → Get Contents

AI-generated

Summary

Retrieve the contents of a specified Plex library section, optionally filtered by media type, sorted, and limited in number.

Inputs

  • Library Key (required) — The unique key or ID of the Plex library section from which to get contents.
  • Return All — Whether to return all matching items or limit the number of results.
  • Limit — Maximum number of results to return when not returning all.
  • Options — Additional filter and sorting options including media type filter, sort order, and filter for unwatched items only.

Output shape

an array of media item metadata objects, one per library content item

If 'Return All' is true, the operation paginates internally to return all items; otherwise, it returns up to the specified limit. The items include metadata as returned by Plex's /library/sections/{libraryKey}/all endpoint.

Examples

Example 1: Get first 50 movies in a library section with key '1'

Library Key = 1, Return All = false, Limit = 50, Options.Type = '1' (Movie)

Example 2: Get all unwatched items from a library section

Library Key = , Return All = true, Options.Unwatched Only = true

Discussion