Overview
Kolibri Studio API supports two authentication methods:- Token Authentication - For programmatic API access (recommended)
- Session Authentication - For browser-based requests (web interface)
Token Authentication
Studio uses Django REST Framework’s token authentication. Each user has a unique, permanent token associated with their account.How It Works
- User creates a Studio account and logs in
- System generates a unique authentication token for the user
- Client includes the token in the
Authorizationheader for API requests - Server validates the token and processes the request
Getting Your API Token
Method 1: Through the Web Interface
- Log in to Kolibri Studio at studio.learningequality.org
- Navigate to your account settings
- Look for the API token section
- Copy your token (keep it secure!)
Method 2: Programmatically
If you have session authentication (logged in through browser), you can retrieve your token via the API:Token Generation
Tokens are automatically generated when:- A user account is created
- The
User.get_token()method is called
rest_framework.authtoken.models.Token model and persists in the database.
Using Tokens in Requests
Header Format
Include the token in theAuthorization header with the Token prefix:
Example: cURL
Example: Python with requests
Example: JavaScript (Node.js)
Real Example: Check Editor Permissions
This endpoint verifies if a user has edit permissions for a specific channel:Real Example: Authenticate Token
Validate a token and get user information:Real Example: Upload a File
Upload content files to Studio:Token Security Best Practices
Do’s
- Store tokens in environment variables, not in code
- Use HTTPS for all API requests
- Rotate tokens if compromised
- Use separate accounts for different automation tasks
- Keep tokens out of version control
Don’ts
- Don’t commit tokens to Git repositories
- Don’t share tokens in public forums or documentation
- Don’t log tokens in application logs
- Don’t embed tokens in client-side code
Environment Variables Example
Token Management
Token Persistence
Tokens are permanent and stored in the database. They remain valid until:- The user account is deleted
- The token is manually regenerated (requires database access)
Multiple Tokens
Currently, each user has one token. If you need to separate access for different applications, consider:- Creating separate service accounts
- Using different user accounts for different automation tasks
Authentication Errors
Missing Token
Authorization header with your token.
Invalid Token Format
Authorization: Token YOUR_TOKEN.
Invalid Token
Session Authentication
For browser-based requests, Studio supports session authentication using cookies. This is automatically handled when you log in through the web interface. API endpoints support both authentication methods:Next Steps
API Overview
Learn about available endpoints and response formats
Channels API
Create and manage content channels
Content Nodes API
Work with content node trees
Ricecooker Integration
Use ricecooker for automated content integration
