REST API Reference¶
In addition to the real-time SignalR hub, Cantus provides ASP.NET Core Minimal API HTTP endpoints for authentication, session management, and system health checks.
Authentication Endpoints¶
GET /api/auth/spotify/login (or GET /api/auth/login)¶
Initiates the Spotify OAuth 2.0 PKCE authentication flow.
- Query Parameters:
json(bool, optional): Iftrue, returns{ "authorizationUrl": "..." }in JSON instead of 302 redirect.client_id(string, optional): Ephemeral client handshake ID. When provided, the server notifies this specific client via SignalR (ReceiveAuthSessionon groupclient_{clientId}) upon successful OAuth callback, allowing seamless desktop and remote display login.- Response:
302 Foundredirect to Spotify'shttps://accounts.spotify.com/authorizewith generatedcode_challenge,client_id, and requested scopes.
GET /api/auth/spotify/callback (or GET /api/auth/callback)¶
Handles the redirect callback from Spotify following user consent.
- Query Parameters:
code(string): Spotify authorization code.state(string): Anti-forgery validation state.- Behavior:
- Validates PKCE challenge and exchanges code for access & refresh tokens.
- Encrypts tokens via ASP.NET Core Data Protection.
- Saves user session in SQLite database and updates active session registry.
- Broadcasts session list update to all connected SignalR clients (including desktop app).
- Response:
200 OKHTML landing page with handoff to desktop client or web player.
GET /api/auth/sessions¶
Returns all currently authorized Spotify user account sessions stored on the server.
- Response
200 OK:
GET /api/auth/me¶
Returns current authenticated session information for the calling browser or client.
- Response
200 OK:
DELETE /api/auth/sessions/{userId}¶
Revokes an authorized Spotify account session and removes its encrypted tokens from SQLite.
- Response
204 No Content
POST /api/auth/logout¶
Clears current user session cookies and revokes the active session.
- Response
200 OK:{ "message": "Logged out successfully" }
Lyrics & Playback Endpoints¶
GET /api/lyrics/{trackId}¶
Retrieves cached synchronized lyrics for a specific Spotify track ID.
- Response
200 OK:
POST /api/lyrics/offset¶
Saves a manual timing offset adjustment for a track.
- Request Body:
- Response
200 OK
Health & Monitoring Endpoints¶
GET /api/health¶
System liveness and readiness probe for Docker / Kubernetes orchestrators.
- Response
200 OK: