Update a client

POST https://secure.usedesk.com/uapi/update/client

Warning. If you use the server version of Usedesk, you will have a different URL of methods. Check the URL for the API with our team — support@usedesk.com.

The method allows you to edit client information.

Parameter Value
api_token* Channel API token
client_id* Client ID
name New client name
emails

Array with email addresses

The system will add emails to existing ones

messengers

Array with messenger data that can be updated or added to the client card

Contains parameters:

  • id — messenger id (optional)
    If specified, the existing messenger will be changed;
    • String, 64 characters. If an empty value is passed and an id parameter is given, the messenger will be deleted
  • identity — nickname, phone number, other identifiers, which are displayed in the client card (required).
  • type — messenger type (required)
    Possible values:
    • telegram,
    • whatsapp,
    • viber,
    • skype,
    • gtalk,
    • imessage,
    • other
  • uid — User ID in the messenger (optional)
note Note text
is_new_note

New Note Flag

If false or no parameter is set, the note text is added to the existing

phone

User phone

The system will add the phone to the existing

sites

Array with client sites

Contains parameters:

  • ID — site ID (optional)
    If it is specified, the existing site will be updated
    If a non-existent id is specified, no update will take place
  • url — link to the client's site (required). If an empty value is provided and an ID parameter is given, the site will be deleted
avatar

Image file

multipart/form-data

status_vip

Client status: vip

Possible values:

  • true;
  • false

It cannot be used simultaneously with the status_spam parameter.

status_spam

Client status: spam

Possible values:

  • true;
  • false

It cannot be used simultaneously with the status_vip parameter.

position Client position
merge_id Identifier of the client with which the user with the client_id identifier will be merged
client_country Client country
client_city Client city
client_address Client address
new_address

New address flag

Passed if you want to create an additional address

phone_type

Phone type when saving

Possible values:

  • home;
  • mobile;
  • stationary;
  • fax;
  • other


Important: the status parameter has been deprecated, replaced by the status_spam and status_vip parameters.


PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'client_id'=>1234,
    'name' =>'Jon',
    'emails'=>['test@gmail.com'],
);
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/update/client');
curl_setopt($mch_api, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mch_api, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($mch_api, CURLOPT_TIMEOUT, 10);
curl_setopt($mch_api, CURLOPT_POST, true);
curl_setopt($mch_api, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($mch_api, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($mch_api);
return $result;
        


Server response example
{
    "client_id": 1234,
    "status": true
}
        


Server response parameters

Parameter Description
client_id Client ID
status Request execution status