Skip to content

Sessions

Sessions represent active authenticated connections between a user and Kotauth. Each session is backed by a refresh token — revoking a session immediately invalidates the refresh token and prevents new access tokens from being issued.

Required scopes: sessions:read for GET, sessions:write for DELETE.


{
"id": 88,
"userId": 42,
"clientId": 5,
"scopes": "openid profile email",
"ipAddress": "192.168.1.10",
"createdAt": "2025-01-01T12:00:00Z",
"expiresAt": "2025-01-02T12:00:00Z"
}
FieldTypeDescription
idintegerInternal session ID
userIdintegerThe user this session belongs to
clientIdinteger | nullThe OAuth application that created this session, if applicable
scopesstringSpace-separated scopes granted to this session
ipAddressstring | nullIP address at the time of login
createdAtdatetimeWhen the session was created
expiresAtdatetimeWhen the refresh token expires

GET /t/{slug}/api/v1/sessions

Returns all currently active (non-expired, non-revoked) sessions for the workspace.

Example request:

Terminal window
curl https://auth.yourdomain.com/t/my-app/api/v1/sessions \
-H "Authorization: Bearer kauth_my-app_KEY"

Response 200 OK:

{
"data": [
{
"id": 88,
"userId": 42,
"clientId": 5,
"scopes": "openid profile email",
"ipAddress": "203.0.113.5",
"createdAt": "2025-01-01T12:00:00Z",
"expiresAt": "2025-01-02T12:00:00Z"
}
],
"meta": { "total": 1, "offset": 0, "limit": 20 }
}

DELETE /t/{slug}/api/v1/sessions/{sessionId}

Immediately revokes the session by invalidating its refresh token. The user will need to re-authenticate to get new tokens.

Path parameters:

ParameterTypeDescription
sessionIdintegerThe session’s numeric ID

Example request:

Terminal window
curl -X DELETE https://auth.yourdomain.com/t/my-app/api/v1/sessions/88 \
-H "Authorization: Bearer kauth_my-app_KEY"

Response 204 No Content

Error responses:

StatusCondition
404 Not FoundSession does not exist or has already expired