Constructor
new Clients(config)
Parameters:
Name |
Type |
Description |
config |
Object
|
Object containing your API credentials.
Properties
Name |
Type |
Attributes |
Description |
serverUrl |
string
|
|
URL to your installation. Remember to point to /includes/api.php |
username |
string
|
<optional>
|
|
password |
string
|
<optional>
|
|
identifier |
string
|
<optional>
|
|
secret |
string
|
<optional>
|
|
|
- Source:
Extends
Methods
addClient(opts)
Adds a client. - https://developers.whmcs.com/api-reference/addclient/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
firstname |
String
|
|
|
lastname |
String
|
|
|
companyname |
String
|
<optional>
|
|
email |
String
|
|
|
address1 |
String
|
|
|
address2 |
String
|
<optional>
|
|
city |
String
|
|
|
state |
String
|
|
|
postcode |
String
|
|
|
country |
String
|
|
2 character ISO country code |
phonenumber |
String
|
|
|
tax_id |
String
|
<optional>
|
The client Tax ID |
password2 |
String
|
|
|
securityqid |
Number
|
<optional>
|
Security Question ID from tbladminsecurityquestions |
securityqans |
String
|
<optional>
|
Security Question Answer |
cardtype |
String
|
<optional>
|
Credit card type. Provide full name: Visa, Mastercard, American Express, etc… |
cardnum |
String
|
<optional>
|
Credit card number |
expdate |
String
|
<optional>
|
Format: MMYY |
startdate |
String
|
<optional>
|
Format: MMYY (if applicable) |
issuenumber |
String
|
<optional>
|
Credit card issue number (if applicable) |
cvv |
String
|
<optional>
|
Credit card CVV number (will not be stored) |
currency |
Number
|
<optional>
|
Currency ID from tblcurrencies |
groupid |
Number
|
<optional>
|
Client Group ID from tblclientgroups |
customfields |
String
|
<optional>
|
Base64 encoded serialized array of custom field values |
language |
String
|
<optional>
|
Default language setting. Provide full name: ‘english’, ‘french’, etc… |
clientip |
String
|
<optional>
|
IP address of the user |
notes |
String
|
<optional>
|
Admin only notes |
marketingoptin |
Boolean
|
<optional>
|
Set true to opt client in to marketing emails |
noemail |
Boolean
|
<optional>
|
Pass as true to skip sending welcome email |
skipvalidation |
Boolean
|
<optional>
|
Pass as true to ignore required fields validation |
|
- Source:
Adds a contact to a client account. - https://developers.whmcs.com/api-reference/addcontact/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
clientid |
Number
|
|
|
firstname |
String
|
<optional>
|
|
lastname |
String
|
<optional>
|
|
companyname |
String
|
<optional>
|
|
email |
String
|
<optional>
|
Email address to identify the contact. This should be unique if the contact will be a sub-account |
address1 |
String
|
<optional>
|
|
address2 |
String
|
<optional>
|
|
city |
String
|
<optional>
|
|
state |
String
|
<optional>
|
|
postcode |
String
|
<optional>
|
|
country |
String
|
<optional>
|
2 character ISO country code |
phonenumber |
String
|
<optional>
|
|
tax_id |
String
|
<optional>
|
|
password2 |
String
|
<optional>
|
if creating a sub-account |
generalemails |
Boolean
|
<optional>
|
set true to receive general email types |
productemails |
Boolean
|
<optional>
|
set true to receive product related emails |
domainemails |
Boolean
|
<optional>
|
set true to receive domain related emails |
invoiceemails |
Boolean
|
<optional>
|
set true to receive billing related emails |
supportemails |
Boolean
|
<optional>
|
set true to receive support ticket related emails |
permissions |
String
|
<optional>
|
A comma separated list of sub-account permissions. eg manageproducts,managedomains |
|
- Source:
closeClient(opts)
This will close the client, cancel any invoices and set the status of all products to Cancelled or Terminated. - https://developers.whmcs.com/api-reference/closeclient/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Description |
clientid |
Number
|
The ID of the client to close |
|
- Source:
deleteClient(opts)
Removes client record and all associated data. This action cannot be undone. - https://developers.whmcs.com/api-reference/deleteclient/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Description |
clientid |
Number
|
The client id to be deleted |
|
- Source:
Removes contact record. This action cannot be undone. - https://developers.whmcs.com/api-reference/deletecontact/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Description |
contactid |
Number
|
The contact id to be deleted |
|
- Source:
getCancelledPackages(opts)
Obtain an array of cancellation requests - https://developers.whmcs.com/api-reference/getcancelledpackages/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
limitstart |
Number
|
<optional>
|
The offset for the returned cancellation request data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
|
- Source:
getClientGroups(opts)
Obtain an array of client groups - https://developers.whmcs.com/api-reference/getclientgroups/
Parameters:
Name |
Type |
Description |
opts |
Object
|
|
- Source:
getClientPassword(opts)
Obtain the encrypted client password - https://developers.whmcs.com/api-reference/getclientpassword/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
userid |
Number
|
<optional>
|
The userid to obtain the password for |
email |
String
|
<optional>
|
The email address to obtain the password for |
|
- Source:
getClients(opts)
Obtain the Clients that match passed criteria - https://developers.whmcs.com/api-reference/getclients/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
limitstart |
Number
|
<optional>
|
The offset for the returned log data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
sorting |
String
|
<optional>
|
The direction to sort the results. ASC or DESC. Default: ASC |
search |
String
|
<optional>
|
The search term to look for at the start of email, firstname, lastname, fullname or companyname |
|
- Source:
getClientsAddons(opts)
Obtain the Clients Product Addons that match passed criteria - https://developers.whmcs.com/api-reference/getclientsaddons/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
serviceid |
Number
|
<optional>
|
string |
clientid |
Number
|
<optional>
|
The client to obtain the client product addons for |
addonid |
Number
|
<optional>
|
The predefined addon id to obtain the client product addons for |
|
- Source:
getClientsDetails(opts)
Note this function returns the client information in the top level array. This information
is deprecated and may be removed in a future version of WHMCS. - https://developers.whmcs.com/api-reference/getclientsdetails/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
clientid |
Number
|
<optional>
|
The client id to obtain the details for. $clientid or $email is required |
email |
String
|
<optional>
|
The email address of the client to search for |
stats |
Boolean
|
<optional>
|
Also return additional client statistics. |
|
- Source:
getClientsDomains(opts)
Obtain a list of Client Purchased Domains matching the provided criteria - https://developers.whmcs.com/api-reference/getclientsdomains/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
limitstart |
Number
|
<optional>
|
The offset for the returned log data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
clientid |
Number
|
<optional>
|
The client id to obtain the details for. |
domainid |
Number
|
<optional>
|
The specific domain id to obtain the details for |
domain |
String
|
<optional>
|
The specific domain to obtain the details for |
|
- Source:
getClientsProducts(opts)
Obtain a list of Client Purchased Products matching the provided criteria - https://developers.whmcs.com/api-reference/getclientsproducts/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
limitstart |
Number
|
<optional>
|
The offset for the returned log data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
clientid |
Number
|
<optional>
|
The client id to obtain the details for. |
serviceid |
Number
|
<optional>
|
The specific service id to obtain the details for |
pid |
Number
|
<optional>
|
The specific product id to obtain the details for |
domain |
String
|
<optional>
|
The specific domain to obtain the service details for |
username2 |
String
|
<optional>
|
The specific username to obtain the details for |
|
- Source:
Obtain the Client Contacts that match passed criteria - https://developers.whmcs.com/api-reference/getcontacts/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
limitstart |
Number
|
<optional>
|
The offset for the returned log data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
userid |
Number
|
<optional>
|
Find contacts for a specific client id |
firstname |
String
|
<optional>
|
Find contacts with a specific first name |
lastname |
String
|
<optional>
|
Find contacts with a specific last name |
companyname |
String
|
<optional>
|
Find contacts with a specific company name |
email |
String
|
<optional>
|
Find contacts with a specific email address |
address1 |
String
|
<optional>
|
Find contacts with a specific address line 1 |
address2 |
String
|
<optional>
|
Find contacts with a specific address line 2 |
city |
String
|
<optional>
|
Find contacts with a specific city |
state |
String
|
<optional>
|
Find contacts with a specific state |
postcode |
String
|
<optional>
|
Find contacts with a specific post/zip code |
country |
String
|
<optional>
|
Find contacts with a specific country |
phonenumber |
String
|
<optional>
|
Find contacts with a specific phone number |
subaccount |
Boolean
|
<optional>
|
Search for sub-accounts |
|
- Source:
getEmails(opts)
Obtain a list of emails sent to a specific Client ID - https://developers.whmcs.com/api-reference/getemails/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
clientid |
Number
|
|
The Client ID to retrieve the emails for |
limitstart |
Number
|
<optional>
|
The offset for the returned log data (default: 0) |
limitnum |
Number
|
<optional>
|
The number of records to return (default: 25) |
date |
String
|
<optional>
|
The date to retrieve emails for. |
subject |
String
|
<optional>
|
The subject to retrieve emails for - uses approximate string matching. |
|
- Source:
resetPassword(opts)
Starts the password reset process for a client or contact. - https://developers.whmcs.com/api-reference/resetpassword/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
id |
Number
|
<optional>
|
The id of the client to reset. The id can only belong to a client. |
email |
String
|
<optional>
|
The email address of the client or contact to update. Either $id or $email is required |
answer |
String
|
<optional>
|
The answer to the client security question if appropriate |
|
- Source:
updateClient(opts)
Updates a client with the passed parameters. - https://developers.whmcs.com/api-reference/updateclient/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
clientid |
Number
|
<optional>
|
The id of the client to update |
clientemail |
String
|
<optional>
|
The email address of the client to update. Either $clientid or $clientemail is required |
firstname |
String
|
<optional>
|
|
lastname |
String
|
<optional>
|
|
companyname |
String
|
<optional>
|
|
email |
String
|
<optional>
|
|
address1 |
String
|
<optional>
|
|
address2 |
String
|
<optional>
|
|
city |
String
|
<optional>
|
|
state |
String
|
<optional>
|
|
postcode |
String
|
<optional>
|
|
country |
String
|
<optional>
|
2 character ISO country code |
phonenumber |
String
|
<optional>
|
|
password2 |
String
|
<optional>
|
|
securityqid |
Number
|
<optional>
|
Security Question ID from tbladminsecurityquestions |
securityqans |
String
|
<optional>
|
Security Question Answer |
cardtype |
String
|
<optional>
|
Credit card type. Provide full name: Visa, Mastercard, American Express, etc… |
cardnum |
String
|
<optional>
|
Credit card number |
expdate |
String
|
<optional>
|
Format: MMYY |
startdate |
String
|
<optional>
|
Format: MMYY (if applicable) |
issuenumber |
String
|
<optional>
|
Credit card issue number (if applicable) |
bankcode |
String
|
<optional>
|
Client Bank Account Code (if applicable) |
bankacct |
String
|
<optional>
|
Client bank Account number (if applicable) |
cvv |
String
|
<optional>
|
Credit card CVV number (will not be stored) |
currency |
Number
|
<optional>
|
Currency ID from tblcurrencies |
groupid |
Number
|
<optional>
|
Client Group ID from tblclientgroups |
customfields |
String
|
<optional>
|
Base64 encoded serialized array of custom field values |
language |
String
|
<optional>
|
Default language setting. Provide full name: ‘english’, ‘french’, etc… |
clientip |
String
|
<optional>
|
IP address of the user |
notes |
String
|
<optional>
|
Admin only notes |
status |
String
|
<optional>
|
Status, e.g. “Active” |
paymentmethod |
String
|
<optional>
|
The default payment method |
marketingoptin |
Boolean
|
<optional>
|
Set true to opt client in to marketing emails |
clearcreditcard |
Boolean
|
<optional>
|
Pass as true to clear the stored CC details |
skipvalidation |
Boolean
|
<optional>
|
Pass as true to ignore required fields validation |
|
- Source:
Updates a contact with the passed parameters. - https://developers.whmcs.com/api-reference/updatecontact/
Parameters:
Name |
Type |
Description |
opts |
Object
|
Properties
Name |
Type |
Attributes |
Description |
contactid |
Number
|
|
The id of the contact to update |
subaccount |
Boolean
|
<optional>
|
Is the contact a subaccount |
firstname |
String
|
<optional>
|
|
lastname |
String
|
<optional>
|
|
companyname |
String
|
<optional>
|
|
email |
String
|
<optional>
|
|
address1 |
String
|
<optional>
|
|
address2 |
String
|
<optional>
|
|
city |
String
|
<optional>
|
|
state |
String
|
<optional>
|
|
postcode |
String
|
<optional>
|
|
country |
String
|
<optional>
|
2 character ISO country code |
phonenumber |
String
|
<optional>
|
|
password2 |
String
|
<optional>
|
(sub-account only) |
generalemails |
Boolean
|
<optional>
|
Should the contact receive general emails |
productemails |
Boolean
|
<optional>
|
Should the contact receive product emails |
domainemails |
Boolean
|
<optional>
|
Should the contact receive domain emails |
invoiceemails |
Boolean
|
<optional>
|
Should the contact receive invoice emails |
supportemails |
Boolean
|
<optional>
|
Should the contact receive support emails |
permissions |
String
|
<optional>
|
A comma separated list of sub-account permissions. eg manageproducts,managedomains |
|
- Source: