Create an agent

POST https://secure.usedesk.com/uapi/create/user

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 creates an agent. It accepts the following parameters:

* — required fields

Parameter Value
api_token* Channel API token
name* Agent's name
email* Agent's mail
role

User type or role

Possible values:

  • admin;
  • employee;
  • support

By default: employee

password* Password
group*

Default group

The agent will be added to this group upon creation

phone Agent's phone number
avatar

Avatar

No more than 15 MB

send_invite

Sending an email with the login data to the specified email address to the agent when creating

Contents of the letter in the language specified when creating the agent

Possible values:

  • true
  • false

By default: false

lang

Agent's language

Possible values:

  • ru — Russian;
  • en — English;
  • es — Spanish;
  • kk — Kazakh;
  • pt-br — Portuguese

By default: ru


Request example
{
    'name': 'Agent Name',
    'email': 'agentemail@gmail.com',
    'role': 'admin',
    'password': 'qwerty123',
    'group': '123',
    'phone': '89156743287',
}
        


PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'name' => 'Agent Name',
    'email' => 'agentemail@gmail.com',
    'role' => 'admin',
    'password' => 'qwerty123',
    'group' => '123',
    'phone'  => '89156743287'
);
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/create/user');
curl_setopt($mch_api, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
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;
        


If the request is successful, the server will return a message about the successful creation and the ID of the new agent

Example of a response from server
{
    "status":"success",
    "user_id":2154861
}
        


Server response parameters

ParameterDescription
user_idAgent ID
statusRequest execution status