Skip to Content
HomeLink Hub
Admin

Activate or deactivate a user

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

Access: Bearer token required. Roles: ADMIN.

Sets the user's isActive flag to the value sent (it is a set, not a toggle). Deactivated users are refused at sign-in by the auth controller with 403 Your account has been deactivated. Please contact support., but authenticateUser does not check isActive, so access tokens the user already holds keep working until they expire. No email or notification is sent and nothing stops an admin deactivating their own account. A malformed id is not caught: it 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
isActive*boolean

true to activate, false to deactivate. Must be a real JSON boolean; strings are rejected.

Response Body

Flag updated. The message ends in active or inactive to match the value sent; 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/status' \  -H 'Content-Type: application/json' \  -d '{  "isActive": false}'
Example Response
{  "status": 200,  "success": true,  "message": "User status updated to inactive",  "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": "AGENT",    "isEmailVerified": true,    "isKYCVerified": true,    "isActive": false,    "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"  }}