Skip to Content
HomeLink Hub
Admin

Change a user's role

PATCH
/api/v1/admin/users/{id}/role

Access: Bearer token required. Roles: ADMIN.

Overwrites the user's role with one of the UserRole values: TENANT, LANDLORD, AGENT, LAWYER, DEVELOPER, ADMIN. The change is immediate for new requests because authenticateUser reloads the user (and role) from the database on every call. No email or notification is sent, no KYC state is touched, and an admin can change their own role. A malformed id surfaces as a 500 (Mongoose cast error) rather than a 404.

Authorization

bearerAuth
headerAuthorizationBearer <JWT>

Access token returned by sign-in. Send it as Authorization: Bearer <token>.

Path Parameters

id*string

ObjectId of the user to update.

Request Body

application/json
  1. body
role*string

New role. One of TENANT, LANDLORD, AGENT, LAWYER, DEVELOPER, ADMIN (case-sensitive).

Response Body

Role updated. The message ends with the new role; data is the updated user (same shape as List users).

application/json
  1. response
status*integer
success*boolean
message*string
data*
Example Request
curl -X PATCH 'http://localhost:4000/api/v1/admin/users/string/role' \  -H 'Content-Type: application/json' \  -d '{  "role": "LAWYER"}'
Example Response
{  "status": 200,  "success": true,  "message": "User role updated to LAWYER",  "data": {    "_id": "665f1c2e9b1d4a0012ab34c1",    "firstName": "Chinedu",    "lastName": "Okafor",    "email": "chinedu.okafor@example.com",    "authProviders": [      "LOCAL"    ],    "phone": "+2348031234567",    "avatar": "https://res.cloudinary.com/example/image/upload/v1717500000/homelinkhub/media/chinedu.jpg",    "role": "LAWYER",    "isEmailVerified": true,    "isKYCVerified": true,    "isActive": true,    "isDeleted": false,    "kyc": {      "status": "VERIFIED",      "verifiedType": "NIN",      "verifiedAt": "2026-05-20T11:04:09.000Z",      "ninVerifiedAt": "2026-05-20T10:58:41.000Z",      "livenessVerifiedAt": "2026-05-20T11:04:09.000Z"    },    "linkedAccounts": [],    "businessName": "Okafor Realty",    "bio": "Lekki and Ikoyi lettings specialist.",    "twoFactorEnabled": false,    "theme": "SYSTEM",    "language": "ENGLISH",    "notificationPreferences": {      "newMessages": {        "inApp": true,        "email": true,        "sms": false      },      "propertyInquiries": {        "inApp": true,        "email": true,        "sms": true      },      "inspectionBookings": {        "inApp": true,        "email": true,        "sms": false      },      "paymentConfirmations": {        "inApp": true,        "email": true,        "sms": true      },      "systemUpdates": {        "inApp": false,        "email": true,        "sms": false      },      "newPropertyMatches": {        "inApp": true,        "email": true,        "sms": false      },      "escrowUpdates": {        "inApp": true,        "email": true,        "sms": false      },      "agentMessages": {        "inApp": true,        "email": true,        "sms": false      },      "priceDropAlerts": {        "inApp": true,        "email": true,        "sms": false      },      "promotionalEmails": {        "inApp": false,        "email": true,        "sms": false      },      "lawyerVerificationUpdates": {        "inApp": true,        "email": true,        "sms": false      }    },    "privacySettings": {      "publicProfileSearch": true,      "transactionHistoryVisibility": false    },    "bankDetails": {      "bankName": "Guaranty Trust Bank",      "bankCode": "058",      "accountHolderName": "CHINEDU OKAFOR"    },    "inspectionFee": 5000,    "address": {      "addresses": [        "14 Admiralty Way, Lekki Phase 1"      ],      "country": "Nigeria",      "state": "Lagos",      "postalCode": "105102"    },    "wishlist": [],    "createdAt": "2026-06-04T09:15:22.481Z",    "updatedAt": "2026-06-05T14:02:10.107Z"  }}