| name | jellyfin-cli |
| description | Query your Jellyfin media server from the terminal — recently added media, search, item details, next-up episodes, library browsing, server info, and stats. Use when the user asks about Jellyfin, media server, movies, TV shows, next episodes, or their media library. |
| license | MIT |
| compatibility | Requires JELLYFIN_URL (default http://localhost:8096) and JELLYFIN_API_KEY env vars; `recent`, `next-up`, and `item` also require JELLYFIN_USER_ID or --user-id. Python 3.8+ and the `requests` library. Generate an API key at Dashboard → API Keys in the Jellyfin admin panel. |
| metadata | {"tags":"jellyfin, media-server, movies, tv, episodes, recently-added, library, home-media, api-client","sources":"https://jellyfin.org/docs/general/clients/api, https://jellyfin.org/downloads"} |
jellyfin-cli — Jellyfin Media Server from the Terminal
Query recently added movies and TV episodes, search and inspect media, browse libraries, see next-up episodes, check server info, and view library statistics — all from your Jellyfin server's REST API.
Setup
- Make sure your Jellyfin server is running and accessible.
- Generate an API key in the Jellyfin Dashboard → API Keys →
+ to create a new key.
- Set these environment variables:
export JELLYFIN_URL="http://your-server:8096"
export JELLYFIN_API_KEY="your-api-key-here"
export JELLYFIN_USER_ID="your-jellyfin-user-id"
Run the bundled CLI as scripts/jellyfin-cli. --help and --dry-run work without credentials.
Essential Commands
info — Server information
scripts/jellyfin-cli info
scripts/jellyfin-cli info --json
scripts/jellyfin-cli --dry-run info
Shows: server name, version, operating system, number of users.
recent — Recently added media
scripts/jellyfin-cli recent
scripts/jellyfin-cli recent --limit 20
scripts/jellyfin-cli recent --movies
scripts/jellyfin-cli recent --episodes
scripts/jellyfin-cli recent --user-id USER_ID
scripts/jellyfin-cli recent --movies --limit 5
scripts/jellyfin-cli recent --json
Uses Jellyfin's current /Items/Latest endpoint. --movies and --episodes send includeItemTypes to the server, so the requested limit applies to the selected media type. Shows: name, type (Movie/Episode), production year, series name (for episodes), date added.
search — Search your media library
scripts/jellyfin-cli search --query "dune"
scripts/jellyfin-cli search --query "dune" --type Movie
scripts/jellyfin-cli search --query "star trek" --type Series,Episode
scripts/jellyfin-cli search --query "inception" --limit 5
scripts/jellyfin-cli search --query "dune" --json
The --type flag accepts a comma-separated list of item types (e.g. Movie,Series,Episode).
Navigation — Inspect media and browse libraries
scripts/jellyfin-cli search --query "dune" --type Movie
scripts/jellyfin-cli item --id ITEM_ID
scripts/jellyfin-cli libraries
scripts/jellyfin-cli browse --library-id LIBRARY_ID --type Movie --limit 20
scripts/jellyfin-cli browse --library-id LIBRARY_ID --start-index 20
scripts/jellyfin-cli next-up --limit 10
scripts/jellyfin-cli next-up --user-id USER_ID --json
Use search -> item to look up a result's metadata, and libraries -> browse to page through a collection. next-up returns the next unwatched episodes for the selected user. item and next-up require JELLYFIN_USER_ID or --user-id; all three commands are read-only.
libraries — List media libraries
scripts/jellyfin-cli libraries
scripts/jellyfin-cli libraries --json
Shows: library name, collection type (movies, tvshows, music, etc.), library ID.
stats — Library statistics
scripts/jellyfin-cli stats
scripts/jellyfin-cli stats --json
Shows: total count of movies, series, episodes, and songs in the library.
Global Flags
These flags work anywhere in the command — before or after the subcommand:
scripts/jellyfin-cli --json recent --limit 5
scripts/jellyfin-cli recent --limit 5 --json
scripts/jellyfin-cli --dry-run search --query "dune"
| Flag | Effect |
|---|
--json | Output machine-readable JSON instead of human-readable text |
--dry-run | Show each request path and parameters without executing it |
Known Gotchas
- JELLYFIN_URL must include protocol and port — Both are required, e.g.
http://192.168.1.100:8096. A bare hostname or IP without http:// and :8096 will fail. The default is http://localhost:8096.
- User-scoped commands require an explicit user — Set
JELLYFIN_USER_ID or pass --user-id USER_ID to recent, next-up, or item. The CLI never selects an administrator automatically. A real request without either value fails before network access; dry-run previews the request with a null user ID.
- Recent type filtering is server-side —
--movies and --episodes become the /Items/Latest includeItemTypes parameter before limit; no local filtering is applied.
- Search type values — The
--type flag for search uses Jellyfin item type names (e.g. Movie, Series, Episode, MusicArtist, MusicAlbum). Multiple types are comma-separated without spaces.
- API key location — Generate the key in the Jellyfin Dashboard under Dashboard → API Keys. The key is sent as the
X-Emby-Token header.
- Lazy auth —
--help and --dry-run work even when JELLYFIN_URL and JELLYFIN_API_KEY are not set. Dry-run reports request paths and parameters but never sends credentials or makes a network call.
- No pagination — Every command returns a single page of results. The CLI does not auto-paginate beyond the first response. Use
--limit to control result size.
References