Skip to main content

1. API Purpose

The Sessions API provides users with control over their active logins. It allows parents and staff to view where they are logged in and remotely terminate unauthorized sessions. The Diagnostics layer provides school administrators with tools to verify system health and notification delivery status.

2. Endpoint Definition


3. Authentication Flow

Standard JWT validation.
  • Sessions: Users can only view or delete sessions belonging to their own ID.
  • Diagnostics: Restricted to Super Admins and School IT contacts.

4. Request Structure

GET /parent-app/sessions

Headers:

DELETE /parent-app/sessions/:id

URL Parameters:

DELETE /parent-app/sessions

Description: Terminates all sessions except the current one. Headers:

GET /web-app/sessions

Headers:

DELETE /web-app/sessions/:id

URL Parameters:

GET /web-app/diagnostics/health

Headers:

POST /web-app/diagnostics/test-push

Request Body:

5. Response Structure

Success: Session List (200 OK)

Route: GET /{module}/sessions

Success: Session Terminated (200 OK)

Route: DELETE /{module}/sessions/:id

Success: Bulk Logout (200 OK)

Route: DELETE /parent-app/sessions

Success: System Health (200 OK)

Route: GET /web-app/diagnostics/health

Success: Test Push Sent (200 OK)

Route: POST /web-app/diagnostics/test-push

6. Error Responses


7. Security Considerations

  • Remote Revocation: When a session is deleted, any JWT associated with that session_token will be rejected by the API middleware on its next call.
  • Hardware IDs: Sessions are often linked to hardware identifiers to distinguish between multiple devices owned by the same user.

8. Token Usage


9. Token Refresh

N/A.

10. Logout / Session Invalidation

This module is the core of session invalidation. Standard /logout calls the internal logic of this module to mark the current session as inactive.

11. Usage Example (cURL)


12. Notes / Special Behaviors

  • Session Cleanup: The system periodically runs a background worker to prune expired sessions (e.g., sessions inactive for more than 90 days).
  • Diagnostics: Test-push diagnostics bypass standard filtering to ensure the delivery pipeline is functional.