Welcome to our new docs! Please keep in mind we are still working on making everything is as accurate as possible. Join us on discord and ask us questions if you are unsure.
DezerX Spartan Logo
User

Update User Role

Update a user's role specifically. This endpoint uses the same method as the general update endpoint but is specifically for role updates

PATCH
/users/{id}/role
AuthorizationBearer <token>

Bearer token authentication

In: header

Path Parameters

idinteger

User ID

rolestring

Response Body

curl -X PATCH "https://serverpro.dezerx.com/api/application/users/2/role" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
{
  "success": true,
  "message": "User updated successfully",
  "data": {
    "id": 2,
    "role": "user",
    "name": "Jane Smith Updated",
    "email": "jane.updated@example.com",
    "avatar": "assets/default-avatar.png",
    "banner": null,
    "discord_id": null,
    "email_verified_at": null,
    "created_at": "2025-08-03T06:56:59.000000Z",
    "updated_at": "2025-08-03T07:39:18.000000Z"
  }
}
{
  "error": "Unauthorized",
  "message": "Bearer token required"
}
{
  "error": "Forbidden",
  "message": "Insufficient permissions for this action"
}
{
  "success": false,
  "message": "User not found"
}

{
  "success": false,
  "message": "Validation failed",
  "errors": {
    "name": [
      "The name field is required."
    ],
    "email": [
      "The email has already been taken."
    ],
    "role": [
      "The selected role is invalid."
    ],
    "password": [
      "The password must be at least 8 characters."
    ]
  }
}