Skip to content

Audit Logs

Kotauth maintains an immutable audit trail of security-relevant events. Events are append-only — they cannot be modified or deleted. Use the audit log API to build compliance reporting, detect anomalies, and investigate incidents.

Required scope: audit_logs:read


{
"eventType": "LOGIN_SUCCESS",
"userId": 42,
"clientId": 5,
"ipAddress": "203.0.113.5",
"createdAt": "2025-01-01T12:00:00Z",
"details": {
"method": "password"
}
}
FieldTypeDescription
eventTypestringThe event category (see table below)
userIdinteger | nullUser involved, if applicable
clientIdinteger | nullApplication involved, if applicable
ipAddressstring | nullIP address of the request
createdAtdatetimeWhen the event occurred
detailsobjectEvent-specific key-value metadata

GET /t/{slug}/api/v1/audit-logs

Query parameters:

ParameterTypeDefaultDescription
limitinteger50Number of events to return (max: 200)
offsetinteger0Pagination offset
eventTypestringFilter by event type (e.g. LOGIN_SUCCESS)
userIdintegerFilter by user ID

Example request:

Terminal window
# Get the last 10 failed logins
curl "https://auth.yourdomain.com/t/my-app/api/v1/audit-logs?eventType=LOGIN_FAILURE&limit=10" \
-H "Authorization: Bearer kauth_my-app_KEY"

Response 200 OK:

{
"data": [
{
"eventType": "LOGIN_FAILURE",
"userId": null,
"clientId": null,
"ipAddress": "198.51.100.42",
"createdAt": "2025-01-01T11:59:00Z",
"details": {
"username": "alice",
"reason": "invalid_credentials"
}
}
],
"meta": { "total": 1, "offset": 0, "limit": 10 }
}

Event typeDescription
LOGIN_SUCCESSSuccessful username/password login
LOGIN_FAILUREFailed login attempt (wrong password, unknown user)
LOGIN_MFA_REQUIREDMFA challenge initiated
LOGIN_MFA_SUCCESSMFA challenge completed successfully
LOGIN_MFA_FAILUREMFA challenge failed (wrong code)
LOGOUTUser-initiated logout
SESSION_REVOKEDSession revoked by admin or via API
TOKEN_REFRESHEDRefresh token exchanged for new tokens
TOKEN_REVOKEDToken explicitly revoked via revocation endpoint
Event typeDescription
SOCIAL_LOGIN_SUCCESSSuccessful social provider authentication
SOCIAL_LOGIN_FAILUREFailed social provider authentication
SOCIAL_ACCOUNT_LINKEDSocial identity linked to existing account
SOCIAL_ACCOUNT_CREATEDNew account created via social login
Event typeDescription
USER_REGISTEREDUser self-registered
USER_EMAIL_VERIFICATION_SENTVerification email dispatched
USER_EMAIL_VERIFIEDUser verified their email
USER_PASSWORD_RESET_REQUESTEDPassword reset email requested
USER_PASSWORD_RESET_COMPLETEDPassword reset successfully applied
USER_PASSWORD_CHANGEDPassword changed via self-service portal
USER_MFA_ENROLLEDUser completed TOTP enrollment
USER_MFA_DISABLEDUser disabled their MFA
USER_RECOVERY_CODE_USEDRecovery code consumed during login
Event typeDescription
ADMIN_USER_CREATEDAdmin created a user via API or console
ADMIN_USER_UPDATEDAdmin updated a user’s profile
ADMIN_USER_DISABLEDAdmin disabled a user
ADMIN_USER_MFA_RESETAdmin reset a user’s MFA enrollment
ADMIN_ROLE_CREATEDRole created
ADMIN_ROLE_UPDATEDRole updated
ADMIN_ROLE_DELETEDRole deleted
ADMIN_ROLE_ASSIGNEDRole assigned to user
ADMIN_ROLE_UNASSIGNEDRole removed from user
ADMIN_GROUP_CREATEDGroup created
ADMIN_GROUP_UPDATEDGroup updated
ADMIN_GROUP_DELETEDGroup deleted
ADMIN_GROUP_MEMBER_ADDEDUser added to group
ADMIN_GROUP_MEMBER_REMOVEDUser removed from group
ADMIN_APPLICATION_UPDATEDApplication settings updated
ADMIN_APPLICATION_DISABLEDApplication disabled
ADMIN_SESSION_REVOKEDSession revoked by admin
ADMIN_API_KEY_CREATEDAPI key created
ADMIN_API_KEY_DELETEDAPI key deleted
ADMIN_SETTINGS_UPDATEDWorkspace settings changed