Web Services API
Last updated 21 November 2026.
Klass adds its data to Joomla's Web Services API, so other systems can read and change it.
What the API covers
- courses
- lessons
- enrolments
- progress
- grading
- orders
- organisation seats
Authentication
The API uses Joomla API tokens. Each request acts with the permissions of the user who owns the token, so a token can only reach what that user could reach in Klass.
- Make sure the API Authentication - Web Services Joomla Token and User - Joomla API Token plugins are enabled, and the Web Services - Klass plugin too.
- Open the user's account in Users, then Manage, and copy the token from the Joomla API Token tab.
- Send it with each request in the
X-Joomla-Tokenheader.
Joomla gives API tokens to Super Users only. To give one to another group, such as organisation managers, add the group in the User - Joomla API Token plugin's options.
Every Klass address starts with your site's API address followed by v1/klass/, for example https://your-site.example/api/index.php/v1/klass/courses. The Integrations screen in the Klass administrator shows this address with a copy button, and lists the routes below.
Requests and responses
Responses are JSON:API documents (application/vnd.api+json). A single item or a list is in data, each item with its type, id and attributes. Lists carry meta.total, meta.offset and meta.limit.
- Paging:
page[offset]andpage[limit]. The limit is 20 by default and 100 at most. - Filters:
filter[name]=value, as listed for each route. - Sending data: a JSON body, either the fields themselves or a JSON:API document with the fields in
data.attributes. - Errors: an
errorslist, each with astatusand atitle, and the HTTP status to match: 403 when the account may not do something, 404 when an item does not exist or is not visible to the account, and 422 when the data sent is not valid.
Routes
| Method | Path | What it does |
|---|---|---|
| GET | courses |
Lists courses. Filters: search (title or course code), category (category id) |
| GET | courses/{id} |
One course |
| GET | courses/{id}/lessons |
A course's published lessons, in order, with their section |
| GET | enrolments |
Lists enrolments. Filters: course (id or course code), learner (user id or email), status |
| POST | enrolments |
Enrols a learner on a course |
| GET | enrolments/{id} |
One enrolment |
| PATCH | enrolments/{id} |
Changes an enrolment's status |
| GET | progress |
A learner's courses with each lesson's progress. Filter: learner (user id or email); without it, the token holder's own |
| GET | grades/{id} |
An assignment submission and its grade |
| PATCH | grades/{id} |
Grades an assignment submission |
| GET | orders |
Lists orders with their lines. Filters: status, since (a date) |
| GET | organisations/{id}/seats |
An organisation's seats by course: total, assigned, free and expiry |
| POST | organisations/{id}/seats |
Adds a seat pack |
| PATCH | organisations/{id}/seats |
Gives a seat to a person, or takes it back |
Who can see what
- Courses: published courses for everyone with a token. Klass managers also see unpublished ones.
- Enrolments and progress: Klass managers and people allowed to manage enrolments see everyone. Organisation managers see their organisation's people, line managers the people in their departments or teams, and everyone else only themselves.
- Grades: Klass managers, and course team members with the grading permission on that course.
- Orders: Klass managers and people allowed to manage orders see every order. Others see their own orders and those of organisations they manage.
- Seats: an organisation's managers and Klass managers. Only Klass managers can add seat packs.
Fields you send
POST enrolments
| Field | Detail |
|---|---|
course |
Course id or course code. Required |
user_id |
The learner's Joomla user id, or |
email and name |
The learner's email. An account is created for an address that has none, with this name |
cohort_id |
Optional, for a course with cohorts |
The learner is told by email, as when an administrator enrols them. Requires permission to manage enrolments.
PATCH enrolments/{id}
| Field | Detail |
|---|---|
status |
One of pending, active, completed, expired, cancelled, paused |
PATCH grades/{id}
| Field | Detail |
|---|---|
points |
The score, or |
rubric |
Points for each rubric criterion, as a list in the rubric's order, for example [4, 3, 5] |
feedback |
Optional text for the learner |
return |
true to return the work to the learner for changes |
POST organisations/{id}/seats
| Field | Detail |
|---|---|
course |
Course id |
seats |
Number of seats, 1 to 100,000 |
months |
Optional. The pack ends after this many months |
note |
Optional note kept with the pack |
PATCH organisations/{id}/seats
| Field | Detail |
|---|---|
action |
assign or reclaim |
course |
Course id |
user_id or email |
The person |
Example
Enrol a learner on the course with code PY-101, creating their account if they have none:
POST /api/index.php/v1/klass/enrolments HTTP/1.1
Host: your-site.example
X-Joomla-Token: your-token
Content-Type: application/json
{"course": "PY-101", "email": "ada@example.com", "name": "Ada Obi"}
The response is 201 Created:
{
"links": {"self": "https://your-site.example/api/index.php/v1/klass/enrolments"},
"data": {
"type": "enrolments",
"id": "412",
"attributes": {
"status": "active",
"source": "api",
"progress": 0,
"enrolled": "2026-11-21 09:30:00",
"expires": null,
"completed": null,
"last_access": null,
"cohort_id": 0,
"course": {"id": 7, "code": "PY-101", "title": "Data analysis with Python"},
"learner": {"id": 318, "name": "Ada Obi", "email": "ada@example.com"}
}
}
}
Learning standards addresses
The Learning Record Store (v1/klass/xapi/...) and Klass's LTI services (v1/klass/lti/...) are on the same API address but do not use Joomla tokens: they check their own keys and signed tokens. See Learning standards.