Skip to main content
GET
/
library
/
sections
/
all
PlexGO
package main

import(
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Library.GetSections(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
{
  "MediaContainer": {
    "identifier": "<string>",
    "offset": 123,
    "size": 123,
    "totalSize": 123,
    "allowSync": true,
    "Directory": [
      {
        "title": "<string>",
        "type": "<string>",
        "agent": "<string>",
        "allowSync": true,
        "art": "<string>",
        "composite": "<string>",
        "content": true,
        "contentChangedAt": 123,
        "createdAt": 123,
        "directory": true,
        "filters": true,
        "hidden": true,
        "key": "<string>",
        "language": "<string>",
        "Location": [
          {
            "id": 123,
            "path": "<any>"
          }
        ],
        "refreshing": true,
        "scannedAt": 123,
        "scanner": "<string>",
        "thumb": "<string>",
        "updatedAt": 123
      }
    ],
    "title1": "<string>"
  }
}

Authorizations

X-Plex-Token
string
header
required

The token which identifies the user accessing the PMS. This can be either:

  • A traditional access token obtained from plex.tv
  • A JWT token obtained through the JWT authentication flow

JWT tokens provide better security with:

  • Short-lived tokens (7 days expiration)
  • Public-key cryptography (ED25519)
  • Better clock synchronization
  • Individual device revocation capability

Response

200 - application/json

OK

MediaContainer
object

MediaContainer is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable. Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination) The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the parentTitle attribute may appear on the MediaContainer rather than being repeated on each track.