Skip to main content

Sessions API

Session management endpoints for TMA Cloud.

Get Sessions

GET /api/sessions

Get all active sessions for authenticated user.

Response:

{
"sessions": [
{
"id": "session_123",
"user_id": "user_123",
"token_version": 1,
"user_agent": "Mozilla/5.0...",
"ip_address": "192.168.1.1",
"created_at": "2024-01-01T00:00:00Z",
"last_activity": "2024-01-01T12:00:00Z",
"isCurrent": true
}
]
}

Revoke Session

DELETE /api/sessions/:sessionId

Revoke a specific session.

When a session is revoked, its matching desktop heartbeat entry is removed from client_heartbeats.

Response:

{
"message": "Session revoked successfully"
}

Revoke Other Sessions

POST /api/sessions/revoke-others

Revoke all other active sessions except the current one.

This also removes other desktop heartbeat entries for the same user.

Response:

{
"message": "Other sessions revoked successfully",
"deletedCount": 3
}