EstateHub

Administrator Profile and Sessions API

Base URL: http://localhost:8000/api/v1
Prefix: /accounts/admins
Auth: Administrator JWT bearer token
Headers: Content-Type: application/json

The current admin API does not implement DELETE /me/. Account deactivation is not available in the Admin Profile routes.


1. Get Profile

Retrieves the authenticated administrator profile.

GET/accounts/admins/me/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "",
  "data": {
    "admin": {
      "id": "d1c7f5a2-6e44-4e1d-9c1a-8f2b31b7a901",
      "full_name": "Platform Administrator",
      "email": "admin@example.com",
      "phone": "+15125550103",
      "avatar_url": "",
      "avatar_upload_id": null,
      "bio": "",
      "roles": [
        "admin"
      ],
      "status": "active",
      "is_active": true,
      "is_staff": true,
      "is_superuser": true
    }
  }
}

Notes

  • Requires an authenticated active administrator account.

  • The response excludes the password.


2. Update Profile

Updates the authenticated administrator profile.

PATCH/accounts/admins/me/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Request Body

JSON
{
  "full_name": "Updated Platform Administrator",
  "phone": "+15125550103",
  "avatar_upload_id": "59ed7663-357f-402f-b414-27d7f3b12e87",
  "bio": "EstateHub platform administrator."
}

Success Example

JSON
{
  "success": true,
  "message": "Admin profile updated successfully.",
  "data": {
    "admin": {
      "id": "d1c7f5a2-6e44-4e1d-9c1a-8f2b31b7a901",
      "full_name": "Updated Platform Administrator",
      "email": "admin@example.com",
      "phone": "+15125550103",
      "avatar_url": "http://localhost:8000/api/v1/uploads/59ed7663-357f-402f-b414-27d7f3b12e87/content/",
      "avatar_upload_id": "59ed7663-357f-402f-b414-27d7f3b12e87",
      "bio": "EstateHub platform administrator.",
      "roles": [
        "admin"
      ],
      "status": "active",
      "is_active": true,
      "is_staff": true,
      "is_superuser": true
    }
  }
}

Notes

  • All body fields are optional.

  • Allowed fields are full_name, phone, avatar_upload_id, and bio.

  • Send a completed managed upload ID, not a storage URL.

  • Phone numbers must be unique.

  • Set avatar_upload_id to null to remove the current avatar.


3. Get Security Information

Retrieves administrator security and authentication details.

GET/accounts/admins/me/security/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "",
  "data": {
    "security": {
      "email": "admin@example.com",
      "phone": "+15125550103",
      "is_email_verified": true,
      "is_phone_verified": false,
      "has_password": true,
      "active_session_count": 2,
      "last_login": "2026-10-06T09:30:00Z",
      "date_joined": "2026-08-01T10:00:00Z",
      "social_accounts": []
    }
  }
}

Notes

  • social_accounts may be an empty array.

  • active_session_count includes all non-revoked sessions.


4. List Sessions

Lists all active administrator sessions.

GET/accounts/admins/me/sessions/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "",
  "data": {
    "sessions": [
      {
        "id": 12,
        "jti": "6f1f0c55-ccf5-4e54-9d2c-45e1b7c0d0c1",
        "ip_address": "192.168.1.20",
        "user_agent": "Mozilla/5.0",
        "created_at": "2026-10-06T09:00:00Z",
        "last_active_at": "2026-10-06T09:30:00Z",
        "expires_at": "2026-10-13T09:00:00Z",
        "is_current": true
      }
    ]
  }
}

Notes

  • Only active, non-revoked sessions are returned.

  • is_current identifies the session used for the current request.


5. Revoke Session

Revokes one active administrator session.

DELETE/accounts/admins/me/sessions/{session_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Session revoked successfully.",
  "data": {}
}

Notes

  • is the numeric session ID returned by the list sessions endpoint.

  • Only sessions owned by the authenticated administrator can be revoked.

  • Unknown or already revoked sessions return Session not found.


Common Success Format

JSON
{
  "success": true,
  "message": "Operation completed successfully.",
  "data": {}
}

Common Error Format

JSON
{
  "success": false,
  "message": "Validation failed.",
  "errors": {
    "field_name": [
      "Error message."
    ]
  }
}