Get a license
contPanel Developer API · v1

Hosting that runs
from your billing.

One JSON endpoint on every contPanel server. Orders become accounts, unpaid invoices suspend them, upgrades resize them — and disk and traffic flow back to you. Free modules for WHMCS and HostBill.

13actions
300/minper token
JSONover HTTPS · port 2087
account.create
curl https://server.example.com:2087/api/ \
  -H "X-API-Key: cpk_3f9c…" \
  -d '{"action":"account.create",
       "username":"alice",
       "domain":"alice.com",
       "package":"Business"}'

# 200 OK
{
  "ok": true,
  "data": { "username": "alice",
            "domain": "alice.com",
            "password": "…" }
}

Quick start

Every contPanel server has the API built in. There is nothing to install on the server — create a token and call it.

1
Create a tokenRoot panel :2087 → Developer → New token. Limit it to your billing server’s IP address and choose full or read-only access.
2
Test itSend {"action":"test"} to https://SERVER:2087/api/. The answer contains "pong": true.
3
AutomateInstall the WHMCS or HostBill module, or call the actions below from your own software.
curl -sk https://SERVER:2087/api/ -H "X-API-Key: cpk_YOUR_TOKEN" -d '{"action":"test"}'

Authentication

Send the token in one of these headers. Both are accepted on every request:

HeaderExample
X-API-KeyX-API-Key: cpk_3f9c… — recommended, passes every proxy
AuthorizationAuthorization: Bearer cpk_3f9c…

Requests & answers

One endpoint: POST https://SERVER:2087/api/. The body is a JSON object with an action and its parameters. Form-encoded bodies work too.

{"ok": true, "data": { … }}

HTTP status is 200 for success, 400 for a failed action, 401 for a missing or wrong token, 403 for a refused address or a read-only token, 429 for the rate limit.

Errors

errorMeaning
api_unauthorizedToken missing or wrong
api_ip_not_allowedThe caller’s address is not in the token’s list
api_read_onlyA read-only token tried to change something
api_rate_limitedMore than 300 calls in the last minute
api_unknown_actionThe action name does not exist
license_lockedThe server’s license is not valid; reading still works
account_not_foundNo account with that username
username_taken · invalid_usernameUsername exists, or is not 3–16 lowercase letters/digits starting with a letter
invalid_domain · site_existsThe domain is invalid or already on this server
password_shortPasswords need at least 8 characters
license_limitThe license’s account limit is reached
api_failedUnexpected server error; message has the detail

Limits & security

Reference

Parameters go next to action in the JSON body. username is always the contPanel account name.

test

read

Checks the token and the connection.

{"ok":true,"data":{"pong":true,"version":"1.7.0","time":"2026-11-14T21:00:00+00:00"}}

server.info

read

Version, host name, license state, number of accounts and sites, and current load.

{"ok":true,"data":{"version":"1.7.0","hostname":"server1.example.com",
 "license":{"valid":true,"reason":""},"accounts":42,"sites":67,"system":{ "load":[0.21,0.18,0.12], "memory":{…}, "disk":{…} }}}

package.list

read

The packages defined in Root → Packages. Use id or name wherever a package is expected.

{"ok":true,"data":[{"id":"starter","name":"Starter","disk_mb":5120,"max_sites":5,"max_dbs":5,"accounts":12}]}

account.list

read

All accounts with package, owner, sites, databases, disk use and state.

{"ok":true,"data":[{"username":"alice","domain":"alice.com","email":"[email protected]","package":"starter",
 "package_name":"Starter","owner":"admin","sites":2,"dbs":1,"disk_used":734003200,"disk_mb":5120,"suspended":false,"created_at":"2026-11-02 10:14"}]}

account.get

read

One account, including its usage (same fields as usage).

ParameterDescription
username *Account name

account.create

write

Creates the Linux user, /home/USERNAME/public_html, the site with its PHP pool and web server config, the DNS zone, the main FTP login and starts AutoSSL.

ParameterDescription
username *3–16 characters, lowercase letters and digits, starts with a letter
domain *Primary domain, e.g. alice.com
package *Package id or name
passwordAt least 8 characters. Empty → a strong password is generated and returned
emailContact address of the customer
resellertrue to create a reseller account
{"ok":true,"data":{"username":"alice","password":"S3cure!pass","domain":"alice.com"}}

account.suspend

write

Stops the account’s sites (a suspension page is shown), FTP and panel sign-in. Files and databases stay.

ParameterDescription
username *Account name
reasonShown to root in the panel, e.g. unpaid

account.unsuspend

write

Brings a suspended account back exactly as it was.

ParameterDescription
username *Account name

account.password

write

Changes the panel, main FTP and SFTP password together.

ParameterDescription
username *Account name
passwordAt least 8 characters. Empty → generated and returned

account.package

write

Moves the account to another package (upgrade or downgrade). New limits apply at once.

ParameterDescription
username *Account name
package *Package id or name

account.delete

write

Removes the account with its sites, databases, DNS zones, FTP logins, certificates and /home/USERNAME. This cannot be undone.

ParameterDescription
username *Account name

usage

read

Disk use and this month’s web traffic. Without username it returns every account — one call is enough for a nightly sync.

ParameterDescription
usernameAccount name (optional)
{"ok":true,"data":{"disk_mb":700,"disk_limit_mb":5120,"bandwidth_mb":18342,"bandwidth_month":"2026-11","sites":2,"databases":1,"suspended":false}}

sso

write

Returns a one-time link that signs the customer into their panel on port 2083. Valid for 60 seconds, usable once.

ParameterDescription
username *Account name
hostHost name for the link (default: the server’s host name)
{"ok":true,"data":{"url":"https://server1.example.com:2083/sso.php?c=8f1e…","expires_in":60}}

WHMCS & HostBill modules

WHMCS

Provisioning module with package loader, daily usage sync and single sign-on.

  1. Unzip into your WHMCS folder → modules/servers/contpanel/
  2. System Settings → Servers → Add: module contPanel, host name, port 2087, Secure on, token in Access Hash. Test Connection.
  3. Products → Module Settings: choose contPanel and the package.
Download for WHMCS

HostBill

Hosting module with package loader, account and usage sync and “Log in to contPanel” for clients and admins.

  1. Unzip into your HostBill folder → includes/modules/Hosting/contpanel/, then Settings → Modules → Hosting Modules: activate contPanel.
  2. Settings → Apps → Add new App: contPanel, host name, Secure on, token in Hash (port 2087 by default). Test Connection.
  3. Product → Connect with App: choose contPanel and the package.
Download for HostBill
Billing eventWHMCSHostBillAPI action
Order activatedCreateAccountCreateaccount.create
Invoice overdueSuspendAccountSuspendaccount.suspend
Invoice paidUnsuspendAccountUnsuspendaccount.unsuspend
CancelledTerminateAccountTerminateaccount.delete
Password changeChangePasswordChangePasswordaccount.password
Upgrade / downgradeChangePackageChangePackageaccount.package
UsageUsageUpdate (daily)getSynchInfousage
Log in buttonServiceSingleSignOngetLoginUrlsso

Other modules

WiseCPBilling software used mostly in Turkey. The contPanel team built this server module on the same API and keeps it up to date: create, suspend, upgrade, usage and “Log in to contPanel”. Unzip into the WiseCP folder (coremio/modules/Servers/ContPanel/), then add a server of type contPanel with the token as access hash.
Download

Examples

<?php
function contpanel($action, array $params = []) {
    $ch = curl_init('https://server1.example.com:2087/api/');
    curl_setopt_array($ch, [
        CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POSTFIELDS => json_encode(['action' => $action] + $params),
        CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-API-Key: ' . getenv('CONTPANEL_TOKEN')],
        CURLOPT_SSL_VERIFYPEER => false, // self-signed until the panel certificate is issued
    ]);
    $r = json_decode(curl_exec($ch), true);
    if (empty($r['ok'])) throw new RuntimeException($r['error'] ?? 'connection failed');
    return $r['data'];
}

$acc = contpanel('account.create', ['username' => 'alice', 'domain' => 'alice.com', 'package' => 'Starter']);
echo $acc['password'];
Need an action that is not here? Write to us from contpanel.com or ask in the Community forum — the API grows with what hosting companies need.
Building on contPanel? Talk to other developers.

Share integrations, ask about the API, WHMCS and HostBill modules, and get answers from the team in the contPanel Community.

Join the Community →