Introduction
Kolibri provides a comprehensive REST API for managing educational content, users, facilities, and learning activities. The API follows REST principles and uses JSON for request and response payloads.Base URL
All API endpoints are relative to your Kolibri server’s base URL:API Versioning
Kolibri does not currently use explicit API versioning in the URL path. The API evolves with the Kolibri version, maintaining backward compatibility where possible.Authentication
Most API endpoints require authentication. Kolibri uses session-based authentication by default. See the Authentication documentation for details on login, logout, and session management.Request Format
HTTP Methods
The API uses standard HTTP methods:GET- Retrieve resourcesPOST- Create new resourcesPUT- Update entire resourcesPATCH- Partial update of resourcesDELETE- Delete resources
Content Type
All POST, PUT, and PATCH requests should include theContent-Type: application/json header and send data as JSON in the request body.
Response Format
Success Responses
Successful responses return JSON data with appropriate HTTP status codes:200 OK- Successful GET, PUT, PATCH requests201 Created- Successful POST request creating a resource204 No Content- Successful DELETE request
Error Responses
Error responses include appropriate HTTP status codes and error details:400 Bad Request- Invalid request data401 Unauthorized- Authentication required or failed403 Forbidden- Authenticated but lacking permissions404 Not Found- Resource not found500 Internal Server Error- Server error
id) and metadata with field-specific information.
Pagination
Optional Pagination
Many list endpoints support optional pagination using theOptionalPageNumberPagination class. Pagination is activated only when the page_size parameter is provided.
Number of results to return per page. If not specified, all results are returned.
Page number to retrieve (1-indexed).
Total number of items across all pages.
URL to the next page of results, or
null if this is the last page.URL to the previous page of results, or
null if this is the first page.Array of items for the current page.
Filtering and Searching
Many endpoints support filtering and searching through query parameters.Filtering
Filter by specific field values:Search
Search across multiple fields using thesearch parameter:
username, full_name, and title.
Ordering
Order results using theordering parameter:
- for descending order.
ValuesViewset Pattern
Many Kolibri API endpoints use theValuesViewset pattern for performance optimization. This pattern:
- Fetches only needed fields in a single database query
- Avoids N+1 query problems when traversing relationships
- Returns data directly from database values without model instantiation
ValuesViewset endpoints behave like standard REST endpoints but offer better performance for read operations.
CSRF Protection
Kolibri uses CSRF protection for state-changing operations. When making POST, PUT, PATCH, or DELETE requests from a browser:- First obtain a CSRF token by making a GET request to
/api/auth/session/current/ - Include the token in subsequent requests via the
X-CSRFTokenheader
Common Query Parameters
Full-text search across searchable fields.
Field name to order results by. Prefix with
- for descending order.Enable pagination and set number of results per page.
Page number when pagination is enabled.
Rate Limiting
Kolibri does not currently implement rate limiting at the API level. However, administrators can configure rate limiting at the reverse proxy level (nginx, Apache, etc.).Next Steps
- Authentication - Learn how to authenticate and manage sessions
- Permissions - Understand the permission system and access control