Profile API

User profile management including password, email, display name, avatar, 2FA, sessions, and activity.

All endpoints are prefixed with /api/profile. Auth required.


Profile Info

MethodPathDescription
GET/profileGet profile
PUT/profile/passwordChange password
PUT/profile/emailChange email
PUT/profile/display-nameChange display name

Avatar

MethodPathDescription
POST/profile/avatarUpload avatar (base64, max 512KB)
DELETE/profile/avatarRemove avatar

Two-Factor Authentication

MethodPathDescription
POST/profile/2fa/setupInitiate 2FA setup (returns QR)
POST/profile/2fa/verifyVerify 2FA code
POST/profile/2fa/disableDisable 2FA

Sessions

MethodPathDescription
GET/profile/sessionsList active sessions
DELETE/profile/sessions/:idRevoke session

Activity

MethodPathDescription
GET/profile/activityRecent activity log

Request/Response

POST /profile/2fa/setup

// Response
{
  "secret": "JBSWY3DPEHPK3PXP",
  "qrCode": "data:image/png;base64,..."
}

POST /profile/2fa/verify

{ "token": "123456" }
// Response
{ "success": true, "message": "2FA enabled" }

PUT /profile/password

{
  "currentPassword": "oldpass",
  "newPassword": "newpass"
}

GET /profile/sessions

{
  "sessions": [
    {
      "id": "sess_1690000000000_abc",
      "ip": "192.168.1.100",
      "userAgent": "Mozilla/5.0...",
      "loginAt": "2026-07-28T12:00:00Z",
      "lastActivity": "2026-07-28T12:30:00Z",
      "current": true
    }
  ]
}

GET /profile/activity

{
  "activity": [
    { "action": "auth.login", "timestamp": "2026-07-28T12:00:00Z", "ip": "192.168.1.100" },
    { "action": "file.upload", "timestamp": "2026-07-28T11:45:00Z", "ip": "192.168.1.100" }
  ]
}

Event Delegation

Frontend uses data-profile-action attributes and binds to #viewProfile (not #profileContent) because modals are siblings outside the content container.


Part of NexusPanel API Reference

← Back to Documentation