User Management
Update User

Update User API

Welcome to the documentation for the Update User API. This API helps you update a user's detail or information.

Base URL

{baseURL}/v1/users/:userId/update | PATCH

Authorization

Include the following Authorization header in your HTTP requests using a Bearer token:

Authorization: Bearer YOUR_ACCESS_TOKEN

Request Payload

FieldTypeSourceRequiredDescription
role_idstringbody✅ YesUser's role ID

Sample Request

curl -X PATCH {baseURL}/v1/users/64da9ddfb1a9d3be2a2a0691/update \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "status": "flagged"
  }'

Sample 200 Response

{
  "message": "User status updated successfully",
  "data": {
    "_id": "64f4962784a5676087e235cc",
    "first_name": "Oluwatunmise",
    "last_name": "Adenuga",
    "email": "[email protected]",
    "phone_number": "07031832236",
    "role_id": "64e8b1de85671e19e26d717d",
    "is_verified": true,
    "account_id": "64da4abd605200f551d8e9b6",
    "organization_id": "64da45f2605200f551d8e9ac",
    "gender": "male",
    "is_2FA_enabled": true,
    "is_default_password": false,
    "status": "flagged",
    "security_questions": [
      {
        "question": "63f697bf78528f949a0c175b",
        "answer": "$2a$10$SsjtJOXxStKfX7.QemmKku2dFoL1K8hmrUGVsdgl.KQ00L3m5LKki",
        "_id": "64f4972e84a5676087e235ee"
      },
      {
        "question": "63f697bf78528f949a0c175b",
        "answer": "$2a$10$YlZi1YQxErLFNUGcFpESgug2Awhm05Qjcm2DbSBtCilCmVvakKmTK",
        "_id": "64f4972e84a5676087e235ef"
      },
      {
        "question": "6408750686aba885d609e701",
        "answer": "$2a$10$7gJ990Z24PsxGnVmOPmBFOw6Jku8LFkWiCIMNy7cArAAR4sToBtuu",
        "_id": "64f4972e84a5676087e235f0"
      }
    ],
    "createdAt": "2023-09-03T14:20:23.973Z",
    "updatedAt": "2023-09-03T16:14:50.086Z",
    "__v": 20,
    "user_id": "64f4962784a5676087e235cc"
  },
  "success": true
}