curl -X PATCH https://api-verifier-2.onrender.com/api/users/65a1b2c3d4e5f6g7h8i9j0k1/role \
-H "Authorization: Bearer <admin-token>" \
-H "Content-Type: application/json" \
-d '{
"role": "moderator"
}'
{
"success": true,
"message": "Role updated"
}
{
"error": "Invalid role"
}
Users
Update user role
Change a user role (admin only)
PATCH
/
api
/
users
/
{id}
/
role
curl -X PATCH https://api-verifier-2.onrender.com/api/users/65a1b2c3d4e5f6g7h8i9j0k1/role \
-H "Authorization: Bearer <admin-token>" \
-H "Content-Type: application/json" \
-d '{
"role": "moderator"
}'
{
"success": true,
"message": "Role updated"
}
{
"error": "Invalid role"
}
This endpoint requires admin role.
Path parameters
string
required
The user ID
Request body
string
required
New role for the user. Must be one of:
user, moderator, adminResponse
boolean
Operation success status
string
Confirmation message
curl -X PATCH https://api-verifier-2.onrender.com/api/users/65a1b2c3d4e5f6g7h8i9j0k1/role \
-H "Authorization: Bearer <admin-token>" \
-H "Content-Type: application/json" \
-d '{
"role": "moderator"
}'
{
"success": true,
"message": "Role updated"
}
{
"error": "Invalid role"
}