Home > cPanel API Readme

cPanel API with WHMCS

Note this guide is only for WHMCS and no other WHM system.
As an alternative you may want to try this custom API
Please look Click here for a custom API documentation and Click here to download the code


If you do want to use WHMCS read on below :

Setting up WHMCS

1. Login to your WHMCS admin, navigate the menu to /SETUP/*Products/Services*/Servers

2. Click to add a new server and enter the details:

Name: Your desired server name IP address: panel.myownfreehost.net Nameservers: Enter your desired nameservers eg. ns1.byethost.com / ns2.byethost.com Type: cpanel Username: The user API you received inside your reseller panel Access Hash: The API key you received inside your reseller panel Secure: Check

3.The API host name is : panel.myownfreehost.net , the ip address to use is 185.27.134.3

4. Save changes.

4. Create a template for the free account welcome emails. Navigate to /SETUP/Email Templates/ Choose *TYPE* to be "Product" and enter a name in *Unique Name*, eg. Free Hosting Welcome

5. You can use the bellow template and adjust it as needed (replace *Your-Reseller-Domain.com* with your own reseller domain!):

************************ Email Template Example ********************************************* Dear {$client_name},

PLEASE READ THIS EMAIL IN FULL AND PRINT IT FOR YOUR RECORDS

Thank you for your order from us! Your hosting account will now be setup over the next 5 minutes and this email contains all the information you will need in order to begin using your account.

If you have requested a domain name during sign up, please keep in mind that your domain name will not be visible on the internet instantly. This process is called domain propagation and can take up to 48 hours. Until your domain has propagated, your website and email will not function, we have provided a temporary url which you may use to view your website and upload files in the meantime.

New Account Information

Hosting Package: {$service_product_name}
Domain: {$service_domain}
Billing Cycle: {$service_billing_cycle}

Login Details

Username: {$service_username}
Password: {$service_password}

Control Panel URL: http://cpanel.*Your-Reseller-Domain.com*

Server Information

Server Name: {$service_server_name}

If you are using an existing domain with your new hosting account, you will need to update the nameservers to point to the nameservers listed below.

Nameserver 1: {$service_ns1} ({$service_ns1_ip})
Nameserver 2: {$service_ns2} ({$service_ns2_ip}){if $service_ns3}
Nameserver 3: {$service_ns3} ({$service_ns3_ip}){/if}{if $service_ns4}
Nameserver 4: {$service_ns4} ({$service_ns4_ip}){/if}

Uploading Your Website

You may use one of the addresses given below manage your web site:
Cpanel URL: http://cpanel.*Your-Reseller-Domain.com*
FTP Hostname: ftp.*Your-Reseller-Domain.com*

And once your domain has propagated you may use the url below:

Webpage URL: http://www.{$service_domain}

{$signature}
************************ Email Template Example End ***********************************************************************

6. Next is to create the product inside your WHMCS. Navigate the menu to /SETUP/*Products/Services*/*Products/Services*

7. Create a new group if needed, then click on Create new Product and enter the details of the new service:

*Details Tab*
Product Type: Hosting account
Product Group: Your choosen group
Product Name: Enter a name of your service, eg. Free account
Product Description: Simple description of the service
Welcome Email: The new Welcome email for the free service
Require Domain: Check this if you wish to allow doman registration
*Pricing Tab*
Payment type: free
*Module Settings*
Module name: cPanel
WHM Package Name: Enter a name for a package
Web Space Quota: Enter the disk quota per your free reseller limits
Bandwidth Limit: Enter bandwidth quota per your free reseller limits
Max FTP Accounts: 1
Max Email Accounts: None
Max SQL Databases: Enter SQL Databases quota per your free reseller limits
Max Subdomains: Enter Subdomains quota per your free reseller limits
Max Parked Domains: Enter Parked Domains quota per your free reseller limits
Max Addon Domains: Enter Addon Domains quota per your free reseller limit
Automatically setup the product as soon as an order is placed: Check

The rest should remain the same.

8. Click save changes

Installing the reseller API Hook

1. Copy the file 'hook_subwhois.php' to the location:
Click here to download the hook file
/*WHMCS-DIR*/includes/hooks/

2. (OPTIONAL) For more usability when removing the subdomain name from cart summary it is recommended to replace the bellow function:

function removeItem(type,num) {
        var response = confirm("{/literal}{$LANG.cartremoveitemconfirm}{literal}");
        if (response) {
                window.location = 'cart.php?a=remove&r='+type+'&i='+num;
        }
}

with the bellow :

function removeItem(type,num) {
        $.get('cart.php?a=remove&r='+type+'&i='+num);
        var response = confirm('Press OK to choose a new subdomain or cancel to remain on view cart');
        if (response) {
                window.history.back(1);
        } else {
                window.location.reload();
        }
}

The file can be located inside:

/*WHMCS-DIR*/templates/orderforms/*ORDER-FORM-TEMPLATE*/viewcart.tpl

You need to replace the code inside the default order form you've set in your whmcs admin section /SETUP/General Settings/Ordering tab

Alternatively you can download the order template bellow which should contain all customization above and is *ready* to be used:
Cpanel Api WHMCS order template

This needs to be untared using 7zip or similar applications and upload the content of the archive inside:
/*WHMCS-DIR*/templates/orderforms/

After you've uploaded the order template, you should be able to select it when creating the product group inside your WHMCS "Products/Services" section.
Note: This template is based on the pre-existing one, *Comparison*, in the Default templates from WHMCS.

Get your free, professional and reliable turn-key hosting reseller !

Fully customizable and hosted on our powerful clustered network. Host unlimited clients under one free reseller plan !