Audit Logs API

Comprehensive audit trail for all data changes.

Model

{
  "id": "uuid",
  "module": "Student",
  "entity_id": "student-uuid",
  "action": "update",
  "user_id": "user-uuid",
  "user_email": "admin@school.edu",
  "ip_address": "192.168.1.1",
  "user_agent": "Mozilla/5.0...",
  "before_data": {...},
  "after_data": {...},
  "changes": ["status", "current_class_id"],
  "created_at": "2024-01-15T10:30:00Z"
}

Actions

Action

Description

create

New record created

update

Record modified

delete

Record deleted

Endpoints

!!! warning “Admin Only” Audit log access requires admin role.

List Logs

POST /api/audit_logs/list

Get by Entity

GET /api/audit_logs/entity/:module/:entityId

Get all changes for a specific record.

Get by User

GET /api/audit_logs/user/:userId

Get all changes by a specific user.

Get by Date Range

GET /api/audit_logs/date-range?start=2024-01-01&end=2024-01-31

Get Statistics

GET /api/audit_logs/statistics

Export

POST /api/audit_logs/export

Export audit logs to Excel.