Skip to main content
PUT
/
user
/
update-phone
Update a user's phone number
curl --request PUT \
  --url http://localhost:2000/user/update-phone \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "payload": {
    "userId": "64b7f1a2e4b0a5d3f9c12345",
    "phone": "+1-555-555-5555"
  }
}
'
{
  "message": "<string>",
  "data": {}
}
Admin-only endpoint to update the phone number stored in a user’s personal information.

Request

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Request Body

{
  "payload": {
    "userId": "64b7f1a2e4b0a5d3f9c12345",
    "phone": "+1-555-555-5555"
  }
}

Request Body Schema

FieldTypeRequiredDescription
payloadobjectYesUpdate payload
payload.userIdstringYesUser ID to update
payload.phonestringYesNew phone number

Response

200 OK - Successfully updated phone number

{
  "message": "Phone number updated successfully",
  "data": {}
}

400 Bad Request

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request body"
  }
}

401 Unauthorized

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid token or insufficient permissions"
  }
}

404 Not Found

{
  "error": {
    "code": "USER_NOT_FOUND",
    "message": "User not found"
  }
}

500 Internal Server Error

{
  "error": {
    "code": "SERVER_ERROR",
    "message": "Internal server error"
  }
}

Example

curl -X PUT 'http://localhost:2000/user/update-phone' \
  -H 'Authorization: Bearer your-jwt-token' \
  -H 'Content-Type: application/json' \
  -d '{
    "payload": {
      "userId": "64b7f1a2e4b0a5d3f9c12345",
      "phone": "+1-555-555-5555"
    }
  }'

Notes

  • This is an admin-only endpoint - requires administrative privileges
  • Phone numbers should be in E.164 format (e.g., +1-555-555-5555)
  • The user ID must be a valid MongoDB ObjectId
  • Phone numbers should be validated for proper format
  • Only administrators can update other users’ phone numbers

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
payload
object

Response

Successfully updated phone number

message
string
data
object