API Architecture
The Jellyfin API is built using ASP.NET Core and follows RESTful principles:- Framework: ASP.NET Core with Kestrel web server
- API Documentation: Swagger/OpenAPI 3.0
- Authentication: Custom authentication scheme with API keys and user tokens
- Response Format: JSON (primary), XML (supported)
- Base URL:
http://localhost:8096(default)
Project Structure
The API implementation is organized across several projects:| Project | Purpose |
|---|---|
Jellyfin.Api | API controllers, models, and middleware |
MediaBrowser.Controller | Core interfaces and business logic contracts |
MediaBrowser.Model | Shared DTOs and data models |
Emby.Server.Implementations | Core business logic implementations |
API Documentation
Jellyfin provides interactive API documentation through Swagger UI:Start the Jellyfin Server
Run the server locally (see Building from Source).
ReDoc documentation is also available at:
http://localhost:8096/api-docs/redoc/index.htmlAuthentication
The Jellyfin API uses a custom authentication scheme defined in theJellyfin.Api/Constants/AuthenticationSchemes.cs file.
Authentication Methods
- API Key
- User Token
- Username/Password
API keys provide full administrative access without user context.
API keys can be created in the Jellyfin web interface under Dashboard > API Keys.
Authorization Header Format
The custom authorization header has the following format:Core API Controllers
Here are the main API controllers inJellyfin.Api/Controllers/:
Media Management
ItemsController
Route:
/ItemsQuery and retrieve media items with extensive filtering options:- Search media library
- Filter by type, genre, year, etc.
- Pagination and sorting
- Resume points and play state
LibraryController
Route:
/LibraryManage library content:- Get similar items
- Get media folders
- Get physical paths
- Refresh metadata
VideosController
Route:
/VideosVideo-specific operations:- Get additional parts
- Delete alternate sources
- Merge versions
AudioController
Route:
/AudioAudio streaming and management:- Stream audio files
- Get audio stream info
- Universal audio endpoint
User Management
UserController
Route:
/UsersUser account operations (see Jellyfin.Api/Controllers/UserController.cs):- List users
- Create/update/delete users
- User preferences
- Authentication
UserLibraryController
Route:
/Users/{userId}/ItemsUser-specific library operations:- Get user’s items
- Mark as favorite
- User ratings
PlaystateController
Route:
/PlaystateTrack playback state:- Mark as played/unplayed
- Update play position
- Report playback progress
System & Configuration
SystemController
Route:
/SystemSystem information and operations (see Jellyfin.Api/Controllers/SystemController.cs):- Get system info
- Server endpoints
- Restart/shutdown
ConfigurationController
Route:
/ConfigurationServer configuration:- Get/update server config
- Media encoding settings
- Network configuration
PluginsController
Route:
/PluginsPlugin management (see Jellyfin.Api/Controllers/PluginsController.cs):- List installed plugins
- Enable/disable plugins
- Plugin configuration
- Uninstall plugins
Media Streaming
DynamicHlsController
Route:
/Videos/{itemId}/master.m3u8HLS adaptive streaming:- Generate HLS playlists
- Transcode on-the-fly
- Multiple quality levels
SubtitleController
Route:
/SubtitlesSubtitle operations:- Get subtitle streams
- Search for subtitles
- Upload subtitles
Common API Patterns
Dependency Injection
Controllers use constructor injection for dependencies:Jellyfin.Api/Controllers/UserController.cs
Authorization Policies
Endpoints use policy-based authorization:Jellyfin.Api/Constants/Policies.cs:
RequiresElevation- Admin onlyDefaultAuthorization- Any authenticated userFirstTimeSetupOrIgnoreParentalControl- Setup or unrestricted
Response Types
Controllers return strongly-typed responses:Query Parameters
Use model binding for complex queries:Making API Requests
Example: Get System Info
Example: Query Media Items
Example: Update Plugin Configuration
cURL
WebSocket API
Jellyfin also provides real-time updates via WebSocket connections for:- Library updates
- Playback sessions
- Plugin installation progress
- System messages
MediaBrowser.Controller/Net/WebSocketMessages/.
API Best Practices
Use API Keys for Services
For server-to-server integrations, use API keys rather than user credentials.
Implement Pagination
Always use
startIndex and limit parameters when querying large datasets.Cache Responses
Cache static data like system info and library structure to reduce API calls.
Handle Rate Limits
Implement exponential backoff for failed requests and respect server limits.
Extending the API
To add new API endpoints:Implement Business Logic
Use interfaces from
MediaBrowser.Controller/ and implementations from Emby.Server.Implementations/.Next Steps
Plugin Development
Create plugins that extend the Jellyfin API
Contributing Guide
Learn how to contribute API changes to Jellyfin
Building from Source
Set up your development environment
API Documentation
Explore the interactive API documentation