EstateHub

Administrator User Management API

Base URL: http://localhost:8000/api/v1
Prefix: /accounts/admins
Auth: Bearer access token with the admin role
Headers: Content-Type: application/json


1. List Users

Returns a paginated list of EstateHub users. Supports searching and filtering by account, role, and verification criteria.

GET/accounts/admins/users/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "Users retrieved successfully.",
  "data": {
    "users": {
      "count": 42,
      "next": "http://localhost:8000/api/v1/accounts/admins/users/?page=2",
      "previous": null,
      "results": [
        {
          "id": "f4f99de2-462b-4c42-8708-72c4bbb51fcc",
          "full_name": "Emily Wilson",
          "email": "ayesha.james@example.com",
          "avatar_url": "https://example.com/avatars/ayesha.jpg",
          "roles": [
            "buyer",
            "investor"
          ],
          "status": "active",
          "is_active": true,
          "is_staff": false,
          "is_email_verified": true,
          "is_phone_verified": false,
          "date_joined": "2026-08-21T09:30:00Z",
          "created_at": "2026-08-21T09:30:00Z",
          "updated_at": "2026-09-08T15:10:00Z"
        }
      ]
    }
  }
}

Notes

  • Supported search parameters:

    • search: searches full_name, email, and phone.

    • q: alias for search.

  • Search is case-insensitive and performs a partial match.

  • Supported account filters:

    • role: buyer, renter, seller_owner, investor, agent, or admin.

    • status: active, blocked, or deleted.

    • is_active: true or false.

    • is_staff: true or false.

    • is_email_verified: true or false.

    • is_phone_verified: true or false.

  • Supported verification filters:

    • verification_type: kyc, kyb, agent_verification, or bidder_verification.

    • verification_status: not_submitted, pending, approved, rejected, or expired.

  • Pagination parameters:

    • page: requested page number.

    • page_size: number of users per page, up to 50.

  • Example:

HTTP
GET /accounts/admins/users/?search=ayesha&role=buyer&status=active&page=1
  • Phone numbers, biographies, notification preferences, social-account information, passwords, tokens, verification documents, and verification-submission data are not returned in list results.

  • Returns 401 Unauthorized when authentication is missing or invalid.

  • Returns 403 Forbidden when the authenticated user does not have the admin role.

  • Returns 400 Bad Request for unsupported filter values.


2. Get User Details

Returns detailed account information and safe verification summaries for one user.

GET/accounts/admins/users/{user_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "User details retrieved successfully.",
  "data": {
    "user": {
      "id": "f4f99de2-462b-4c42-8708-72c4bbb51fcc",
      "full_name": "Emily Wilson",
      "email": "ayesha.james@example.com",
      "phone": "+15125550106",
      "avatar_url": "https://example.com/avatars/ayesha.jpg",
      "bio": "Property investor based in Austin.",
      "roles": [
        "buyer",
        "investor"
      ],
      "status": "active",
      "is_active": true,
      "is_staff": false,
      "is_superuser": false,
      "is_email_verified": true,
      "is_phone_verified": false,
      "email_verified_at": "2026-08-21T10:15:00Z",
      "phone_verified_at": null,
      "last_login": "2026-09-08T14:00:00Z",
      "date_joined": "2026-08-21T09:30:00Z",
      "created_at": "2026-08-21T09:30:00Z",
      "updated_at": "2026-09-08T15:10:00Z",
      "verifications": [
        {
          "id": "026a4ccb-bcc7-4953-803e-1b5bfabeb6c4",
          "type": "kyc",
          "status": "approved",
          "rejection_reason": "",
          "reviewed_at": "2026-08-22T11:45:00Z",
          "created_at": "2026-08-21T11:00:00Z",
          "updated_at": "2026-08-22T11:45:00Z"
        }
      ]
    }
  }
}

Notes

  • Contact and profile details are available only through this admin-protected endpoint.

  • Verification entries are summaries only.

  • Verification submitted_data, documents, passwords, authentication tokens, notification preferences, and social-provider payloads are never returned.

  • Use the existing KYC or KYB detail endpoint when an admin needs to review a verification submission.

  • Returns 401 Unauthorized when authentication is missing or invalid.

  • Returns 403 Forbidden when the authenticated user does not have the admin role.

  • Returns 404 Not Found when the user does not exist.


3. Update User

Updates the supported account-management fields for one user.

PATCH/accounts/admins/users/{user_id}/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}
Content-Type: application/json

Request Body

JSON
{
  "status": "blocked",
  "roles": [
    "buyer",
    "investor"
  ],
  "is_active": false
}

Success Example

JSON
{
  "success": true,
  "message": "User updated successfully.",
  "data": {
    "user": {
      "id": "f4f99de2-462b-4c42-8708-72c4bbb51fcc",
      "full_name": "Emily Wilson",
      "email": "ayesha.james@example.com",
      "phone": "+15125550106",
      "avatar_url": "https://example.com/avatars/ayesha.jpg",
      "bio": "Property investor based in Austin.",
      "roles": [
        "buyer",
        "investor"
      ],
      "status": "blocked",
      "is_active": false,
      "is_staff": false,
      "is_superuser": false,
      "is_email_verified": true,
      "is_phone_verified": false,
      "email_verified_at": "2026-08-21T10:15:00Z",
      "phone_verified_at": null,
      "last_login": "2026-09-08T14:00:00Z",
      "date_joined": "2026-08-21T09:30:00Z",
      "created_at": "2026-08-21T09:30:00Z",
      "updated_at": "2026-09-09T08:20:00Z",
      "verifications": [
        {
          "id": "026a4ccb-bcc7-4953-803e-1b5bfabeb6c4",
          "type": "kyc",
          "status": "approved",
          "rejection_reason": "",
          "reviewed_at": "2026-08-22T11:45:00Z",
          "created_at": "2026-08-21T11:00:00Z",
          "updated_at": "2026-08-22T11:45:00Z"
        }
      ]
    }
  }
}

Notes

  • Every supported request-body field is optional, but at least one supported field must be supplied.

  • Supported fields:

    • status: active, blocked, or deleted.

    • roles: A non-empty array of unique roles. Valid values are buyer, renter, seller_owner, investor, agent, and admin.

    • is_active: true or false.

  • Unsupported and read-only fields are not modified.

  • deleted is a soft-delete status; it does not remove the user record from the database.

  • When setting status to blocked or deleted, also set "is_active": false to prevent authentication.

  • An admin cannot block, soft-delete, or deactivate their own account.

  • An admin cannot remove the admin role from their own account.

  • Password changes and verification approvals use dedicated APIs.

  • Returns 400 Bad Request for invalid roles, duplicate or empty roles, invalid statuses, empty updates, or unsafe self-updates.

  • Returns 401 Unauthorized when authentication is missing or invalid.

  • Returns 403 Forbidden when the authenticated user does not have the admin role.

  • Returns 404 Not Found when the specified user does not exist.



4. Get User KPIs

Returns account and verification totals for administrator dashboards.

GET/accounts/admins/users/kpis/

Auth: Required

Headers

HTTP
Authorization: Bearer {{access_token}}

Success Example

JSON
{
  "success": true,
  "message": "User management KPIs retrieved successfully.",
  "data": {
    "kpis": {
      "total_users": 120,
      "active_accounts": 108,
      "blocked_users": 3,
      "new_users_this_month": 14,
      "pending_kyc": 6,
      "pending_kyb": 2,
      "users_by_role": {
        "buyer": 70,
        "renter": 38,
        "seller": 24,
        "admin": 3
      }
    }
  }
}

Notes

  • Deleted accounts are excluded from the aggregate totals.

Common Success Format

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

Common Error Format

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