Skip to content

Plex

The Plex integration works the same way as the Jellyfin integration — a collector script reads from your Plex server’s API and syncs play history, library stats, and user activity to numbrs.

Estimated setup time: 10 minutes

  • Play history — titles played, users, timestamps, and duration
  • Library stats — item counts per library section
  • Active streams — who’s watching what right now
  • Plex Media Server (any version)
  • A Plex token (see below)
  • Python 3
  • Your numbrs credentials — see Integrations Overview for where to find them

From Plex Web:

  1. Open Plex in your browser
  2. Play any media item, then click the three-dot menu → Get Info
  3. At the bottom of the info panel, click View XML
  4. In the URL that opens in a new tab, find X-Plex-Token=... — that’s your token

From the Preferences file (macOS):

Terminal window
grep -o 'PlexOnlineToken="[^"]*"' \
~/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml

From the Preferences file (Linux):

Terminal window
grep -o 'PlexOnlineToken="[^"]*"' \
/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml

Download the script from the Integrations page in the numbrs app, or find it in the repo at collectors/plex.sh.

Run manually first:

Terminal window
NUMBRS_SUPABASE_URL="https://YOUR_PROJECT.supabase.co" \
NUMBRS_SUPABASE_SERVICE_KEY="your-service-role-key" \
NUMBRS_OWNER_ID="your-user-id" \
PLEX_URL="http://192.168.1.x:32400" \
PLEX_TOKEN="your-plex-token" \
bash ~/numbrs-plex-collector.sh
*/15 * * * * NUMBRS_SUPABASE_URL=https://YOUR_PROJECT.supabase.co NUMBRS_SUPABASE_SERVICE_KEY=your-key NUMBRS_OWNER_ID=your-id PLEX_URL=http://192.168.1.x:32400 PLEX_TOKEN=your-plex-token bash /Users/YOUR_USERNAME/numbrs-plex-collector.sh >> /tmp/numbrs-plex.log 2>&1

“Unauthorized” error

The Plex token is wrong or expired. Try fetching a fresh one using the methods above.

“Connection refused”

Check that PLEX_URL is correct and that Plex is running. The default port is 32400. Test with: curl http://192.168.1.x:32400/identity

No play history showing

Plex only keeps play history if you have an active Plex Pass. Without it, the history endpoint may return empty. Library stats and active streams still work.