@oxheberg/whmcs-api
Version:
A fully featured and type-safe TypeScript client for the WHMCS API. Includes all official endpoints, modular design, helpful errors, and built with modern developer experience in mind.
1,961 lines (1,950 loc) • 186 kB
TypeScript
interface UpdateClientAddonRequest {
id: number;
addonid?: number;
status?: 'Active' | 'Cancelled' | 'Suspended' | 'Terminated' | 'Fraud';
nextduedate?: string;
nextinvoicedate?: string;
terminationdate?: string;
notes?: string;
}
/**
* WHMCS API client configuration options
*/
interface WhmcsClientOptions {
/** WHMCS API endpoint URL */
url: string;
/** API identifier for authentication */
identifier: string;
/** API secret for authentication */
secret: string;
/** Access key to bypass IP restrictions */
accesskey?: string;
/** Request timeout in milliseconds (default: 30000) */
timeout?: number;
}
/**
* Standard WHMCS API response structure
*/
interface WhmcsResponse {
result: 'success' | 'error';
}
/**
* WHMCS API request parameters
*/
interface WhmcsSuccessResponse extends WhmcsResponse {
result: 'success';
}
/**
* WHMCS API error response
*/
interface WhmcsErrorResponse extends WhmcsResponse {
result: 'error';
message: string;
}
interface AffiliateActivateRequest {
userid: number;
}
interface GetAffiliatesRequest {
limitstart?: number;
limitnum?: number;
userid?: number;
visitors?: number;
paytype?: '' | 'percentage' | 'fixedamount';
payamount?: number;
onetime?: number;
balance?: number;
withdrawn?: number;
}
interface Affiliate {
id: string;
date: string;
clientid: string;
visitors: string;
paytype: string;
payamount: string;
onetime: string;
balance: string;
withdrawn: string;
created_at: string;
updated_at: string;
}
interface GetAffiliatesResponse extends WhmcsResponse {
result: 'success';
totalresults: string;
startnumber: string;
numreturned: string;
affiliates: {
affiliate: Affiliate[];
};
}
interface CreateOAuthCredentialRequest {
grantType: 'authorization_code' | 'single_sign_on';
scope: string;
name?: string;
serviceId?: number;
description?: string;
logoUri?: string;
redirectUri?: string;
}
interface CreateOAuthCredentialResponse extends WhmcsSuccessResponse {
credentialId: string;
clientIdentifier: string;
clientSecret: string;
}
interface CreateSsoTokenRequest {
client_id?: number;
user_id?: number;
destination?: string;
service_id?: number;
domain_id?: number;
sso_redirect_path?: string;
}
interface CreateSsoTokenResponse extends WhmcsResponse {
result: 'success';
access_token: string;
redirect_url: string;
}
interface DeleteOAuthCredentialRequest {
credentialId: number;
}
interface DeleteOAuthCredentialResponse extends WhmcsSuccessResponse {
credentialId: string;
}
interface ListOAuthCredentialsRequest {
grantType?: string;
sortField?: string;
sortOrder?: 'ASC' | 'DESC';
limit?: number;
}
interface ListOAuthCredentialsResponse extends WhmcsResponse {
result: 'success';
clients: Array<{
credentialId: number;
name: string;
description: string;
grantTypes: string;
scope: string;
clientIdentifier: string;
clientSecret: string;
uuid: string | null;
serviceId: number;
logoUri: string;
redirectUri: string[];
rsaKeyPairId: number;
createdAt: string;
updatedAt: string;
}>;
}
interface UpdateOAuthCredentialRequest {
credentialId?: number;
clientApiIdentifier?: string;
name?: string;
description?: string;
grantType?: 'authorization_code' | 'single_sign_on';
scope?: string;
serviceId?: number;
logoUri?: string;
redirectUri?: string[];
resetSecret?: boolean;
}
interface UpdateOAuthCredentialResponse extends WhmcsSuccessResponse {
credentialId: string;
newClientSecret?: string;
}
interface ValidateLoginRequest {
email: string;
password2: string;
}
interface ValidateLoginResponse extends WhmcsResponse {
result: 'success';
userid: string;
passwordhash?: string;
twoFactorEnabled: string;
}
interface AcceptQuoteRequest {
quoteid: number;
}
interface AddBillableItemRequest {
clientid: number;
description: string;
amount: number;
invoiceaction?: '1' | 'nextcron' | 'nextinvoice' | 'duedate' | 'recur';
recur?: number;
recurcycle?: 'Days' | 'Weeks' | 'Months' | 'Years';
recurfor?: number;
duedate?: string;
hours?: number;
}
interface AddCreditRequest {
clientid: number;
description: string;
amount: number;
date?: string;
adminid?: number;
type?: 'add' | 'remove';
}
interface AddCreditResponse extends WhmcsResponse {
result: 'success';
newbalance: number;
}
interface AddInvoicePaymentRequest {
invoiceid: number;
transid: string;
gateway: string;
date: string;
amount?: number;
fees?: number;
noemail?: boolean;
}
interface AddPayMethodRequest {
clientid: number;
type: string;
description?: string;
bank_name?: string;
bank_type?: string;
bank_code?: string;
account_type?: string;
account_number?: string;
routing_number?: string;
bank_account_type?: string;
set_as_default?: boolean;
}
interface AddTransactionRequest {
userid?: number;
currency?: number;
gateway: string;
date: string;
description: string;
amountin?: number;
fees?: number;
amountout?: number;
rate?: number;
transid?: string;
invoiceid?: number;
refundid?: number;
}
interface ApplyCreditRequest {
invoiceid: number;
amount?: number | string;
noemail?: boolean;
}
interface ApplyCreditResponse extends WhmcsResponse {
result: 'success';
invoiceid: number;
amount: number;
invoicepaid: string;
}
interface CapturePaymentRequest {
invoiceid: number;
}
interface CreateInvoiceRequest {
userid: number;
date?: string;
duedate?: string;
taxrate?: number;
taxrate2?: number;
sendinvoice?: boolean;
paymentmethod?: string;
notes?: string;
itemdescription1?: string;
itemamount1?: number;
itemtaxed1?: boolean;
itemdescription2?: string;
itemamount2?: number;
itemtaxed2?: boolean;
itemdescription3?: string;
itemamount3?: number;
itemtaxed3?: boolean;
itemdescription4?: string;
itemamount4?: number;
itemtaxed4?: boolean;
itemdescription5?: string;
itemamount5?: number;
itemtaxed5?: boolean;
itemdescription6?: string;
itemamount6?: number;
itemtaxed6?: boolean;
itemdescription7?: string;
itemamount7?: number;
itemtaxed7?: boolean;
itemdescription8?: string;
itemamount8?: number;
itemtaxed8?: boolean;
itemdescription9?: string;
itemamount9?: number;
itemtaxed9?: boolean;
itemdescription10?: string;
itemamount10?: number;
itemtaxed10?: boolean;
autoapplycredit?: boolean;
}
interface CreateInvoiceResponse extends WhmcsResponse {
result: 'success';
invoiceid: number;
}
interface CreateQuoteRequest {
userid: number;
subject: string;
stage: string;
validuntil: string;
currency?: number;
proposal?: string;
customernotes?: string;
adminnotes?: string;
lineitems: Array<{
description: string;
qty: number;
up: number;
discount?: number;
taxable?: boolean;
}>;
}
interface CreateQuoteResponse extends WhmcsResponse {
result: 'success';
quoteid: number;
}
interface DeletePayMethodRequest {
paymethodid: number;
}
interface DeleteQuoteRequest {
quoteid: number;
}
interface GenInvoicesRequest {
noemail?: boolean;
serviceids?: string;
clientid?: number;
}
interface GenInvoicesResponse extends WhmcsResponse {
result: 'success';
numcreated: number;
}
interface GetCreditsRequest {
clientid?: number;
limitstart?: number;
limitnum?: number;
}
interface GetCreditsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
credits: {
credit: Array<{
id: number;
clientid: number;
date: string;
description: string;
amount: number;
relid: number;
adminid: number;
}>;
};
}
interface GetInvoiceRequest {
invoiceid: number;
}
interface GetInvoiceResponse extends WhmcsResponse {
result: 'success';
invoiceid: number;
invoicenum: string;
userid: number;
date: string;
duedate: string;
datepaid: string;
lastcaptureattempt: string;
subtotal: string;
credit: string;
tax: string;
tax2: string;
total: string;
balance: string;
taxrate: string;
taxrate2: string;
status: string;
paymentmethod: string;
notes: string;
ccgateway: boolean;
items: {
item: Array<{
id: number;
type: string;
relid: number;
description: string;
amount: string;
taxed: number;
}>;
};
transactions: unknown;
}
interface GetInvoicesRequest {
limitstart?: number;
limitnum?: number;
userid?: number;
status?: string;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetInvoicesResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
invoices: {
invoice: Array<{
id: number;
userid: number;
firstname: string;
lastname: string;
companyname: string;
invoicenum: string;
date: string;
duedate: string;
datepaid: string;
last_capture_attempt: string;
date_refunded: string;
date_cancelled: string;
subtotal: string;
credit: string;
tax: string;
tax2: string;
total: string;
taxrate: string;
taxrate2: string;
status: string;
paymentmethod: string;
paymethodid?: number;
notes: string;
created_at: string;
updated_at: string;
currencycode: string;
currencyprefix: string;
currencysuffix: string;
}>;
};
}
interface GetPayMethodsRequest {
clientid: number;
}
interface GetPayMethodsResponse extends WhmcsResponse {
result: 'success';
paymethods: {
paymethod: Array<{
id: number;
payment_type: string;
description: string;
is_default: boolean;
}>;
};
}
interface GetQuotesRequest {
limitstart?: number;
limitnum?: number;
userid?: number;
subject?: string;
stage?: string;
datecreated?: string;
lastmodified?: string;
validuntil?: string;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetQuotesResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
quotes: {
quote: Array<{
id: number;
userid: number;
subject: string;
stage: string;
datecreated: string;
lastmodified: string;
validuntil: string;
currency: number;
proposal: string;
customernotes: string;
adminnotes: string;
totals: {
subtotal: number;
tax1: number;
tax2: number;
total: number;
};
}>;
};
}
interface GetTransactionsRequest {
clientid?: number;
invoiceid?: number;
transid?: string;
type?: string;
limitstart?: number;
limitnum?: number;
}
interface GetTransactionsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
transactions: {
transaction: Array<{
id: number;
userid: number;
currency: number;
gateway: string;
date: string;
description: string;
amountin: string;
fees: string;
amountout: string;
rate: string;
transid: string;
invoiceid: number;
refundid: number;
}>;
};
}
interface SendQuoteRequest {
quoteid: number;
}
interface UpdateInvoiceRequest {
invoiceid: number;
itemdescription?: string[];
itemamount?: number[];
itemtaxed?: boolean[];
newitemdescription?: string[];
newitemamount?: number[];
newitemtaxed?: boolean[];
deletelineids?: number[];
date?: string;
duedate?: string;
notes?: string;
paymentmethod?: string;
taxrate?: number;
taxrate2?: number;
credit?: number;
publish?: boolean;
publishandsendemail?: boolean;
}
interface UpdatePayMethodRequest {
paymethodid: number;
description?: string;
bank_name?: string;
bank_type?: string;
bank_code?: string;
account_type?: string;
account_number?: string;
routing_number?: string;
bank_account_type?: string;
set_as_default?: boolean;
}
interface UpdateQuoteRequest {
quoteid: number;
subject?: string;
stage?: string;
validuntil?: string;
currency?: number;
proposal?: string;
customernotes?: string;
adminnotes?: string;
lineitems?: Array<{
id?: number;
description?: string;
qty?: number;
up?: number;
discount?: number;
taxable?: boolean;
}>;
}
interface UpdateTransactionRequest {
transactionid: number;
transid?: string;
date?: string;
gateway?: string;
description?: string;
amountin?: number;
amountout?: number;
fees?: number;
rate?: number;
credit?: boolean;
allowcredit?: boolean;
}
interface AddClientRequest {
firstname: string;
lastname: string;
email: string;
address1: string;
city: string;
state: string;
postcode: string;
country: string;
phonenumber: string;
companyname?: string;
address2?: string;
currency?: number;
clientgroup?: number;
customfields?: Record<string, unknown>;
language?: string;
emailpreferences?: string;
password2?: string;
securityqid?: number;
securityqans?: string;
notes?: string;
cctype?: string;
cardnum?: string;
expdate?: string;
cvv?: string;
skipvalidation?: boolean;
noemail?: boolean;
}
interface AddClientResponse extends WhmcsResponse {
result: 'success';
clientid: number;
}
interface AddContactRequest {
clientid: number;
firstname: string;
lastname: string;
email: string;
address1?: string;
city?: string;
state?: string;
postcode?: string;
country?: string;
phonenumber?: string;
companyname?: string;
address2?: string;
subaccount?: boolean;
password2?: string;
permissions?: string;
domainemails?: boolean;
generalemails?: boolean;
invoiceemails?: boolean;
productemails?: boolean;
supportemails?: boolean;
affiliateemails?: boolean;
}
interface AddContactResponse extends WhmcsResponse {
result: 'success';
contactid: number;
}
interface CloseClientRequest {
clientid: number;
}
interface DeleteClientRequest {
clientid: number;
}
interface DeleteContactRequest {
contactid: number;
}
interface GetCancelledPackagesRequest {
limitstart?: number;
limitnum?: number;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetCancelledPackagesResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
services: {
service: Array<{
id: number;
userid: number;
orderid: number;
productid: number;
serverid: number;
regdate: string;
domain: string;
paymentmethod: string;
firstpaymentamount: string;
amount: string;
billingcycle: string;
nextduedate: string;
status: string;
username: string;
password: string;
subscriptionid: string;
promoid: number;
overideautosuspend: number;
overidesuspenduntil: string;
dedicatedip: string;
assignedips: string;
notes: string;
productname: string;
groupname: string;
configoptions: Record<string, unknown>;
customfields: Record<string, unknown>;
}>;
};
}
interface GetClientGroupsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
clientgroups: {
group: Array<{
id: number;
groupname: string;
groupcolour: string;
discountpercent: string;
susptermexempt: boolean;
separateinvoices: boolean;
}>;
};
}
interface GetClientPasswordRequest {
userid: number;
}
interface GetClientPasswordResponse extends WhmcsResponse {
result: 'success';
password: string;
}
interface GetClientsRequest {
limitstart?: number;
limitnum?: number;
sorting?: 'ASC' | 'DESC';
orderby?: string;
search?: string;
limitend?: number;
}
interface GetClientsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
clients: {
client: Array<{
id: number;
firstname: string;
lastname: string;
fullname: string;
companyname: string;
email: string;
address1: string;
address2: string;
city: string;
fullstate: string;
state: string;
postcode: string;
countrycode: string;
country: string;
phonenumber: string;
password: string;
statecode: string;
countryname: string;
phonecc: string;
phonenumberformatted: string;
billingcid: number;
securityqid: number;
securityqans: string;
groupid: number;
status: string;
credit: string;
taxexempt: boolean;
latefeeoveride: boolean;
overideduenotices: boolean;
separateinvoices: boolean;
disableautocc: boolean;
datecreated: string;
notes: string;
lastlogin: string;
currency: number;
defaultgateway: string;
cctype: string;
cclastfour: string;
emailoptout: boolean;
overrideautoclose: boolean;
allowsinglereceipt: boolean;
emailverified: boolean;
language: string;
isOptedIntoMarketingEmails: boolean;
customfields: Record<string, unknown>;
}>;
};
}
interface GetClientsAddonsRequest {
clientid?: number;
serviceid?: number;
addonid?: number;
limitstart?: number;
limitnum?: number;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetClientsAddonsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
addons: {
addon: Array<{
id: number;
userid: number;
orderid: number;
serviceid: number;
addonid: number;
regdate: string;
name: string;
setupfee: string;
recurring: string;
billingcycle: string;
nextduedate: string;
nextinvoicedate: string;
status: string;
paymentmethod: string;
notes: string;
}>;
};
}
interface GetClientsDetailsRequest {
clientid?: number;
email?: string;
stats?: boolean;
}
interface GetClientsDetailsResponse extends WhmcsResponse {
result: 'success';
userid: number;
client_id: number;
id: number;
owner_user_id: number;
uuid: string;
firstname: string;
lastname: string;
fullname: string;
companyname: string;
email: string;
address1: string;
address2: string;
city: string;
fullstate: string;
state: string;
postcode: string;
countrycode: string;
country: string;
phonenumber: string;
tax_id: string;
email_preferences: {
general: number;
invoice: number;
support: number;
product: number;
domain: number;
affiliate: number;
};
statecode: string;
countryname: string;
phonecc: string;
phonenumberformatted: string;
telephoneNumber: string;
billingcid: number;
notes: string;
currency: number;
defaultgateway: string;
cctype: string | null;
cclastfour: string | null;
gatewayid: string | null;
groupid: number;
status: string;
credit: string;
taxexempt: boolean;
latefeeoveride: boolean;
overideduenotices: boolean;
separateinvoices: boolean;
disableautocc: boolean;
emailoptout: boolean;
marketing_emails_opt_in: boolean;
overrideautoclose: boolean;
allowSingleSignOn: number;
email_verified: boolean;
language: string;
isOptedInToMarketingEmails: boolean;
tax_state: string;
tax_countrycode: string;
lastlogin: string;
customfields1: string;
customfields: Array<{
id: number;
value: string;
}>;
customfields2: string;
customfields3: string;
customfields4: string;
currency_code: string;
users: {
user: Array<{
id: number;
name: string;
email: string;
is_owner: boolean;
}>;
};
client: {
userid: number;
client_id: number;
id: number;
owner_user_id: number;
uuid: string;
firstname: string;
lastname: string;
fullname: string;
companyname: string;
email: string;
address1: string;
address2: string;
city: string;
fullstate: string;
state: string;
postcode: string;
countrycode: string;
country: string;
phonenumber: string;
tax_id: string;
email_preferences: {
general: number;
invoice: number;
support: number;
product: number;
domain: number;
affiliate: number;
};
statecode: string;
countryname: string;
phonecc: string;
phonenumberformatted: string;
telephoneNumber: string;
billingcid: number;
notes: string;
currency: number;
defaultgateway: string;
groupid: number;
status: string;
credit: string;
taxexempt: boolean;
latefeeoveride: boolean;
overideduenotices: boolean;
separateinvoices: boolean;
disableautocc: boolean;
emailoptout: boolean;
marketing_emails_opt_in: boolean;
overrideautoclose: boolean;
allowSingleSignOn: number;
email_verified: boolean;
language: string;
isOptedInToMarketingEmails: boolean;
tax_state: string;
tax_countrycode: string;
lastlogin: string;
customfields1: string;
customfields: Array<{
id: number;
value: string;
}>;
customfields2: string;
customfields3: string;
customfields4: string;
currency_code: string;
users: {
user: Array<{
id: number;
name: string;
email: string;
is_owner: boolean;
}>;
};
};
stats: {
numdueinvoices: number;
dueinvoicesbalance: string;
incredit: boolean;
creditbalance: string;
grossRevenue: string;
expenses: string;
income: string;
numoverdueinvoices: number;
overdueinvoicesbalance: string;
numDraftInvoices: number;
draftInvoicesBalance: string;
numunpaidinvoices: number;
unpaidinvoicesamount: string;
numpaidinvoices: number;
paidinvoicesamount: string;
numcancelledinvoices: number;
cancelledinvoicesamount: string;
numrefundedinvoices: number;
refundedinvoicesamount: string;
numcollectionsinvoices: number;
collectionsinvoicesamount: string;
numpaymentpendinginvoices: number;
paymentpendinginvoicesamount: string;
productsnumactivehosting: number;
productsnumhosting: number;
productsnumactivereseller: number;
productsnumreseller: number;
productsnumactiveservers: number;
productsnumservers: number;
productsnumactiveother: number;
productsnumother: number;
productsnumactive: number;
productsnumtotal: number;
numactivedomains: number;
numdomains: number;
numacceptedquotes: number;
numquotes: number;
numtickets: number;
numactivetickets: number;
numaffiliatesignups: number;
isAffiliate: boolean;
};
}
interface GetClientsDetailsCleanResponse extends WhmcsResponse {
result: 'success';
client: {
id: number;
owner_user_id: number;
uuid: string;
firstname: string;
lastname: string;
fullname: string;
companyname: string;
email: string;
address1: string;
address2: string;
city: string;
state: string;
postcode: string;
countrycode: string;
country: string;
phonenumber: string;
tax_id: string;
email_preferences: {
general: boolean;
invoice: boolean;
support: boolean;
product: boolean;
domain: boolean;
affiliate: boolean;
};
countryname: string;
phonecc: string;
phonenumberformatted: string;
billingcid: number;
notes: string;
currency: number;
currency_code: string;
defaultgateway: string;
groupid: number;
status: string;
credit: string;
taxexempt: boolean;
latefeeoveride: boolean;
overideduenotices: boolean;
separateinvoices: boolean;
disableautocc: boolean;
emailoptout: boolean;
marketing_emails_opt_in: boolean;
overrideautoclose: boolean;
allowSingleSignOn: boolean;
email_verified: boolean;
language: string;
tax_state: string;
tax_countrycode: string;
lastlogin: string;
customfields: Array<{
id: number;
value: string;
}>;
};
users: Array<{
id: number;
name: string;
email: string;
is_owner: boolean;
}>;
stats: {
numdueinvoices: number;
dueinvoicesbalance: string;
incredit: boolean;
creditbalance: string;
grossRevenue: string;
expenses: string;
income: string;
numoverdueinvoices: number;
overdueinvoicesbalance: string;
numDraftInvoices: number;
draftInvoicesBalance: string;
numunpaidinvoices: number;
unpaidinvoicesamount: string;
numpaidinvoices: number;
paidinvoicesamount: string;
numcancelledinvoices: number;
cancelledinvoicesamount: string;
numrefundedinvoices: number;
refundedinvoicesamount: string;
numcollectionsinvoices: number;
collectionsinvoicesamount: string;
numpaymentpendinginvoices: number;
paymentpendinginvoicesamount: string;
productsnumactivehosting: number;
productsnumhosting: number;
productsnumactivereseller: number;
productsnumreseller: number;
productsnumactiveservers: number;
productsnumservers: number;
productsnumactiveother: number;
productsnumother: number;
productsnumactive: number;
productsnumtotal: number;
numactivedomains: number;
numdomains: number;
numacceptedquotes: number;
numquotes: number;
numtickets: number;
numactivetickets: number;
numaffiliatesignups: number;
isAffiliate: boolean;
};
}
interface GetClientsDomainsRequest {
clientid?: number;
domainid?: number;
limitstart?: number;
limitnum?: number;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetClientsDomainsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
domains: {
domain: Array<{
id: number;
userid: number;
orderid: number;
regtype: string;
domainname: string;
registrar: string;
regperiod: number;
paymentmethod: string;
firstpaymentamount: string;
recurringamount: string;
registrationdate: string;
expirydate: string;
nextduedate: string;
status: string;
subscriptionid: string;
promoid: number;
dnsmanagement: boolean;
emailforwarding: boolean;
idprotection: boolean;
donotrenew: boolean;
notes: string;
}>;
};
}
interface GetClientsProductsRequest {
clientid?: number;
serviceid?: number;
pid?: number;
domain?: string;
limitstart?: number;
limitnum?: number;
orderby?: string;
order?: 'ASC' | 'DESC';
}
interface GetClientsProductsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
products: {
product: Array<{
id: number;
clientid: number;
orderid: number;
pid: number;
regdate: string;
name: string;
translated_name: string;
groupname: string;
translated_groupname: string;
domain: string;
dedicatedip: string;
serverid: number;
servername: string;
serverip: string;
serverhostname: string;
suspendreason: string;
firstpaymentamount: string;
recurringamount: string;
paymentmethod: string;
paymentmethodname: string;
billingcycle: string;
nextduedate: string;
status: string;
username: string;
password: string;
subscriptionid: string;
promoid: number;
overideautosuspend: number;
overidesuspenduntil: string;
ns1: string;
ns2: string;
assignedips: string;
notes: string;
diskusage: number;
disklimit: number;
bwusage: number;
bwlimit: number;
lastupdate: string;
customfields: Record<string, unknown>;
configoptions: Record<string, unknown>;
}>;
};
}
interface GetContactsRequest {
limitstart?: number;
limitnum?: number;
userid?: number;
firstname?: string;
lastname?: string;
companyname?: string;
email?: string;
address1?: string;
city?: string;
state?: string;
postcode?: string;
country?: string;
phonenumber?: string;
subaccount?: boolean;
}
interface GetContactsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
contacts: {
contact: Array<{
id: number;
userid: number;
firstname: string;
lastname: string;
companyname: string;
email: string;
address1: string;
address2: string;
city: string;
state: string;
postcode: string;
country: string;
phonenumber: string;
subaccount: boolean;
password: string;
permissions: string;
domainemails: boolean;
generalemails: boolean;
invoiceemails: boolean;
productemails: boolean;
supportemails: boolean;
affiliateemails: boolean;
created_at: string;
updated_at: string;
}>;
};
}
interface GetEmailsRequest {
clientid?: number;
limitstart?: number;
limitnum?: number;
date?: string;
subject?: string;
}
interface GetEmailsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
emails: {
email: Array<{
id: number;
userid: number;
subject: string;
message: string;
date: string;
to: string;
cc: string;
bcc: string;
pending: boolean;
failed: boolean;
}>;
};
}
interface UpdateClientRequest {
clientid: number;
firstname?: string;
lastname?: string;
companyname?: string;
email?: string;
address1?: string;
address2?: string;
city?: string;
state?: string;
postcode?: string;
country?: string;
phonenumber?: string;
password2?: string;
credit?: number;
taxexempt?: boolean;
latefeeoveride?: boolean;
overideduenotices?: boolean;
separateinvoices?: boolean;
disableautocc?: boolean;
emailoptout?: boolean;
overrideautoclose?: boolean;
allowsinglereceipt?: boolean;
status?: 'Active' | 'Inactive' | 'Closed';
clientgroup?: number;
customfields?: Record<string, unknown>;
language?: string;
currency?: number;
notes?: string;
cctype?: string;
cardnum?: string;
expdate?: string;
cvv?: string;
gatewayid?: string;
clearcreditcard?: boolean;
skipvalidation?: boolean;
}
interface UpdateContactRequest {
contactid: number;
generalemails?: boolean;
productemails?: boolean;
domainemails?: boolean;
invoiceemails?: boolean;
supportemails?: boolean;
affiliateemails?: boolean;
firstname?: string;
lastname?: string;
companyname?: string;
email?: string;
address1?: string;
address2?: string;
city?: string;
state?: string;
postcode?: string;
country?: string;
phonenumber?: string;
subaccount?: boolean;
password2?: string;
permissions?: string;
}
interface CreateOrUpdateTLDRequest {
extension: string;
id_protection?: boolean;
dns_management?: boolean;
email_forwarding?: boolean;
epp_required?: boolean;
auto_registrar?: string;
currency_code?: string;
grace_period_days?: number;
grace_period_fee?: number;
redemption_period_fee?: number;
register?: Record<number, number>;
renew?: Record<number, number>;
transfer?: Record<number, number>;
}
interface CreateOrUpdateTLDResponse extends WhmcsSuccessResponse {
extension: string;
pricing: unknown[];
}
interface DomainGetLockingStatusRequest {
domainid: number;
}
interface DomainGetLockingStatusResponse extends WhmcsResponse {
result: 'success';
lockstatus: string;
}
interface DomainGetNameserversRequest {
domainid: number;
}
interface DomainGetNameserversResponse extends WhmcsResponse {
result: 'success';
ns1: string;
ns2: string;
ns3: string;
ns4: string;
ns5: string;
}
interface DomainGetWhoisInfoRequest {
domainid: number;
}
interface DomainGetWhoisInfoResponse extends WhmcsResponse {
result: 'success';
whois: string;
}
interface DomainRegisterRequest {
domainid: number;
registrar?: string;
}
interface DomainReleaseRequest {
domainid: number;
newtag: string;
}
interface DomainRenewRequest {
domainid: number;
regperiod?: number;
}
interface DomainRequestEPPRequest {
domainid: number;
}
interface DomainToggleIdProtectRequest {
domainid: number;
protectenable?: boolean;
}
interface DomainTransferRequest {
domainid: number;
transfersecret?: string;
registrar?: string;
}
interface DomainUpdateLockingStatusRequest {
domainid: number;
lockstatus?: boolean;
}
interface DomainUpdateNameserversRequest {
domainid?: number;
domain?: string;
ns1: string;
ns2: string;
ns3?: string;
ns4?: string;
ns5?: string;
}
interface DomainUpdateWhoisInfoRequest {
domainid: number;
xml?: string;
firstname?: string;
lastname?: string;
companyname?: string;
email?: string;
address1?: string;
address2?: string;
city?: string;
state?: string;
postcode?: string;
country?: string;
phonenumber?: string;
fax?: string;
}
interface DomainWhoisRequest {
domain: string;
}
interface DomainWhoisResponse extends WhmcsResponse {
result: 'success';
status: string;
whois: string;
}
interface GetRegistrarsResponse extends WhmcsResponse {
result: 'success';
registrars: {
registrar: Array<{
registrar: string;
}>;
};
}
interface GetTLDPricingRequest {
clientid?: number;
currencyid?: number;
}
interface GetTLDPricingResponse extends WhmcsResponse {
result: 'success';
currency: {
id: number;
code: string;
prefix: string;
suffix: string;
rate: string;
};
pricing: Record<string, {
categories: string[];
addons: {
idprotection: {
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
};
};
register: Record<string, string>;
transfer: Record<string, string>;
renew: Record<string, string>;
}>;
}
interface UpdateClientDomainRequest {
domainid: number;
dnsmanagement?: boolean;
emailforwarding?: boolean;
idprotection?: boolean;
donotrenew?: boolean;
type?: 'Register' | 'Transfer';
regdate?: string;
domain?: string;
firstpaymentamount?: number;
recurringamount?: number;
registrar?: string;
regperiod?: number;
paymentmethod?: string;
subscriptionid?: string;
status?: 'Pending' | 'Pending Transfer' | 'Active' | 'Expired' | 'Cancelled' | 'Fraud';
nextduedate?: string;
nextinvoicedate?: string;
expirydate?: string;
reminderdate?: string;
registrationperiod?: number;
promoid?: number;
addons?: string;
notes?: string;
autorecalc?: boolean;
}
interface UpdateClientDomainResponse extends WhmcsResponse {
result: 'success';
domainid: number;
}
interface ActivateModuleRequest {
moduleType: string;
moduleName: string;
parameters?: Record<string, string>;
}
interface DeactivateModuleRequest {
moduleType: string;
moduleName: string;
newGateway?: string;
}
interface GetModuleConfigurationParametersRequest {
moduleType: string;
moduleName: string;
}
interface ModuleParameter {
name: string;
displayName: string;
fieldType: string;
}
interface GetModuleConfigurationParametersResponse extends WhmcsResponse {
result: 'success';
parameters: ModuleParameter[];
}
interface GetModuleQueueRequest {
relatedId?: number;
serviceType?: 'domain' | 'service' | 'addon' | '';
moduleName?: string;
moduleAction?: string;
since?: string;
}
interface QueueItem {
id: string;
serviceType: string;
serviceId: string;
moduleName: string;
moduleAction: string;
lastAttempt: string;
lastAttemptError: string;
numRetries: string;
completed: string;
createdAt: string;
updatedAt: string;
}
interface GetModuleQueueResponse extends WhmcsResponse {
result: 'success';
count: string;
queue: QueueItem[];
}
interface UpdateModuleConfigurationRequest {
moduleType: string;
moduleName: string;
parameters?: Record<string, string>;
}
interface AcceptOrderRequest {
orderid: number;
serverid?: number;
serviceusername?: string;
servicepassword?: string;
registrar?: string;
sendregistrar?: boolean;
autosetup?: boolean;
sendemail?: boolean;
}
interface AddOrderRequest {
clientid: number;
productid: number;
paymentmethod: string;
domain?: string;
billingcycle?: string;
domaintype?: string;
regperiod?: number;
eppcode?: string;
nameserver1?: string;
nameserver2?: string;
nameserver3?: string;
nameserver4?: string;
nameserver5?: string;
customfields?: Record<string, unknown>;
configoptions?: Record<string, unknown>;
priceoverride?: number;
promocode?: string;
affid?: number;
noinvoice?: boolean;
noemail?: boolean;
addons?: string;
hostname?: string;
ns1prefix?: string;
ns2prefix?: string;
rootpw?: string;
contactid?: number;
dnsmanagement?: boolean;
domainfields?: Record<string, unknown>;
emailforwarding?: boolean;
idprotection?: boolean;
domainpriceoverride?: number;
domainrenewoverride?: number;
domainrenewals?: Record<string, unknown>;
clientip?: string;
}
interface AddOrderResponse extends WhmcsResponse {
result: 'success';
orderid: number;
productids: string;
addonids: string;
domainids: string;
invoiceid?: number;
}
interface CancelOrderRequest {
orderid: number;
cancelsub?: boolean;
noemail?: boolean;
}
interface DeleteOrderRequest {
orderid: number;
}
interface FraudOrderRequest {
orderid: number;
cancelsub?: boolean;
}
interface GetOrdersRequest {
limitstart?: number;
limitnum?: number;
clientid?: number;
requestor_id?: number;
status?: string;
}
interface GetOrdersResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
orders: {
order: Array<{
id: number;
ordernum?: string;
userid: number;
contactid: number;
requestor_id: number;
admin_requestor_id: number;
date: string;
nameservers: string;
transfersecret: string;
renewals: string;
promocode: string;
promotype: string;
promovalue: string;
orderdata: string;
amount: string;
paymentmethod: string;
invoiceid: number;
status: string;
ipaddress: string;
fraudmodule: string;
fraudoutput: string;
notes: string;
}>;
};
}
interface GetOrderStatusesResponse extends WhmcsResponse {
result: 'success';
statuses: {
status: Array<{
title: string;
color: string;
showpending: boolean;
showactive: boolean;
showcancelled: boolean;
sortorder: number;
}>;
};
}
interface GetProductsRequest {
pid?: number;
gid?: number;
module?: string;
}
interface GetProductsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
products: {
product: Array<{
pid: number;
gid: number;
type: string;
name: string;
description: string;
module: string;
paytype: string;
pricing: Record<string, unknown>;
customfields: Record<string, unknown>;
configoptions: Record<string, unknown>;
}>;
};
}
interface GetPromotionsRequest {
code?: string;
}
interface GetPromotionsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
promotions: {
promotion: Array<{
id: number;
code: string;
type: string;
recurring: number;
value: number;
cycles: string;
appliesto: string;
requires: string;
requiresexisting: number;
startdate: string;
expirationdate: string;
maxuses: number;
uses: number;
lifetimepromo: number;
applyonce: number;
newsignups: number;
existingclient: number;
onceperclient: number;
recurfor: number;
upgrades: number;
upgradeconfig: string;
notes: string;
}>;
};
}
interface OrderFraudCheckRequest {
orderid: number;
}
interface OrderFraudCheckResponse extends WhmcsResponse {
result: 'success';
module: string;
results: string;
}
interface PendingOrderRequest {
orderid: number;
}
interface AddProductRequest {
name: string;
gid: number;
slug?: string;
type?: 'hostingaccount' | 'reselleraccount' | 'server' | 'other';
stockcontrol?: boolean;
qty?: number;
paytype?: 'free' | 'onetime' | 'recurring';
hidden?: boolean;
showdomainoptions?: boolean;
tax?: boolean;
isFeatured?: boolean;
proratabilling?: boolean;
description?: string;
shortdescription?: string;
tagline?: string;
color?: string;
welcomeemail?: number;
proratadate?: number;
proratachargenextmonth?: number;
subdomain?: string;
autosetup?: '' | 'on' | 'payment' | 'order';
module?: string;
servergroupid?: number;
configoption1?: unknown;
configoption2?: unknown;
configoption3?: unknown;
configoption4?: unknown;
configoption5?: unknown;
configoption6?: unknown;
order?: number;
pricing?: Record<number, Record<string, number>>;
recommendations?: Array<{
id: number;
order: number;
}>;
ondemandrenewalconfigurationoverride?: boolean;
ondemandrenewalsenabled?: boolean;
ondemandrenewalperiodmonthly?: number;
ondemandrenewalperiodquarterly?: number;
ondemandrenewalperiodsemiannually?: number;
ondemandrenewalperiodannually?: number;
ondemandrenewalperiodbiennially?: number;
ondemandrenewalperiodtriennially?: number;
}
interface AddProductResponse extends WhmcsSuccessResponse {
pid: number;
}
interface AddProjectMessageRequest {
projectid: number;
message: string;
adminid?: number;
}
interface AddProjectTaskRequest {
projectid: number;
duedate: string;
adminid?: number;
task?: string;
notes?: string;
completed?: boolean;
billed?: boolean;
}
interface CreateProjectRequest {
title: string;
adminid: number;
userid?: number;
status?: string;
created?: string;
duedate?: string;
completed?: boolean;
ticketids?: string;
invoiceids?: string;
}
interface CreateProjectResponse extends WhmcsSuccessResponse {
message: string;
projectid: string;
}
interface DeleteProjectTaskRequest {
projectid: number;
taskid: number;
}
interface EndTaskTimerRequest {
timerid: number;
projectid?: number;
adminid?: number;
end_time?: number;
}
interface GetProjectRequest {
projectid: number;
}
interface GetProjectResponse extends WhmcsResponse {
result: 'success';
projectinfo: Record<string, string>;
tasks: Record<string, string>;
messages: Record<string, string>;
}
interface GetProjectsRequest {
limitstart?: number;
limitnum?: number;
userid?: number;
title?: string;
ticketids?: string;
invoiceids?: string;
notes?: string;
adminid?: number;
status?: string;
created?: string;
duedate?: string;
completed?: boolean;
lastmodified?: string;
}
interface GetProjectsResponse extends WhmcsResponse {
result: 'success';
totalresults: number;
startnumber: number;
numreturned: number;
invoices: unknown[];
}
interface StartTaskTimerRequest {
timerid: number;
projectid: number;
adminid?: number;
start_time?: number;
end_time?: number;
}
interface UpdateProjectRequest {
projectid: number;
adminid?: number;
userid?: number;
status?: string;
created?: string;
duedate?: string;
completed?: boolean;
title?: string;
ticketids?: string;
invoiceids?: string;
notes?: string;
}
interface UpdateProjectTaskRequest {
taskid: number;
projectid?: number;
duedate?: string;
adminid?: number;
task?: string;
notes?: string;
completed?: boolean;
}
interface GetHealthStatusRequest {
fetchStatus?: boolean;
}
type HealthCheck = {
name: string;
type: string;
severityLevel: string;
body: string;
};
interface GetHealthStatusResponse extends WhmcsSuccessResponse {
checks: {
success: HealthCheck[];
warning: HealthCheck[];
danger: HealthCheck[];
};
}
interface GetServersRequest {
serviceId?: number;
addonId?: number;
fetchStatus?: boolean;
}
interface ServerStatus {
http: boolean;
load: string;
uptime: string;
}
interface Server {
id: number;
name: string;
hostname: string;
ipaddress: string;
active: boolean;
activeServices: number;
maxAllowedServices: number;
percentUsed: number;
module: string;
status: ServerStatus;
}
interface GetServersResponse extends WhmcsResponse {
result: 'success';
servers: Serve