AI LMS Platform Mobile App API reference
Audience: Mobile app developers Endpoints POST https:///local/api/app.php → JSON API (all actions) GET https:///local/api/applogin.php → one-time course auto-login (open in a web
Audience: Mobile app developers
Endpoints
POST https://
/local/api/app.php → JSON API (all actions) GET https://
/local/api/applogin.php → one-time course auto-login (open in a webview)
Authentication model
- Call login with the user's credentials to receive a token.
- Send that token on every subsequent call:
Authorization: Bearer - The token expires after the configured Token lifetime; when it does, calls return
401and the user should sign in again.
Response envelope
{ "success": true, "data": { ... }, "meta": { "requestid": "..." } }
Actions
login — body:
{ "action": "login", "username": "ada", "password": "secret" }
Returns:
{ "success": true,
"data": {
"token": "klr_…",
"expires": 1781536800,
"user": { "id": 42, "username": "ada", "fullname": "Ada Lovelace",
"firstname": "Ada", "lastname": "Lovelace", "email": "ada@example.com" }
} }
me — requires token. Returns the signed-in user's profile.
trainings — requires token. Returns the user's enrolled trainings:
{ "data": { "trainings": [
{ "id": 27, "fullname": "GMP Basics", "shortname": "GMP-1",
"progress": 100, "completed": true,
"viewurl": "https://
/course/view.php?id=27", "image": "https://
/..." } ] }}
progressis a percentage (0–100) when completion tracking is on, otherwisenull.viewurlis the course page; to open it signed in, request aviewurllink (below).
course — requires token. Body: { "action": "course", "params": { "id": 27 } }. Returns the training plus per-activity completion.
viewurl — requires token. Body: { "action": "viewurl", "params": { "id": 27 } }. Returns a one-time auto-login link:
{ "data": { "url": "https://
/local/api/applogin.php?key=...&id=27", "expires": 1781536860 } }
Errors
Example sign-in
curl -X POST "https://
/local/api/app.php" \ -H "Content-Type: application/json" \ -d '{ "action": "login", "username": "ada", "password": "secret" }'
Important display note (webview vs. iframe)
Auto-login links are designed for a native webview or a new browser tab, where the sign-in works reliably. Embedding course pages in a cross-origin browser iframe may be blocked by the browser's third-party-cookie rules. Prefer a webview/new tab for viewing courses.