whmcs-sdk

WHMCS SDK

A comprehensive and easy-to-use Node SDK, designed to simplify interactions with the WHMCS API and streamline your development process.



  • Install Node.js version 20.0.0 or higher.
  • Only API Credentials are supported for authenticating (username and password is depreciated as of 7.2!)
  • For a full list of Modules/Methods visit the WHMCS Docs

To install the WHMCS SDK, use your preferred package manager:

npm install whmcs-sdk
bun install whmcs-sdk
yarn install whmcs-sdk

There is a variety of pre-made functions you can use to help make your experience more seamless.

  • call(action, options)
  • get(action, options): An alias of call but appends Get to the name.
  • add(action, options): An alias of call but appends Add to the name.
  • update(action, options): An alias of call but appends Update to the name.
  • delete(action, options): An alias of call but appends Delete to the name.

The "action" (string) is the name of a WHMCS API Index name. The "options" (object) of any parameters you want to pass in.


To use the module you will first need to import it:

import { whmcsApi } from 'whmcs-sdk';

you can then instantiate a new client with options:

const whmcs = new whmcsApi({
host: 'yourwebsite.com',
identifier: 'api identifier',
secret: 'api secret'
//endpoint: 'includes/api.php', //only required if you changed the api.php location
});
whmcs.call('DomainWhois', {
domain: 'whmcs.com'
}, function (err, res, body) {
if (err) return console.log('Error:', err);

console.log('Domain information:', body);
});
whmcs.get('Servers')
.then(servers => console.log('Servers:' servers))
.catch(err => console.error('Error:', err));