Get a list of agents

POST https://secure.usedesk.com/uapi/users

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 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

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

User ID

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


How to apply filters
{
    'group_id':'123',
    'query': 'Ivan',
    'user_type': 'admin',
}
        


PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'group_id'=> 123,
    'query' =>'Ivan',
    'user_type'=>'admin',
);
$mch_api = curl_init(); // initialize cURL connection
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/users');
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": "agent@gmail.com",
        "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

ParameterDescription
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
Parameter
Description
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