Export and Migrate Your Plex Watch History

Published 2026-10-14 · PlexBeam

Your Plex watch history — what you have watched, how far you got in each episode, your ratings, and your on-deck queue — is stored in the Plex database on your server. If you are migrating to a new server, switching platforms, or just want a backup, you need to know how to export, transfer, and restore this data. This guide covers every method from simple full-server migration to selective history export.

Method 1: Full Server Migration (Preserves Everything)

The most reliable way to keep all watch history is to copy the entire Plex data directory from the old server to the new one. This preserves every piece of data: watch status, progress, ratings, on-deck, and user-specific history for all managed and shared users.

The database file that contains watch history is:

Plug-in Support/Databases/com.plexapp.plugins.library.db

This single SQLite database holds your entire library catalog, all user activity, and all metadata references. Copying the full data directory (which includes this database plus metadata cache, settings, and plug-ins) is the recommended approach and is covered in detail in a full server migration guide.

The key point: if you copy the data directory correctly, watch history comes along automatically. No export or import step is needed.

Method 2: Trakt Sync (Cross-Platform, Cloud-Backed)

Trakt.tv is a free service that acts as a universal watch history tracker across media platforms. The Trakt plugin for Plex syncs your watch history to the cloud, where it can be pulled into a new Plex server or any other platform (Jellyfin, Emby, Kodi, etc.).

Setting Up Trakt Sync

  1. Create a free account at trakt.tv.
  2. Install the Trakt plugin on your Plex server. The plugin is available in the Plex plugin directory or can be installed manually from GitHub.
  3. Authorize the plugin with your Trakt account (the plugin will give you a code to enter at trakt.tv/activate).
  4. Configure sync settings: choose which libraries to sync, whether to sync ratings, and whether to mark items as watched on Trakt when played on Plex.
  5. Run an initial sync. This uploads your entire Plex watch history to Trakt. For large libraries, this may take several minutes.

Restoring from Trakt to a New Server

  1. Install Plex and set up your libraries on the new server.
  2. Install the Trakt plugin on the new server.
  3. Authorize with the same Trakt account.
  4. Run a sync — the plugin pulls your watch history from Trakt and marks the corresponding items as watched in Plex.

Limitations

  • Trakt records what you watched and when, but does NOT store your exact playback position (how far into an episode you stopped). Partially watched content loses its progress marker.
  • Trakt matches by metadata (show name, season, episode number, movie title + year). If your files have different metadata on the new server, some matches may fail.
  • Ratings sync reliably. On-deck status does not — Trakt has no concept of an on-deck queue.

Method 3: Plex API Export

Plex exposes watch history through its API, which you can query to export data programmatically. This is useful for custom migrations or backups.

Querying Watch History

The Plex API endpoint for watch history:

http://your-server:32400/status/sessions/history/all?X-Plex-Token=YOUR_TOKEN

This returns XML or JSON with every watched item, timestamp, and user. You can filter by user, library, and date range.

To get your Plex token: sign into the Plex web app, open browser developer tools, and look for X-Plex-Token in any API request. Or find it in Preferences.xml in the Plex data directory.

Exporting with PlexAPI (Python)

The python-plexapi library makes it easy to script watch history exports:

from plexapi.server import PlexServer

plex = PlexServer('http://your-server:32400', 'YOUR_TOKEN')

for section in plex.library.sections():

  for item in section.search(unwatched=False):

    print(f"{item.title} - watched: {item.isWatched} - viewCount: {item.viewCount}")

You can extend this to export to CSV, JSON, or any format. To restore on a new server, iterate through the export and call item.markWatched() for each matching item.

Method 4: Direct Database Query

For maximum control, you can query the Plex SQLite database directly. This is an advanced method that requires comfort with SQL.

The relevant tables:

  • metadata_item_views: Contains every view record — item ID, user ID, timestamp, and device.
  • metadata_item_settings: Contains per-item settings like view offset (where you stopped in a partially watched item), ratings, and skip markers.
  • metadata_items: The catalog of all items with titles, GUIDs, and library sections.

Exporting Watch Status

sqlite3 com.plexapp.plugins.library.db

SELECT mi.title, mi.year, miv.viewed_at, miv.grandparent_title

FROM metadata_item_views miv

JOIN metadata_items mi ON mi.id = miv.metadata_item_id

ORDER BY miv.viewed_at DESC;

This gives you a human-readable list of everything watched with timestamps.

Importing Into a New Database

Importing directly into a different Plex database is risky — the item IDs are different between servers, so you cannot just copy rows. The safer approach: export by GUID (Plex's unique identifier for each piece of content, like plex://movie/abc123), then match GUIDs on the new server and mark items as watched via the API.

Method 5: Plex Account Cloud Sync

Plex syncs some watch data to your plex.tv account automatically. If you sign into a new server with the same Plex account, some watch status may carry over — but this is unreliable and incomplete. It works best for:

  • Movies and shows with standard metadata (Plex matches by GUID)
  • Simple watched/unwatched status

It does NOT reliably sync:

  • Playback position (partially watched items)
  • Ratings
  • On-deck order
  • Custom playlists

Do not rely on cloud sync as your only migration method. Use it as a supplement to Trakt or a full data directory migration.

Backing Up Watch History Regularly

To protect against data loss, back up the Plex database on a schedule:

cp "Plug-in Support/Databases/com.plexapp.plugins.library.db" /backups/plex-db-$(date +%Y%m%d).db

Run this as a daily cron job while Plex is idle (or stop the server briefly for a consistent snapshot). Keep at least 7 days of backups. The database file is typically 50 MB to 2 GB depending on library size.

For Trakt users: your cloud history serves as an ongoing backup. Even if your server dies completely and you lose the database, your Trakt account has the full watch record for restoration.

Choosing the Right Method

ScenarioBest Method
Moving to new hardware, same OSFull data directory copy
Moving to a different OSFull data directory copy + update paths
Moving to a different platform (NAS to cloud)Trakt sync
Keeping ongoing backupTrakt sync + database backups
Custom migration with specific requirementsAPI export + script
Merging two serversTrakt sync (merge both into one Trakt account)
← Back to Blog
More from LuxuriousComputers: LuxuriousComputers · Computer Repair · Remote Fix · Phone Repair · HVAC · Plex Support