Skip to content
Last updated

UpdateClient

Updates a client with the passed parameters.

Request Parameters

ParameterTypeDescriptionRequired
actionstring"UpdateClient"Required
clientidintThe ID of the client to update.Optional
clientemailstringThe email address of the client to update. Either $clientid or $clientemail is required.Optional
firstnamestringOptional
lastnamestringOptional
companynamestringOptional
emailstringOptional
address1stringOptional
address2stringOptional
citystringOptional
statestringOptional
postcodestringOptional
countrystringTwo-character ISO country code.Optional
phonenumberstringOptional
tax_idstringThe client Tax ID.Optional
cardtypestringCredit card type. Provide the full name: Visa, Mastercard, American Express, etc.Deprecated
cardnumstringCredit card number.Deprecated
expdatestringFormat: MMYYDeprecated
startdatestringFormat: MMYY (if applicable)Deprecated
issuenumberstringCredit card issue number (if applicable).Deprecated
cvvstringCredit card CVV number (will not be stored).Deprecated
bankcodestringClient Bank Account Code (if applicable).Deprecated
bankacctstringClient bank Account number (if applicable).Deprecated
currencyintCurrency ID from tblcurrencies.Optional
groupidintClient Group ID from tblclientgroups.Optional
customfieldsstringBase64-encoded serialized array of custom field values.Optional
languagestringDefault language setting. Provide the full name: 'english', 'french', etc.Optional
clientipstringIP address of the user.Optional
notesstringAdmin-only notes.Optional
statusstringThe status. For example, "Active".Optional
paymentmethodstringThe default payment method.Optional
email_preferences[general]boolWhether the client should receive general emails.Optional
email_preferences[product]boolWhether the client should receive product emails.Optional
email_preferences[domain]boolWhether the client should receive domain emails.Optional
email_preferences[invoice]boolWhether the client should receive invoice emails.Optional
email_preferences[support]boolWhether the client should receive support emails.Optional
email_preferences[affiliate]boolWhether the client should receive affiliate emails.Optional
marketingoptinboolSet this to 'true' to opt the client in to marketing emails.Optional
clearcreditcardboolSet this to 'true' to clear the stored credit card details.Optional
skipvalidationboolSet this to 'true' to ignore required field validation.Optional
latefeeoverideboolWhether to override the account's Late Fees setting.Optional
overideduenoticesboolWhether to override the account's Overdue Notices setting.Optional
taxexemptboolWhether the account is exempt from tax collections.Optional
separateinvoicesboolWhether to group items that share a due date and payment method into one invoice for the account.Optional
disableautoccboolWhether to enable or disable automatic credit card processing.Optional
overrideautocloseboolWhether to enable or disable automatic credit card processing.Optional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'UpdateClient',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'clientid' => '1',
            'firstname' => 'John',
            'lastname' => 'Doe',
            'email' => '[email protected]',
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'UpdateClient';
$postData = array(
    'clientid' => '1',
    'firstname' => 'John',
    'lastname' => 'Doe',
    'email' => '[email protected]',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "result": "success",
    "clientid": "1"
}

Warning Responses

Warning responses are returned when using API functionality that has been removed or marked as deprecated. We suggest following any recommended actions in the warning to ensure future compatibility.

Possible warning messages include:

  • Credit card related parameters are now deprecated and may be removed in a future version. Use AddPayMethod or UpdatePayMethod instead.
  • Credit card related parameters are now deprecated and may be removed in a future version. Use DeletePayMethod instead.

Error Responses

Possible error condition responses include:

  • Client ID Not Found
  • You must have at least one email address enabled to receive domain related notifications as required by ICANN. To disable domain notifications, please create an alternative contact that is set to receive them
  • Duplicate Email Address
  • The email address entered is not valid
  • Multiple Credit Card Pay Methods Found
  • Multiple Bank Account Pay Methods Found

Version History

VersionChangelog
1.0Initial Version
7.8Credit card related parameters are now deprecated and may be removed in a future version. Use AddPayMethod, DeletePayMethod or UpdatePayMethod instead.
7.10Added email preferences parameters
8.0Removed attributes migrated to users: security questions and password