Get a list of agents


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 returns the list of company agents with groups that satisfy the specified filter conditions.

* — required fields

Parameter Value
api_token* Channel API token

User type or role

Possible values:

  • admin;
  • employee;
  • support

By default: employee

group_id ID of the agents group
query The string that is used for the search

User ID

If this field is passed, information about one agent will be returned

How to apply filters
    'query': 'Ivan',
    'user_type': 'admin',

PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'group_id'=> 123,
    'query' =>'Ivan',
$mch_api = curl_init(); // initialize cURL connection
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;

Sample response from server
        "id": "558",
        "name": "Agent Name",
        "email": "",
        "position": "",
        "role": "admin",
        "phone": null,
        "chat_online_status": "1",
        "online_status": "0",
        "groups": [
                "id": "123",
                "name": "Group",
                "company_id": "153561",
                "deleted": "0",
                "deleted_at": "0000-00-00 00:00:00",
                "pivot": {
                    "user_id": "558",
                    "user_group_id": "413"
                "id": "354",
                "name": "Group 2",
                "company_id": "153561",
                "deleted": "0",
                "deleted_at": "0000-00-00 00:00:00",
                "pivot": {
                    "user_id": "558",
                    "user_group_id": "354"
                "id": "127",
                "name": "Group 4",
                "company_id": "153561",
                "deleted": "0",
                "deleted_at": "0000-00-00 00:00:00",
                "pivot": {
                    "user_id": "558",
                    "user_group_id": "127"
                "id": "415",
                "name": "Test group 3",
                "company_id": "153561",
                "deleted": "0",
                "deleted_at": "0000-00-00 00:00:00",
                "pivot": {
                    "user_id": "558",
                    "user_group_id": "415"

Server response parameters

idAgent ID
nameAgent's name
emailAgent's Email
positionAgent position
roleRole of the agent
phoneAgent's phone number
online_statusOnline status of the agent in tickets
avatarAgent avatar URL
chat_online_statusOnline status of the agent in chats
groupsAn array of groups the agent is a member of
idGroup ID
nameGroup name
company_idCompany ID
deletedFlag indicating deletion of a group
deleted_atDate of group deletion
UTC+0 time zone
custom_working_timeFlag indicating the group's working time, different from the company's working time
timezoneGroup Time Zone
pivotData about the agent in the specified group
user_idAgent ID
user_group_idAgent group ID