Create an agent


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 —

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

User type or role

Possible values:

  • admin;
  • employee;
  • support

By default: employee

password* Password

Default group

The agent will be added to this group upon creation

phone Agent's phone number


No more than 15 MB


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


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': '',
    'role': 'admin',
    'password': 'qwerty123',
    'group': '123',
    'phone': '89156743287',

PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'name' => 'Agent Name',
    'email' => '',
    'role' => 'admin',
    'password' => 'qwerty123',
    'group' => '123',
    'phone'  => '89156743287'
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, '');
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

Server response parameters

user_idAgent ID
statusRequest execution status