Overview
API keys provide persistent authentication tokens for programmatic access to Jellyfin Server without requiring user credentials. They are designed for server-to-server communication, automation scripts, and third-party integrations.When to Use API Keys
API keys are ideal for:- Background Services - Long-running processes that need persistent access
- Server Automation - Scripts for maintenance, backups, or administration
- Third-Party Integrations - External services connecting to Jellyfin
- CI/CD Pipelines - Automated testing or deployment workflows
- Monitoring Tools - Health checks and metrics collection
For user-facing applications, use user authentication instead of API keys to maintain proper permission boundaries.
List API Keys
Retrieve all existing API keys.Endpoint Details
Retrieve all API keys
Must include a token with administrator privileges
RequiresElevation (Administrator)
Response
Array of API key objects
Total number of API keys
Starting index (always 0)
Response Example
Create API Key
Create a new API key for an application.Endpoint Details
Create a new API key
Name of the application that will use this API key. Choose a descriptive name that identifies the purpose or service.
Must include a token with administrator privileges
RequiresElevation (Administrator)
Response: 204 No Content
The API key token is not returned in the response. After creating a key, call List API Keys to retrieve the newly generated token.
Complete Example: Create and Retrieve
Revoke API Key
Delete an API key to permanently revoke access.Endpoint Details
Revoke an API key
The access token to revoke (the API key itself)
Must include a token with administrator privileges
RequiresElevation (Administrator)
Response: 204 No Content
Using API Keys
Once created, API keys work exactly like user access tokens and can be included in requests using any of these methods:Method 1: Authorization Header (Recommended)
Method 2: Query Parameter
Method 3: Legacy Headers (if enabled)
API Key Permissions
API keys automatically have administrator-level privileges, granting access to:- All user data and content
- Server configuration endpoints
- User management operations
- System administration functions
- Library management
- Plugin installation and configuration
Security Best Practices
Secure Storage
Environment Variables
Environment Variables
Store API keys in environment variables, never in source code:
Secret Management
Secret Management
Use secret management services for production:
- AWS Secrets Manager
- Azure Key Vault
- HashiCorp Vault
- Kubernetes Secrets
Configuration Files
Configuration Files
If storing in config files:
- Use restrictive file permissions (chmod 600)
- Exclude from version control (.gitignore)
- Encrypt sensitive configuration files
Access Control
- Descriptive Names - Use clear, descriptive app names that identify the purpose
- Minimal Keys - Create only as many keys as necessary
- Regular Audits - Periodically review and revoke unused keys
- Rotation Policy - Consider rotating keys on a schedule (quarterly/annually)
- Activity Monitoring - Monitor
DateLastActivityto identify inactive keys
Network Security
- HTTPS Only - Always use HTTPS in production to encrypt API keys in transit
- Firewall Rules - Restrict API access to known IP addresses when possible
- VPN/Private Network - Consider using VPN or private networks for sensitive integrations
- Rate Limiting - Implement rate limiting on your services using API keys
Troubleshooting
Authentication Fails with API Key
Problem: Receiving 401 Unauthorized when using an API key Solutions:- Verify the API key hasn’t been revoked (check
DateRevokedfield) - Ensure the API key is being sent correctly in the Authorization header or query parameter
- Check that legacy authorization is enabled if using X-Emby-Token headers
- Confirm the API key string is complete and not truncated
Cannot Create API Key
Problem: Receiving 403 Forbidden when creating an API key Solutions:- Verify you’re authenticated with an administrator account
- Check that your user has the “IsAdministrator” permission
- Ensure the server has completed initial setup
API Key Not Listed After Creation
Problem: New API key doesn’t appear in the list Solutions:- Wait a moment and try listing again (database write may be async)
- Verify the creation request returned 204 No Content
- Check server logs for any database errors
- Ensure you have permission to view all API keys
Example: Complete Integration
Here’s a complete example of managing API keys in a Python application:Next Steps
Authentication Overview
Learn about user authentication and token management
System Endpoints
Use API keys to access system information