Skip to content

Instantly share code, notes, and snippets.

@aldoyh
Last active May 12, 2026 09:32
Show Gist options
  • Select an option

  • Save aldoyh/aeeca685ad021f4bf89a05c7403b4b1b to your computer and use it in GitHub Desktop.

Select an option

Save aldoyh/aeeca685ad021f4bf89a05c7403b4b1b to your computer and use it in GitHub Desktop.
CyberPanel Skill created by QWEN

CyberPanel Server API Skill Reference

Generated from: https://cyberpanel.docs.apiary.io/#reference/server API Version: CyberPanel API Format: REST/JSON Base Auth: ``adminUser`` + ``adminPass`` required for all endpoints


📋 Overview

This skill reference documents all Server-related API endpoints available in CyberPanel for programmatic server, website, user, and firewall management.


🔐 Authentication

All requests require:

{
  "adminUser": "your_admin_username",
  "adminPass": "your_admin_password"
}

📦 Content-Type

  • Most endpoints accept JSON payloads
  • Login as User uses form-data

🔗 PHP Wrapper Reference

// Official wrapper: https://github.com/jetchirag/cyberpanel-whmcs/blob/master/api.php

🖥️ Server Endpoints

✅ Verify Connection

Test API access and credentials.

Method Endpoint Content-Type
POST /server/verify application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password"
}

Example Response

{
  "status": "success",
  "message": "API access verified"
}

🔑 Login as User

Generate session/login as another user (impersonation).

Method Endpoint Content-Type
POST /server/loginasuser multipart/form-data

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
userName string Target username to impersonate

⚠️ Uses form-data, not JSON.


🌐 Website Functions

➕ Create Website

Provision a new website with user, package, and ACL assignment.

Method Endpoint Content-Type
POST /websites/create application/json

Parameters

Parameter Type Required Default Description
adminUser string - Admin username
adminPass string - Admin password
domainName string - FQDN of new website (e.g., example.com)
ownerEmail string - Email for new user account
packageName string - Existing CyberPanel package name
websiteOwner string - Username for website owner (auto-created if missing)
ownerPassword string - Password for new user
websitesLimit int 1 Max websites allowed for this user
acl string "user" Access control level: admin, reseller, user, or custom

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "domainName": "example.com",
  "ownerEmail": "user@example.com",
  "packageName": "default",
  "websiteOwner": "example_user",
  "ownerPassword": "Str0ngP@ss!",
  "websitesLimit": 5,
  "acl": "user"
}

🗑️ Delete Website

Remove a website and its configuration.

Method Endpoint Content-Type
POST /websites/delete application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
domainName string Website domain to delete

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "domainName": "example.com"
}

⚠️ Destructive action — irreversible without backup.


📦 Change Website Package

Upgrade/downgrade a website's resource package.

Method Endpoint Content-Type
POST /websites/changepackage application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
websiteName string Domain name of target website
packageName string Must exist in CyberPanel packages

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "websiteName": "example.com",
  "packageName": "premium"
}

⏸️ Suspend/Un-suspend Website

Toggle website availability.

Method Endpoint Content-Type
POST /websites/togglesuspend application/json

Parameters

Parameter Type Required Values Description
adminUser string - Admin username
adminPass string - Admin password
websiteName string - Domain name
state string "Suspend" | "Activate" Desired state

Example Request (Suspend)

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "websiteName": "example.com",
  "state": "Suspend"
}

👥 User Functions

➕ Create New User

Provision a new CyberPanel user account.

Method Endpoint Content-Type
POST /users/create application/json

Parameters

Parameter Type Required Default Description
adminUser string - Admin username
adminPass string - Admin password
firstName string - User's first name
lastName string - User's last name
email string - User email address
userName string - Login username
password string - Account password
websitesLimit int - Max websites user can create
acl string - admin, reseller, user, or custom ACL
securityLevel string - "HIGH" or "LOW"

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@example.com",
  "userName": "johndoe",
  "password": "Str0ngP@ss!",
  "websitesLimit": 3,
  "acl": "user",
  "securityLevel": "HIGH"
}

📝 Note: Documentation typo — websitesLimit description incorrectly says "Last Name of new user".


ℹ️ Get User Information

Retrieve details for a specific user.

Method Endpoint Content-Type
POST /users/info application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
userName string Target username to query

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "userName": "johndoe"
}

Example Response

{
  "status": "success",
  "data": {
    "userName": "johndoe",
    "email": "john@example.com",
    "websitesLimit": 3,
    "acl": "user",
    "securityLevel": "HIGH"
  }
}

🔐 Change User Password

Update password for an existing user.

Method Endpoint Content-Type
POST /users/changepassword application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
websiteOwner string Username whose password to change
ownerPassword string New password value

Example Request

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "websiteOwner": "johndoe",
  "ownerPassword": "NewStr0ngP@ss!"
}

🔥 Firewall Functions

➕ Add Firewall Rule

Create a new iptables/firewall rule.

Method Endpoint Content-Type
POST /firewall/addrule application/json

Parameters

Parameter Type Required Description
adminUser string Admin username
adminPass string Admin password
ruleName string Human-readable rule identifier
ruleProtocol string "TCP" or "UDP"
rulePort string Port number or range (e.g., "80", "8000-8010")
ruleIP string CIDR IP range; use "0.0.0.0/0" for all IPs

Example Request (Allow HTTP from anywhere)

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "ruleName": "Allow HTTP",
  "ruleProtocol": "TCP",
  "rulePort": "80",
  "ruleIP": "0.0.0.0/0"
}

Example Request (Allow SSH from specific IP)

{
  "adminUser": "admin",
  "adminPass": "secure_password",
  "ruleName": "Allow SSH from Office",
  "ruleProtocol": "TCP",
  "rulePort": "22",
  "ruleIP": "203.0.113.45/32"
}

⚠️ Security Note: Always restrict ruleIP to minimal required range. Avoid 0.0.0.0/0 for sensitive ports.


🧰 Implementation Notes for PHP/Laravel

// Example: CyberPanel API Helper (Laravel-friendly)
class CyberPanelAPI {
  protected $baseUrl = 'https://your-cyberpanel:8090';
  protected $adminUser;
  protected $adminPass;

  public function __construct($adminUser, $adminPass) {
    $this->adminUser = $adminUser;
    $this->adminPass = $adminPass;
  }

  protected function request($endpoint, array $payload, $asFormData = false) {
    $client = new \GuzzleHttp\Client(['verify' => false]); // Self-signed cert common
    $options = [
      'json' => array_merge(['adminUser' => $this->adminUser, 'adminPass' => $this->adminPass], $payload),
      'timeout' => 30,
    ];

    if ($asFormData) {
      unset($options['json']);
      $options['form_params'] = array_merge(['adminUser' => $this->adminUser, 'adminPass' => $this->adminPass], $payload);
    }

    return $client->post("{$this->baseUrl}{$endpoint}", $options);
  }

  public function verifyConnection() {
    return $this->request('/server/verify', []);
  }

  public function createWebsite(array $data) {
    return $this->request('/websites/create', $data);
  }

  // ... additional methods per endpoint
}

🚀 Laravel Service Provider Snippet

// config/cyberpanel.php
return [
  'base_url' => env('CYBERPANEL_URL', 'https://localhost:8090'),
  'admin_user' => env('CYBERPANEL_ADMIN_USER'),
  'admin_pass' => env('CYBERPANEL_ADMIN_PASS'),
  'timeout' => 30,
  'verify_ssl' => false, // Adjust for production
];

⚠️ Best Practices & Warnings

  1. Never hardcode credentials — use environment variables or Laravel config.
  2. Use HTTPS — CyberPanel API typically runs on :8090 with self-signed certs; validate in production.
  3. Rate limiting — No documented limits, but avoid rapid-fire requests.
  4. Error handling — Always check response status and parse status field in JSON.
  5. Idempotency — Most endpoints are not idempotent; implement client-side checks for create operations.
  6. Backup before deleteDelete Website is irreversible via API.
  7. Firewall rules — Test with non-critical ports first; misconfiguration can lock you out.

🔄 Response Format Convention

All endpoints return JSON with consistent structure:

{
  "status": "success|error",
  "message": "Human-readable description",
  "data": { ... } // Optional, endpoint-specific
}

Skill Ready: This markdown file can be imported into documentation systems, used for API client generation, or integrated into Laravel service layers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment