> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quader864.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# Update user role

> Change a user role (admin only)

<Note>
  This endpoint requires admin role.
</Note>

## Path parameters

<ParamField path="id" type="string" required>
  The user ID
</ParamField>

## Request body

<ParamField body="role" type="string" required>
  New role for the user. Must be one of: `user`, `moderator`, `admin`
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Operation success status
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  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"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "Role updated"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Invalid role"
  }
  ```
</ResponseExample>
