API Documentation
28 routes · Version 1.11.0
Pages
/
Serves the main HTML page.
text/html/api/docs
This page. Auto-generated API documentation.
text/html/qr
QR code scanner page.
text/html/login
Login page with username/password and passkey support.
text/html/logout
Clear session cookie and redirect to home.
302 Redirect/settings
Auth
Settings page for passkey management. Requires authentication.
text/html/admin/settings
Auth Admin
Admin settings page with site-wide toggles. Requires admin authentication.
text/htmlAuthentication
/api/v1/auth/login
Authenticate with username and password. Returns a temporary bearer token.
{"username": "string", "password": "string"}{"token": "string", "expiresAt": 1750000000000}- 400 Invalid request body
- 401 Invalid credentials
/api/v1/auth/logout
Revoke the bearer token from the Authorization header.
{"message": "Logged out"}WebAuthn
/api/v1/auth/webauthn/register/options
Auth
Get WebAuthn registration options for the authenticated user.
PublicKeyCredentialCreationOptions JSON/api/v1/auth/webauthn/register
Auth
Complete WebAuthn registration with attestation response.
{ id, rawId, type, attestationObject, clientDataJSON, name? }{"message": "Passkey registered"}- 400 Invalid request body
- 400 Invalid or expired challenge
/api/v1/auth/webauthn/login/options
Get WebAuthn login options with allowed credentials.
PublicKeyCredentialRequestOptions JSON/api/v1/auth/webauthn/login
Complete WebAuthn login with assertion response. Sets session cookie.
{ id, rawId, type, authenticatorData, clientDataJSON, signature, userHandle? }{"message": "Authenticated as <username>"}- 400 Invalid request body
- 400 Invalid or expired challenge
- 401 Unknown credential
- 401 Authentication failed
/api/v1/auth/webauthn/credentials
Auth
List the authenticated user's registered passkeys.
{"credentials": [{"id": "...", "name": "...", "createdAt": "..."}]}/api/v1/auth/webauthn/credentials/{id}
Auth
Delete a passkey owned by the authenticated user.
{"message": "Credential deleted"}- 400 Credential ID required
- 404 Credential not found
QR Scanner
/api/v1/qr/session
Auth
Returns the signed-in Discord user and the destinations a scan can be posted to. Requires a device token from the Discord login.
{"user": {"displayName": "name", "avatarURL": null}, "targets": [{"id": "discord:123", "subscriber": "discord", "label": "Server", "iconURL": null}], "messengerURL": null}- 401 Invalid or expired device token
/api/v1/qr/publish
Auth
Posts a scanned Moodle attendance link (https only, host moodle.vilniustech.lt, path ending in /attendance.php) to the chosen destination, for example a Discord server through the bot. A link already posted in that server within the last 15 minutes is refused with 409 unless force is true.
{"targetID": "discord:123", "content": "https://moodle.vilniustech.lt/.../attendance.php?...", "force": false}{"destination": "Server · #channel", "messageID": "123456789", "relayID": "uuid or null"}- 400 The scanned code is not a Moodle attendance link
- 401 Invalid or expired device token
- 429 Scan limit reached (5 successful scans per 5 minutes per user, counted from the first); see the Retry-After header
- 409 Already posted recently: {"error": "...", "duplicate": true, "sender": "name", "ageSeconds": 120}
- 502 The destination or bot refused the message or did not confirm it
/api/v1/qr/relays/{id}
Auth
Status of the copy of a scan that is relayed to other chats (for example the Messenger group) after it was posted. Poll until status is done.
{"status": "done", "outcome": "relayed", "results": [{"recipient": "messenger", "status": "delivered", "detail": null}], "error": null}- 401 Invalid or expired device token
- 404 Unknown relay
/api/v1/qr/logout
Auth
Revokes the device token used for the request.
VGTU
/api/v1/vgtu/totp
Auth
Returns the encrypted TOTP secret.
text/plain (encrypted string)Admin
/api/v1/admin/users
Auth Admin
Register a new user.
{"username": "string", "password": "string"}{"message": "User '<name>' created"}- 400 Invalid request body
- 400 Username and password must not be blank
- 403 Admin access required
- 409 User already exists
- 409 Cannot register the admin user
/api/v1/admin/users
Auth Admin
List all registered usernames.
{"users": ["string"]}- 403 Admin access required
/api/v1/admin/users/{username}
Auth Admin
Delete a registered user by username.
{"message": "User '<name>' deleted"}- 400 Username is required
- 403 Admin access required
- 404 User not found
/api/v1/admin/qr-ratelimits
Auth Admin
Clear all QR scan rate limit buckets.
{"message": "QR rate limits cleared"}- 403 Admin access required
/api/v1/admin/settings/qr-protection
Auth Admin
Get the current QR protection state.
{"enabled": true}- 403 Admin access required
/api/v1/admin/settings/qr-protection
Auth Admin
Toggle QR protection. When enabled, QR scanner page and API require authentication.
{"enabled": true}{"enabled": true}- 400 Invalid request body
- 403 Admin access required
/api/v1/admin/settings
Auth Admin
Get all admin settings including QR protection state, env overrides, and env defaults.
{"qrProtectionEnabled": true, "envOverrides": {"KEY": "value"}, "envDefaults": {"KEY": "value"}}- 403 Admin access required
/api/v1/admin/settings
Auth Admin
Update all admin settings. Validates env values (not blank, URL format, boolean). Overrides take precedence over .env file values.
{"qrProtectionEnabled": true, "envOverrides": {"KEY": "value"}}{"qrProtectionEnabled": true, "envOverrides": {"KEY": "value"}, "envDefaults": {"KEY": "value"}}- 400 Invalid request body
- 400 Validation error (key-specific)
- 403 Admin access required