This service has been discontinued

If you are a company selling whmcs modules and you are interested in our code you can contact us with an offer at info at whmcstricks dot com
All other requests will be ignored.

WHMCS API Update CustomFields

February 20, 2020

A big problem with WHMCS is that you don't have any API to manage customfields. With this API you can update all clients, products and support custom fields.

You can use it as a standard WHMCS API. You may want to use it with internal API function. In this case WHMCS documentation is helpful so no more explanations are required. Keep in mind that due to the way WHMCS handles API permissions, you will only be able to use this as internal API.

To use it you have to upload the updatecustomfields.php (all lowercase) into the /includes/api whmcs folder and it's done.

$19 - Download Now


relidintThe ID of the related item you want to get the custom fields forRequired
typestringSupports client, product or support. defaults to clientOptional
customfieldint or stringUse either the id of the customfield or its nameRequired
valuestringThe new value for the custom field, can be emptyOptional

Response Parameters

resultstringThe result of the operation: success or error
messagestringThe result message

Example request (CURL)

Given the recent changes in WHMCS custom API work only with the Local API function.

Example Request (Local API)

$command = 'UpdateCustomFields';
$postData = array(
    'relid' => 1,
    'customfield' => 12,
    'value' => 'newvalue',
$adminUsername = 'ADMIN_USERNAME';

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

Example Response

Array (
 [result] => success,
 [message] => Custom field with id # has been updated with the value: newvalue,

Error Responses

Error response codes are:

  • The relid is undefined
  • The type you selected does not exists. Please check
  • The customfield is undefined
  • The customfield could not be found. Please check the 'customfield' and 'type' parameters
  • A client with id # does not exists
  • A product with id # does not exists
  • This product does not own this custom field
  • A ticket with id # does not exists
  • This support department does not own this custom field
$19 - Download Now

Got questions or problems? Contact us or comment, we'll be happy to help.

Leave a Reply

Your email address will not be published. Required fields are marked *