WHMCS API client.
Last updated a year ago by jhead .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cubedhost/whmcs 
SYNC missed versions from official npm registry.

WHMCS Node Module

WHMCS's API Node client.


npm install whmcs


First you need to instantiate it.

var config = {
  username: 'api_username',
  password: 'password_as_md5',
  apiKey: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz', // if access without IP restriction
  serverUrl: ''

var wclient = new WHMCS(config);

Using the created client, call the methods you need, example:

whmcs_client.billing.getInvoice(invoiceid, function(err, invoice) {

whmcs_client.billing.payInvoice(invoiceid, 'full', function(err, data) {

whmcs_client.customers.validateLogin(email, password, function(err, data) {

whmcs_client.customers.getTickets(function(err, tickets) {

whmcs_client.customers.getCustomerEmails(clientid, function(err, emails) {


Implemented functions


  • updateInvoice: function (invoiceid, options, callback)
  • acceptOrder: function (orderid, options, callback)
  • addOrder: function (clientid, order, callback)
  • addCredit: function (clientid, amount, description, callback)
  • payInvoice: function (invoiceid, amount, callback)
  • getInvoice: function (invoiceid, callback)
  • getInvoices: function ([options], callback)
  • cancelOrder: function (orderid, callback)
  • deleteOrder: function (orderid, callback)
  • createInvoice: function (clientid, invoice, callback)
  • capturePayment: function (invoiceid, options, callback)
  • addInvoicePayment: function (invoiceid, transid, gateway, options, callback)


  • getContacts: function (clientid, [options], callback)
  • createContact: function (options, callback)
  • deleteContact: function (contactid, callback)
  • updateContact: function (contactid, options, callback)
  • createCustomer: function (options, callback)
  • deleteCustomer: function (clientid, callback)
  • updateCustomer: function (clientid, options, callback)
  • updateCustomerDomain: function (domainid, options, callback)
  • updateCustomerProduct: function (serviceid, options, callback)
  • getCustomer: function (clientid, [options], callback)
  • getCustomerProducts: function (clientid, [options], callback)
  • getCustomerDomains: function (clientid, [options], callback)
  • getCustomerEmails: function (clientid, [options], callback)
  • getCustomerInvoices: function (clientid, [options], callback)
  • validateLogin: function (email, password, callback)
  • sendEmail: function (id, options, callback)
  • getCredits: function (userid, callback)


  • getProduct: function (id, callback)
  • getProducts: function (gid, callback)
  • getProductsByType: function (type, id, callback)
  • getOrders: function (method, id, offset, limit, callback)
  • upgradeProduct: function (product, callback)


  • openTicket: function (clientid, department, subject, message, [options], callback)
  • getTicket: function (ticketid, callback)
  • deleteTicket: function (ticketid, callback)
  • replyTicket: function (ticketid, message, [options], callback)
  • getTickets: function ([options], callback)
  • updateTicket: function (options, callback)


  • getDomainLockStatus: function (domainid, callback)
  • setDomainLockStatus: function (domainid, status, callback)
  • getDomainNameservers: function (domainid, callback)
  • setDomainNameservers: function (domainid, nameservers, callback)


  • getToDoItems: function (status, offset, limit, callback)


  • addLicense: function (type, callback)
  • cancelLicense: function (key, callback)
  • listLicenses: function (callback)
  • reissueLicense: function (key, callback)
  • modifyLicense: function (key, opts, callback)
  • getPricingLicense: function (callback)
  • searchLicense: function (opts, callback)
  • brandingLicense: function (action, key, callback)

Custom API functions


var wclient = new WHMCS(config);

wclient.customers.getTopCustomer = function (callback) {
  var options = {
    action: 'gettopcustomer'

  var opts = {
    client: this,
    body: options

  wclient.utils.modem(opts, callback);




if (!defined("WHMCS")) {
  exit("This file cannot be accessed directly");


if(!$error) {
  $json["customer"] = 1234;
  $json["result"] = "success";
  $output = json_encode($json);
} else {
  $output = '{"error": "error description ..."}';

echo $output;


Tests are implemented using mocha and chai. Run them with npm test.


Check the test and examples folder for more specific use cases examples.


Pedro Dias - @pedromdias

Licensed under the Apache license, version 2.0 (the "license"); You may not use this file except in compliance with the license. You may obtain a copy of the license at:


Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "as is" basis, without warranties or conditions of any kind, either express or implied. See the license for the specific language governing permissions and limitations under the license.

Current Tags

  • 1.2.2                                ...           latest (a year ago)

2 Versions

  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           2 years ago
Today 0
This Week 1
This Month 3
Last Day 0
Last Week 2
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |