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>/api/
Request Headers
- username: Admin username (optional if using POST username)
- password: Admin password
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 Domain
This API endpoint allows an authenticated user to add a new domain or subdomain to their hosting account. The request requires authentication via API key or password in headers, and domain details in the POST body.
Endpoint
POST https://<server_ip_or_hostname>:<port>/api/add_domain/
Request Headers
- username: Account username
- password: Account password
Request Body (POST)
[
"domain": "example.com",
"php_version": "8.2",
"path": "public_html" // Optional, defaults to public_html
]
Successful Response
Returns JSON confirming successful addition of the domain:
{
"success": true,
"message": "Domain 'example.com' added successfully!",
"domain_id": 123
}
Error Responses
{ "success": false, "message": "Authentication required." }– if not authenticated{ "success": false, "message": "User 'username' not found." }– if the username does not exist{ "success": false, "message": "Domain and PHP version are required." }– if any required field is missing{ "success": false, "message": "Invalid domain format." }– if the domain format is invalid{ "success": false, "message": "The domain 'example.com' already exists." }– if domain already exists{ "success": false, "message": "Domain add limit exceeded." }– if domain limit is reached{ "success": false, "message": "Subdomain add limit exceeded." }– if subdomain limit is 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 vhost setup fails{ "success": false, "message": "Failed to set folder permissions for 'example.com'." }– if permission setup fails
List Domains
This API endpoint retrieves all domains associated with the authenticated user. API key is not required; only username and password (or POST username) authentication is needed.
Endpoint
POST https://<server_ip_or_hostname>:<port>/api/domain_list/
Request Headers
- username: Account username (required)
- password: Account password (required)
Request Body (POST)
[
"username": "exampleuser"
]
Successful Response
Returns JSON array of domains belonging to the user:
[
{
"id": 1,
"domain": "example.com",
"path": "/home/exampleuser/public_html"
},
{
"id": 2,
"domain": "sub.example.com",
"path": "/home/exampleuser/public_html/sub"
}
]
Error Responses
{ "error": "POST method required" }– if request method is not POST{ "error": "Username and password required" }– if authentication headers are missing{ "error": "Invalid credentials" }– if username/password is incorrect{ "success": false, "message": "User 'exampleuser' not found." }– if the POST username does not exist
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>/api/domain_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
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>/api/db_make/
Request Headers
- username: Admin username
- password: Admin password
Request Body (POST)
[
"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
Add Cron Job
This API endpoint allows an authenticated user to add a cron job for their account. All fields must be provided in the POST request.
Endpoint
POST https://<server_ip_or_hostname>:<port>/api/cronjob_add/
Request Headers
- username: Your account username (authentication required)
- password: Your account password (plain text) or apikey (encoded, optional)
Request Body (POST)
[
"minute": "*",
"hour": "*",
"day": "*",
"month": "*",
"weekday": "*",
"comm": "/usr/bin/php /home/username/public_html/cron.php"
]
Response
Returns JSON indicating success or failure of the cron job addition:
{
"success": true,
"message": "Cron job added successfully."
}
Error Responses
{ "success": false, "error": "Invalid request method." }– if not POST{ "success": false, "error": "All fields are required." }– if any cron field is missing{ "success": false, "error": "Cron job already exists." }– if the cron job already exists{ "success": false, "error": "Error message here" }– if any other exception occurs
Exampe Add domain by php
PHP Example
<?php
$api_url = "http://<server_ip_or_hostname>:<port>/api/add_domain/";
$post_data = [
"domain" => "example.com",
"php_version" => "8.2",
"path" => "public_html",
];
$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: accountusername",
"password: accountpass",
"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);
?>