API PHP Login doesnt work — CyberPanel - WebHosting Control Panel for OpenLiteSpeed

API PHP Login doesnt work

I was testing https://cyberpanel.docs.apiary.io/#reference/server/login-as-user/login-as-user.

Set up my hostnames URL and username and password however I get below error message

string(62) "{"userID": 0, "loginStatus": 0, "error_message": "'username'"}"

my PHP code

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://xxxxxxx:8090/api/loginAPI");
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"username\": \"myusername\",
\"password\": \"mypassword\"

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json"

$response = curl_exec($ch);



Any idea how to fix this ? is it from my side or is it a bug?

Thank you,


  • Hi I also faced the same issue, the fix for this is the header type which is Content-Type: application/x-www-form-urlencoded"

    I have creates a html file for this

    <form id="lform" class="cyberpanel" action="" method="post">
    <input type="hidden" name="username" value="your-user-name" />
    <input type="hidden" name="password" value="the-password-for-user" />

    With this the user is allowed to login and dashboard is loaded.
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion