All Category

Account information

This API endpoint retrieves account and usage information for a user based on POSTed username.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/

Request Headers

  • username: Admin username (optional if using POST username)
  • password: Admin password

Request Body (POST)

[
    "username": "exampleuser"
]

Response

Returns JSON object containing user package, usage, and limits:

{
    "package_name": "Basic Plan",
    "disk_limit": "10GB",
    "disk_used": "2GB",
    "email_disk_used": "100MB",
    "db_disk_used": "500MB",
    "email_limit": 5,
    "email_used": 2,
    "db_limit": 3,
    "db_used": 1,
    "ftp_limit": 2,
    "ftp_used": 1,
    "domain_limit": 2,
    "domain_used": 1,
    "server_ip": "192.168.1.100",
    "main_domain": "example.com",
    "user_id": 123,
    "email": "user@example.com",
    "full_name": "John Doe"
}

Error Responses

  • { "error": "POST method required" } – if not POST
  • { "error": "Username is required" } – if username missing
  • { "error": "User not found" } – if username invalid
  • { "error": "Package not found" } – if user has no package
  • { "error": "Invalid credentials" } – if authentication fails

Add User

This API endpoint allows an admin to create a new user with a package, FTP account, and domain setup.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/add_user/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "username": "newuser",
    "first_name": "John",
    "last_name": "Doe",
    "email": "user@example.com",
    "password": "UserPassword123",
    "pkg_id": 1,
    "domain": "example.com",
    "php_version": "8.2"
]

Response

Returns a JSON object indicating success or failure:

{
    "success": true,
    "message": "Username newuser created successfully",
    "user_id": 123
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "All fields are required" } – if any required field is missing
  • { "success": false, "message": "A username with the same name already exists" } – if the username is already taken
  • { "success": false, "message": "Invalid package ID" } – if pkg_id is invalid
  • { "success": false, "message": "Domain creation failed message" } – if domain setup fails

Suspend/Unsuspend/Delete User

This API endpoint allows an admin to suspend, unsuspend, or delete a user along with all associated FTP, email accounts, and domains.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/suspend_user/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "username": "targetuser",
    "state": "SUSPEND"  // options: SUSPEND, UNSUSPEND, DELETE
]

Response

Returns a JSON object indicating success or failure:

{
    "success": true,
    "message": "User 'targetuser' and all associated accounts/domains have been suspended."
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Username and state are required" } – if missing parameters
  • { "success": false, "message": "User 'targetuser' does not exist." } – if username not found
  • { "success": false, "message": "User 'targetuser' must be suspended before deletion." } – if trying to DELETE an active user
  • { "success": false, "message": "Unknown state 'XYZ'. Use SUSPEND, UNSUSPEND or DELETE." } – if invalid state

Update User

This API endpoint allows an admin to update a user's details, including name, email, password, and package assignment.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/update_user/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "username": "existinguser",   // required
    "first_name": "NewFirstName", // optional
    "last_name": "NewLastName",   // optional
    "email": "newemail@example.com", // optional
    "password": "NewPassword123", // optional
    "pkg_id": 2                   // optional
]

Response

Returns a JSON object indicating success or failure:

{
    "success": true,
    "message": "User 'existinguser' updated successfully.",
    "user_id": 123
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Username is required" } – if missing username
  • { "success": false, "message": "User with username 'existinguser' not found." } – if username does not exist

List Packages API

This API endpoint allows an admin to retrieve a list of all available hosting packages, including package ID, name, disk space, and other relevant details.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/packages_list/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

No additional parameters are required for this endpoint.

Response

Returns a JSON object containing all available packages:

{
  "success": true,
  "packages": [
    {
      "id": 1,
      "name": "Basic",
      "disk_space": 1024
    },
    {
      "id": 2,
      "name": "Premium",
      "disk_space": 5120
    }
    // ... other packages
  ]
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Invalid admin credentials" } – if login fails

Add New Package

This API endpoint allows an admin to create a new hosting package with custom limits for disk space, bandwidth, email accounts, databases, FTP accounts, and domains.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/new_package/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "name": "Premium",             // required
    "disk_space": 10240,           // optional, in MB
    "bandwidth": 50000,            // optional, in MB
    "email_accounts": 50,          // optional
    "databases": 20,               // optional
    "ftp_accounts": 10,            // optional
    "allowed_domains": 5,          // optional
    "allowed_subdomains": 10,      // optional
    "limit_action": true           // optional, enforce disk limits
]

Response

Returns a JSON object indicating success or failure:

{
    "success": true,
    "message": "Package has been added successfully.",
    "package_id": 3
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Package name is required" } – if missing package name
  • { "success": false, "message": "A package with the same name already exists." } – if duplicate package

Issue SSL for Domain

This API endpoint allows an admin to issue an SSL certificate for a specific domain. The domain must exist in the system before requesting SSL issuance.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/issue_ssl/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "domain": "example.com"   // required
]

Response

Returns a JSON object indicating success or failure:

{
  "success": true,
  "message": "SSL issued successfully for 'example.com'."
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Domain name is required." } – if domain parameter is missing
  • { "success": false, "message": "Domain 'example.com' not found." } – if domain does not exist
  • { "success": false, "message": "Failed to issue SSL for 'example.com'." } – if SSL issuance fails

Add Domain

This API endpoint allows an admin to add a new domain for a specific user. The user must exist, and domain limits must not be exceeded.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/add_domain/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "username": "johndoe",       // required
    "domain": "example.com",      // required
    "php_version": "8.2",         // required
    "path": "public_html"         // optional, defaults to 'public_html'
]

Response

Returns a JSON object indicating success or failure:

{
  "success": true,
  "message": "Domain 'example.com' added successfully!",
  "domain_id": 12
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Username, domain, and php_version are required." } – if required fields are missing
  • { "success": false, "message": "User 'johndoe' not found." } – if username does not exist
  • { "success": false, "message": "Invalid domain format." } – if domain is invalid
  • { "success": false, "message": "The domain 'example.com' already exists." } – if domain exists
  • { "success": false, "message": "Domain add limit exceeded." } – if user package limit reached
  • { "success": false, "message": "Failed to add mapping for 'example.com'." } – if listener mapping fails
  • { "success": false, "message": "Failed to add virtual host for 'example.com'." } – if virtual host creation fails
  • { "success": false, "message": "Failed to set folder permissions for 'example.com'." } – if permissions fail

Create Database User API

This API endpoint allows an admin to create a new database user for a specific existing account. The username must exist in the system.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/database_add/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
  "username": "johndoe",       // required, the account username
  "db": "mydatabase",           // required, database name
  "dbuser": "dbuser1",          // required, new database username
  "dbpass": "strongpassword",   // required, password for database user
  "dbpassc": "strongpassword"   // required, confirm password
]

Response

Returns a JSON object indicating success or failure:

{
  "success": true,
  "message": "Database user created successfully for johndoe."
}

Error Responses

  • { "success": false, "error": "POST method required" } – if not POST
  • { "success": false, "error": "All fields are required." } – if any field is missing
  • { "success": false, "error": "Username 'johndoe' does not exist." } – if username does not exist
  • { "success": false, "error": "Database username must be at least 2 characters long." } – if dbuser is too short
  • { "success": false, "error": "Password must be at least 8 characters long." } – if password is too short
  • { "success": false, "error": "Passwords do not match." } – if passwords mismatch
  • { "success": false, "error": "Some error message from database creation function" } – if creation fails

SSO Login(auto login)

This API endpoint allows an admin to auto login for a specific user base on url. The user must exist.

Endpoint

POST https://<server_ip_or_hostname>:<port>/admin_api/sso_login/

Request Headers

  • username: Admin username
  • password: Admin password

Request Body (POST)

[
    "username": "johndoe",       // required
    
]

Response

Returns a JSON object indicating success or failure:

{
    "success": true,
    "message": "User 'johndoe' successfully genarate sso token.",
    "url": "https://example.win:0000/login/?token=ugkyteyJ1c2VyIjogImxpdG9udmFpIiwgImFwaSI6ICJwZ2Zwbk9EZDZMa3Q1S2xWa05qZFdSbkk9IiwgInBvcnQiOiAiMDAwMCJ9"
}

Error Responses

  • { "success": false, "message": "POST method required" } – if not POST
  • { "success": false, "message": "Username are required." } – if required fields are missing

Exampe Add User by php

PHP Example

<?php
$api_url = "http://<server_ip_or_hostname>:<port>/admin_api/add_user/";

$post_data = [
    "username"   => "newuser",
    "first_name" => "John",
    "last_name"  => "Doe",
    "email"      => "user@example.com",
    "password"   => "UserPassword123",
    "pkg_id"     => 1,
    "domain"     => "example.com",
    "php_version"=> "8.2"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Set admin headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "username: adminuser",
    "password: adminpass",
    "Content-Type: application/x-www-form-urlencoded"
]);

$response = curl_exec($ch);
if(curl_errno($ch)){
    echo "cURL Error: " . curl_error($ch);
} else {
    echo $response;
}
curl_close($ch);
?>